mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 14:05:39 +00:00
Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)).
This commit is contained in:
parent
3e2930defe
commit
e07d7e649c
|
@ -109,17 +109,17 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter
|
|||
Uint32 entireStringLength;
|
||||
char *buffer;
|
||||
|
||||
if (runSeed == NULL || SDL_strlen(runSeed)==0) {
|
||||
if (runSeed == NULL || runSeed[0] == '\0') {
|
||||
SDLTest_LogError("Invalid runSeed string.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (suiteName == NULL || SDL_strlen(suiteName)==0) {
|
||||
if (suiteName == NULL || suiteName[0] == '\0') {
|
||||
SDLTest_LogError("Invalid suiteName string.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (testName == NULL || SDL_strlen(testName)==0) {
|
||||
if (testName == NULL || testName[0] == '\0') {
|
||||
SDLTest_LogError("Invalid testName string.");
|
||||
return -1;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
|||
}
|
||||
|
||||
/* Generate run see if we don't have one already */
|
||||
if (userRunSeed == NULL || SDL_strlen(userRunSeed) == 0) {
|
||||
if (userRunSeed == NULL || userRunSeed[0] == '\0') {
|
||||
runSeed = SDLTest_GenerateRunSeed(16);
|
||||
if (runSeed == NULL) {
|
||||
SDLTest_LogError("Generating a random seed failed");
|
||||
|
@ -422,7 +422,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
|||
SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed);
|
||||
|
||||
/* Initialize filtering */
|
||||
if (filter != NULL && SDL_strlen(filter) > 0) {
|
||||
if (filter != NULL && filter[0] != '\0') {
|
||||
/* Loop over all suites to check if we have a filter match */
|
||||
suiteCounter = 0;
|
||||
while (testSuites[suiteCounter] && suiteFilter == 0) {
|
||||
|
@ -521,7 +521,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
|
|||
suiteCounter,
|
||||
testCounter,
|
||||
currentTestName);
|
||||
if (testCase->description != NULL && SDL_strlen(testCase->description)>0) {
|
||||
if (testCase->description != NULL && testCase->description[0] != '\0') {
|
||||
SDLTest_Log("Test Description: '%s'",
|
||||
(testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ SDL_HasClipboardText(void)
|
|||
if (_this->HasClipboardText) {
|
||||
return _this->HasClipboardText(_this);
|
||||
} else {
|
||||
if ((_this->clipboard_text) && (SDL_strlen(_this->clipboard_text)>0)) {
|
||||
if (_this->clipboard_text && _this->clipboard_text[0] != '\0') {
|
||||
return SDL_TRUE;
|
||||
} else {
|
||||
return SDL_FALSE;
|
||||
|
|
|
@ -1453,7 +1453,7 @@ SDL_SetWindowData(SDL_Window * window, const char *name, void *userdata)
|
|||
CHECK_WINDOW_MAGIC(window, NULL);
|
||||
|
||||
/* Input validation */
|
||||
if (name == NULL || SDL_strlen(name) == 0) {
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
SDL_InvalidParamError("name");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1500,7 +1500,7 @@ SDL_GetWindowData(SDL_Window * window, const char *name)
|
|||
CHECK_WINDOW_MAGIC(window, NULL);
|
||||
|
||||
/* Input validation */
|
||||
if (name == NULL || SDL_strlen(name) == 0) {
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
SDL_InvalidParamError("name");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ SDL_bool BE_HasClipboardText(_THIS) {
|
|||
SDL_bool result = SDL_FALSE;
|
||||
char *text = BE_GetClipboardText(_this);
|
||||
if (text) {
|
||||
result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
|
||||
result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
|
||||
SDL_free(text);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -95,7 +95,7 @@ Cocoa_HasClipboardText(_THIS)
|
|||
SDL_bool result = SDL_FALSE;
|
||||
char *text = Cocoa_GetClipboardText(_this);
|
||||
if (text) {
|
||||
result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
|
||||
result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
|
||||
SDL_free(text);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -137,7 +137,7 @@ WIN_HasClipboardText(_THIS)
|
|||
SDL_bool result = SDL_FALSE;
|
||||
char *text = WIN_GetClipboardText(_this);
|
||||
if (text) {
|
||||
result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
|
||||
result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
|
||||
SDL_free(text);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -165,7 +165,7 @@ X11_HasClipboardText(_THIS)
|
|||
SDL_bool result = SDL_FALSE;
|
||||
char *text = X11_GetClipboardText(_this);
|
||||
if (text) {
|
||||
result = (SDL_strlen(text)>0) ? SDL_TRUE : SDL_FALSE;
|
||||
result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
|
||||
SDL_free(text);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -77,7 +77,7 @@ int audio_initQuitAudio()
|
|||
audioDriver = SDL_GetAudioDriver(i);
|
||||
SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i);
|
||||
SDLTest_AssertCheck(audioDriver != NULL, "Audio driver name is not NULL");
|
||||
SDLTest_AssertCheck(SDL_strlen(audioDriver) > 0, "Audio driver name is not empty; got: %s", audioDriver);
|
||||
SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver);
|
||||
|
||||
/* Call Init */
|
||||
result = SDL_AudioInit(audioDriver);
|
||||
|
@ -134,7 +134,7 @@ int audio_initOpenCloseQuitAudio()
|
|||
audioDriver = SDL_GetAudioDriver(i);
|
||||
SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i);
|
||||
SDLTest_AssertCheck(audioDriver != NULL, "Audio driver name is not NULL");
|
||||
SDLTest_AssertCheck(SDL_strlen(audioDriver) > 0, "Audio driver name is not empty; got: %s", audioDriver);
|
||||
SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver);
|
||||
|
||||
/* Change specs */
|
||||
for (j = 0; j < 2; j++) {
|
||||
|
@ -226,14 +226,14 @@ int audio_enumerateAndNameAudioDevices()
|
|||
SDLTest_AssertPass("Call to SDL_GetAudioDeviceName(%i, %i)", i, t);
|
||||
SDLTest_AssertCheck(name != NULL, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not NULL", i, t);
|
||||
if (name != NULL) {
|
||||
SDLTest_AssertCheck(SDL_strlen(name)>0, "verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, t, name);
|
||||
SDLTest_AssertCheck(name[0] != '\0', "verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, t, name);
|
||||
if (t==1) {
|
||||
/* Also try non-zero type */
|
||||
tt = t + SDLTest_RandomIntegerInRange(1,10);
|
||||
nameAgain = SDL_GetAudioDeviceName(i, tt);
|
||||
SDLTest_AssertCheck(nameAgain != NULL, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not NULL", i, tt);
|
||||
if (nameAgain != NULL) {
|
||||
SDLTest_AssertCheck(SDL_strlen(nameAgain)>0, "Verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, tt, nameAgain);
|
||||
SDLTest_AssertCheck(nameAgain[0] != '\0', "Verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'", i, tt, nameAgain);
|
||||
SDLTest_AssertCheck(SDL_strcmp(name, nameAgain)==0,
|
||||
"Verify SDL_GetAudioDeviceName(%i, %i) and SDL_GetAudioDeviceName(%i %i) return the same string",
|
||||
i, t, i, tt);
|
||||
|
@ -318,7 +318,7 @@ int audio_printAudioDrivers()
|
|||
SDLTest_AssertPass("Call to SDL_GetAudioDriver(%i)", i);
|
||||
SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
|
||||
if (name != NULL) {
|
||||
SDLTest_AssertCheck(SDL_strlen(name)>0, "Verify returned name is not empty, got: '%s'", name);
|
||||
SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ int audio_printCurrentAudioDriver()
|
|||
SDLTest_AssertPass("Call to SDL_GetCurrentAudioDriver()");
|
||||
SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
|
||||
if (name != NULL) {
|
||||
SDLTest_AssertCheck(SDL_strlen(name)>0, "Verify returned name is not empty, got: '%s'", name);
|
||||
SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
|
||||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
@ -509,7 +509,7 @@ int audio_buildAudioCVTNegative()
|
|||
SDLTest_AssertCheck(result == -1, "Verify result value; expected: -1, got: %i", result);
|
||||
error = SDL_GetError();
|
||||
SDLTest_AssertPass("Call to SDL_GetError()");
|
||||
SDLTest_AssertCheck(error != NULL && SDL_strlen(error)>0, "Validate that error message was not NULL or empty");
|
||||
SDLTest_AssertCheck(error != NULL && error[0] != '\0', "Validate that error message was not NULL or empty");
|
||||
}
|
||||
|
||||
SDL_ClearError();
|
||||
|
|
|
@ -118,7 +118,7 @@ clipboard_testClipboardTextFunctions(void *arg)
|
|||
charResult != NULL,
|
||||
"Verify SDL_GetClipboardText did not return NULL");
|
||||
SDLTest_AssertCheck(
|
||||
SDL_strlen(charResult) == 0,
|
||||
charResult[0] == '\0',
|
||||
"Verify SDL_GetClipboardText returned string with length 0, got length %i",
|
||||
SDL_strlen(charResult));
|
||||
intResult = SDL_SetClipboardText((const char *)text);
|
||||
|
|
|
@ -242,7 +242,7 @@ pixels_getPixelFormatName(void *arg)
|
|||
SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
|
||||
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
|
||||
if (result != NULL) {
|
||||
SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
|
||||
SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
|
||||
SDLTest_AssertCheck(SDL_strcmp(result, unknownFormat) == 0,
|
||||
"Verify result text; expected: %s, got %s", unknownFormat, result);
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ pixels_getPixelFormatName(void *arg)
|
|||
SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
|
||||
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
|
||||
if (result != NULL) {
|
||||
SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
|
||||
SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
|
||||
SDLTest_AssertCheck(SDL_strcmp(result, _RGBPixelFormatsVerbose[i]) == 0,
|
||||
"Verify result text; expected: %s, got %s", _RGBPixelFormatsVerbose[i], result);
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ pixels_getPixelFormatName(void *arg)
|
|||
SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
|
||||
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
|
||||
if (result != NULL) {
|
||||
SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
|
||||
SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
|
||||
SDLTest_AssertCheck(SDL_strcmp(result, _nonRGBPixelFormatsVerbose[i]) == 0,
|
||||
"Verify result text; expected: %s, got %s", _nonRGBPixelFormatsVerbose[i], result);
|
||||
}
|
||||
|
@ -290,14 +290,14 @@ pixels_getPixelFormatName(void *arg)
|
|||
SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format);
|
||||
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
|
||||
if (result != NULL) {
|
||||
SDLTest_AssertCheck(SDL_strlen(result) > 0,
|
||||
SDLTest_AssertCheck(result[0] != '\0',
|
||||
"Verify result is non-empty; got: %s", result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(result, _invalidPixelFormatsVerbose[i]) == 0,
|
||||
"Validate name is UNKNOWN, expected: '%s', got: '%s'", _invalidPixelFormatsVerbose[i], result);
|
||||
}
|
||||
error = SDL_GetError();
|
||||
SDLTest_AssertPass("Call to SDL_GetError()");
|
||||
SDLTest_AssertCheck(error != NULL && SDL_strlen(error) == 0, "Validate that error message is empty");
|
||||
SDLTest_AssertCheck(error != NULL && error[0] != '\0', "Validate that error message is empty");
|
||||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
|
|
@ -192,7 +192,7 @@ sdltest_randomBoundaryNumberUint8(void *arg)
|
|||
"Validate result value for parameters (1,255,SDL_FALSE); expected: 0, got: %lld", uresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomUintXBoundaryValue(0, 0xfe, SDL_FALSE) returns 0xff (no error) */
|
||||
uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 254, SDL_FALSE);
|
||||
|
@ -202,7 +202,7 @@ sdltest_randomBoundaryNumberUint8(void *arg)
|
|||
"Validate result value for parameters (0,254,SDL_FALSE); expected: 0xff, got: %lld", uresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomUintXBoundaryValue(0, 0xff, SDL_FALSE) returns 0 (sets error) */
|
||||
uresult = (Uint64)SDLTest_RandomUint8BoundaryValue(0, 255, SDL_FALSE);
|
||||
|
@ -302,7 +302,7 @@ sdltest_randomBoundaryNumberUint16(void *arg)
|
|||
"Validate result value for parameters (1,0xffff,SDL_FALSE); expected: 0, got: %lld", uresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomUintXBoundaryValue(0, 0xfffe, SDL_FALSE) returns 0xffff (no error) */
|
||||
uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xfffe, SDL_FALSE);
|
||||
|
@ -312,7 +312,7 @@ sdltest_randomBoundaryNumberUint16(void *arg)
|
|||
"Validate result value for parameters (0,0xfffe,SDL_FALSE); expected: 0xffff, got: %lld", uresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomUintXBoundaryValue(0, 0xffff, SDL_FALSE) returns 0 (sets error) */
|
||||
uresult = (Uint64)SDLTest_RandomUint16BoundaryValue(0, 0xffff, SDL_FALSE);
|
||||
|
@ -412,7 +412,7 @@ sdltest_randomBoundaryNumberUint32(void *arg)
|
|||
"Validate result value for parameters (1,0xffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomUintXBoundaryValue(0, 0xfffffffe, SDL_FALSE) returns 0xffffffff (no error) */
|
||||
uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xfffffffe, SDL_FALSE);
|
||||
|
@ -422,7 +422,7 @@ sdltest_randomBoundaryNumberUint32(void *arg)
|
|||
"Validate result value for parameters (0,0xfffffffe,SDL_FALSE); expected: 0xffffffff, got: %lld", uresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomUintXBoundaryValue(0, 0xffffffff, SDL_FALSE) returns 0 (sets error) */
|
||||
uresult = (Uint64)SDLTest_RandomUint32BoundaryValue(0, 0xffffffff, SDL_FALSE);
|
||||
|
@ -522,7 +522,7 @@ sdltest_randomBoundaryNumberUint64(void *arg)
|
|||
"Validate result value for parameters (1,0xffffffffffffffff,SDL_FALSE); expected: 0, got: %lld", uresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomUintXBoundaryValue(0, 0xfffffffffffffffe, SDL_FALSE) returns 0xffffffffffffffff (no error) */
|
||||
uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xfffffffffffffffeULL, SDL_FALSE);
|
||||
|
@ -532,7 +532,7 @@ sdltest_randomBoundaryNumberUint64(void *arg)
|
|||
"Validate result value for parameters (0,0xfffffffffffffffe,SDL_FALSE); expected: 0xffffffffffffffff, got: %lld", uresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomUintXBoundaryValue(0, 0xffffffffffffffff, SDL_FALSE) returns 0 (sets error) */
|
||||
uresult = (Uint64)SDLTest_RandomUint64BoundaryValue(0, (Uint64)0xffffffffffffffffULL, SDL_FALSE);
|
||||
|
@ -632,7 +632,7 @@ sdltest_randomBoundaryNumberSint8(void *arg)
|
|||
"Validate result value for parameters (SCHAR_MIN + 1,SCHAR_MAX,SDL_FALSE); expected: %d, got: %lld", SCHAR_MIN, sresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX - 1, SDL_FALSE) returns SCHAR_MAX (no error) */
|
||||
sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX -1, SDL_FALSE);
|
||||
|
@ -642,7 +642,7 @@ sdltest_randomBoundaryNumberSint8(void *arg)
|
|||
"Validate result value for parameters (SCHAR_MIN,SCHAR_MAX - 1,SDL_FALSE); expected: %d, got: %lld", SCHAR_MAX, sresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomSintXBoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE) returns SCHAR_MIN (sets error) */
|
||||
sresult = (Sint64)SDLTest_RandomSint8BoundaryValue(SCHAR_MIN, SCHAR_MAX, SDL_FALSE);
|
||||
|
@ -742,7 +742,7 @@ sdltest_randomBoundaryNumberSint16(void *arg)
|
|||
"Validate result value for parameters (SHRT_MIN+1,SHRT_MAX,SDL_FALSE); expected: %d, got: %lld", SHRT_MIN, sresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE) returns SHRT_MAX (no error) */
|
||||
sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX - 1, SDL_FALSE);
|
||||
|
@ -752,7 +752,7 @@ sdltest_randomBoundaryNumberSint16(void *arg)
|
|||
"Validate result value for parameters (SHRT_MIN,SHRT_MAX - 1,SDL_FALSE); expected: %d, got: %lld", SHRT_MAX, sresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomSintXBoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE) returns 0 (sets error) */
|
||||
sresult = (Sint64)SDLTest_RandomSint16BoundaryValue(SHRT_MIN, SHRT_MAX, SDL_FALSE);
|
||||
|
@ -859,7 +859,7 @@ sdltest_randomBoundaryNumberSint32(void *arg)
|
|||
"Validate result value for parameters (LONG_MIN+1,LONG_MAX,SDL_FALSE); expected: %d, got: %lld", long_min, sresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX - 1, SDL_FALSE) returns LONG_MAX (no error) */
|
||||
sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max - 1, SDL_FALSE);
|
||||
|
@ -869,7 +869,7 @@ sdltest_randomBoundaryNumberSint32(void *arg)
|
|||
"Validate result value for parameters (LONG_MIN,LONG_MAX - 1,SDL_FALSE); expected: %d, got: %lld", long_max, sresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomSintXBoundaryValue(LONG_MIN, LONG_MAX, SDL_FALSE) returns 0 (sets error) */
|
||||
sresult = (Sint64)SDLTest_RandomSint32BoundaryValue(long_min, long_max, SDL_FALSE);
|
||||
|
@ -969,7 +969,7 @@ sdltest_randomBoundaryNumberSint64(void *arg)
|
|||
"Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %lld, got: %lld", LLONG_MIN, sresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE) returns LLONG_MAX (no error) */
|
||||
sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE);
|
||||
|
@ -979,7 +979,7 @@ sdltest_randomBoundaryNumberSint64(void *arg)
|
|||
"Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %lld, got: %lld", LLONG_MAX, sresult);
|
||||
lastError = (char *)SDL_GetError();
|
||||
SDLTest_AssertPass("SDL_GetError()");
|
||||
SDLTest_AssertCheck(lastError == NULL || SDL_strlen(lastError) == 0, "Validate no error message was set");
|
||||
SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set");
|
||||
|
||||
/* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE) returns 0 (sets error) */
|
||||
sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE);
|
||||
|
|
|
@ -331,7 +331,7 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
|
||||
case SDL_TEXTINPUT:
|
||||
if (SDL_strlen(event.text.text) == 0 || event.text.text[0] == '\n' ||
|
||||
if (event.text.text[0] == '\0' || event.text.text[0] == '\n' ||
|
||||
markedRect.w < 0)
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue