mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-19 17:58:13 +00:00
stdlib: Conditionally undef some SDL_strtox tests
Some test cases have implementation-defined results, so we should only test these when we know SDL's own implementations of the functions are used.
This commit is contained in:

committed by
Sam Lantinga

parent
59ec034412
commit
eb199176e6
@@ -389,8 +389,13 @@ static size_t SDL_ScanUnsignedLongLongInternal(const char *text, int count, int
|
||||
} while (count == 0 || (text - text_start) != count);
|
||||
}
|
||||
if (text == number_start) {
|
||||
// no number was parsed, and thus no characters were consumed
|
||||
text = text_start;
|
||||
if (radix == 16 && text > text_start && (*(text - 1) == 'x' || *(text - 1) == 'X')) {
|
||||
// the string was "0x"; consume the '0' but not the 'x'
|
||||
--text;
|
||||
} else {
|
||||
// no number was parsed, and thus no characters were consumed
|
||||
text = text_start;
|
||||
}
|
||||
}
|
||||
if (overflow) {
|
||||
if (negative) {
|
||||
@@ -478,8 +483,13 @@ static size_t SDL_ScanUnsignedLongLongInternalW(const wchar_t *text, int count,
|
||||
} while (count == 0 || (text - text_start) != count);
|
||||
}
|
||||
if (text == number_start) {
|
||||
// no number was parsed, and thus no characters were consumed
|
||||
text = text_start;
|
||||
if (radix == 16 && text > text_start && (*(text - 1) == 'x' || *(text - 1) == 'X')) {
|
||||
// the string was "0x"; consume the '0' but not the 'x'
|
||||
--text;
|
||||
} else {
|
||||
// no number was parsed, and thus no characters were consumed
|
||||
text = text_start;
|
||||
}
|
||||
}
|
||||
if (overflow) {
|
||||
if (negative) {
|
||||
@@ -656,8 +666,7 @@ static size_t SDL_ScanFloat(const char *text, double *valuep)
|
||||
if (text == number_start) {
|
||||
// no number was parsed, and thus no characters were consumed
|
||||
text = text_start;
|
||||
}
|
||||
if (negative) {
|
||||
} else if (negative) {
|
||||
value = -value;
|
||||
}
|
||||
*valuep = value;
|
||||
|
Reference in New Issue
Block a user