mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-06 13:35:37 +00:00
Fixed %p formatting when there is following text
(cherry picked from commit f4bd17deeeca6957d92979cf07fa436c249a9eda)
This commit is contained in:
parent
52d63ba26c
commit
3054c0dc50
|
@ -1810,6 +1810,7 @@ int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *f
|
||||||
case 'p':
|
case 'p':
|
||||||
info.force_case = SDL_CASE_LOWER;
|
info.force_case = SDL_CASE_LOWER;
|
||||||
length += SDL_PrintPointer(TEXT_AND_LEN_ARGS, &info, va_arg(ap, void *));
|
length += SDL_PrintPointer(TEXT_AND_LEN_ARGS, &info, va_arg(ap, void *));
|
||||||
|
done = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
info.force_case = SDL_CASE_LOWER;
|
info.force_case = SDL_CASE_LOWER;
|
||||||
|
@ -1821,9 +1822,6 @@ int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *f
|
||||||
if (info.radix == 10) {
|
if (info.radix == 10) {
|
||||||
info.radix = 16;
|
info.radix = 16;
|
||||||
}
|
}
|
||||||
if (*fmt == 'p') {
|
|
||||||
inttype = DO_LONG;
|
|
||||||
}
|
|
||||||
SDL_FALLTHROUGH;
|
SDL_FALLTHROUGH;
|
||||||
case 'o':
|
case 'o':
|
||||||
if (info.radix == 10) {
|
if (info.radix == 10) {
|
||||||
|
|
|
@ -181,6 +181,12 @@ int stdlib_snprintf(void *arg)
|
||||||
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text);
|
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text);
|
||||||
SDLTest_AssertCheck(result == SDL_strlen(expected), "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result);
|
SDLTest_AssertCheck(result == SDL_strlen(expected), "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result);
|
||||||
|
|
||||||
|
result = SDL_snprintf(text, sizeof(text), "A %p B", (void *)0x1234abcd);
|
||||||
|
expected = "A 0x1234abcd B";
|
||||||
|
SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"A %%p B\", 0x1234abcd)");
|
||||||
|
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text);
|
||||||
|
SDLTest_AssertCheck(result == SDL_strlen(expected), "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result);
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue