Commit a887b8e28b5d72639d403d982612a1ee31bd05a0

Ozkan Sezer 2021-12-03T20:03:10

SDL_test_common.c: replaced all printf() calls with SDL_Log() Otherwise, if one builds libSDL2_test using a new mingw but builds the test programs using an older mingw, a link failure happens: /opt/local/x86_64-w64-mingw32/lib/libSDL2_test.a(SDL_test_common.o): In function `printf': /opt/local/x86_64-w64-mingw32/include/stdio.h:372: undefined reference to `__imp___acrt_iob_func' collect2: ld returned 1 exit status

diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 7a8ad9e..f4622cb 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -1292,7 +1292,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
             SDL_GetWindowSize(state->windows[i], &w, &h);
             if (!(state->window_flags & SDL_WINDOW_RESIZABLE) &&
                 (w != state->window_w || h != state->window_h)) {
-                printf("Window requested size %dx%d, got %dx%d\n", state->window_w, state->window_h, w, h);
+                SDL_Log("Window requested size %dx%d, got %dx%d\n", state->window_w, state->window_h, w, h);
                 state->window_w = w;
                 state->window_h = h;
             }
@@ -1970,7 +1970,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
             if (withControl) {
                 /* Ctrl-C copy awesome text! */
                 SDL_SetClipboardText("SDL rocks!\nYou know it!");
-                printf("Copied text to clipboard\n");
+                SDL_Log("Copied text to clipboard\n");
             }
             if (withAlt) {
                 /* Alt-C toggle a render clip rectangle */
@@ -2006,9 +2006,9 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
                 /* Ctrl-V paste awesome text! */
                 char *text = SDL_GetClipboardText();
                 if (*text) {
-                    printf("Clipboard: %s\n", text);
+                    SDL_Log("Clipboard: %s\n", text);
                 } else {
-                    printf("Clipboard is empty\n");
+                    SDL_Log("Clipboard is empty\n");
                 }
                 SDL_free(text);
             }