Pārlūkot izejas kodu

Remove casts from typed pointer to void * for printf %p in test projects

Petar Popovic 6 mēneši atpakaļ
vecāks
revīzija
e5d3a1b6f5
3 mainītis faili ar 8 papildinājumiem un 8 dzēšanām
  1. 5 5
      test/testautomation_audio.c
  2. 2 2
      test/testautomation_events.c
  3. 1 1
      test/testcamera.c

+ 5 - 5
test/testautomation_audio.c

@@ -567,7 +567,7 @@ static int SDLCALL audio_buildAudioStream(void *arg)
     spec1.freq = 22050;
     stream = SDL_CreateAudioStream(&spec1, &spec1);
     SDLTest_AssertPass("Call to SDL_CreateAudioStream(spec1 ==> spec1)");
-    SDLTest_AssertCheck(stream != NULL, "Verify stream value; expected: != NULL, got: %p", (void *)stream);
+    SDLTest_AssertCheck(stream != NULL, "Verify stream value; expected: != NULL, got: %p", stream);
     SDL_DestroyAudioStream(stream);
 
     /* Typical conversion */
@@ -579,7 +579,7 @@ static int SDLCALL audio_buildAudioStream(void *arg)
     spec2.freq = 44100;
     stream = SDL_CreateAudioStream(&spec1, &spec2);
     SDLTest_AssertPass("Call to SDL_CreateAudioStream(spec1 ==> spec2)");
-    SDLTest_AssertCheck(stream != NULL, "Verify stream value; expected: != NULL, got: %p", (void *)stream);
+    SDLTest_AssertCheck(stream != NULL, "Verify stream value; expected: != NULL, got: %p", stream);
     SDL_DestroyAudioStream(stream);
 
     /* All source conversions with random conversion targets, allow 'null' conversions */
@@ -599,7 +599,7 @@ static int SDLCALL audio_buildAudioStream(void *arg)
 
                 SDLTest_AssertPass("Call to SDL_CreateAudioStream(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
                                    i, g_audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, g_audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
-                SDLTest_AssertCheck(stream != NULL, "Verify stream value; expected: != NULL, got: %p", (void *)stream);
+                SDLTest_AssertCheck(stream != NULL, "Verify stream value; expected: != NULL, got: %p", stream);
                 if (stream == NULL) {
                     SDLTest_LogError("%s", SDL_GetError());
                 }
@@ -684,7 +684,7 @@ static int SDLCALL audio_buildAudioStreamNegative(void *arg)
         SDLTest_Log("%s", message);
         stream = SDL_CreateAudioStream(&spec1, &spec2);
         SDLTest_AssertPass("Call to SDL_CreateAudioStream(spec1 ==> spec2)");
-        SDLTest_AssertCheck(stream == NULL, "Verify stream value; expected: NULL, got: %p", (void *)stream);
+        SDLTest_AssertCheck(stream == NULL, "Verify stream value; expected: NULL, got: %p", stream);
         error = SDL_GetError();
         SDLTest_AssertPass("Call to SDL_GetError()");
         SDLTest_AssertCheck(error != NULL && error[0] != '\0', "Validate that error message was not NULL or empty");
@@ -791,7 +791,7 @@ static int SDLCALL audio_convertAudio(void *arg)
                     stream = SDL_CreateAudioStream(&spec1, &spec2);
                     SDLTest_AssertPass("Call to SDL_CreateAudioStream(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
                                        i, g_audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, g_audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
-                    SDLTest_AssertCheck(stream != NULL, "Verify stream value; expected: != NULL, got: %p", (void *)stream);
+                    SDLTest_AssertCheck(stream != NULL, "Verify stream value; expected: != NULL, got: %p", stream);
                     if (stream == NULL) {
                         SDLTest_LogError("%s", SDL_GetError());
                     } else {

+ 2 - 2
test/testautomation_events.c

@@ -91,8 +91,8 @@ static int SDLCALL events_pushPumpAndPollUserevent(void *arg)
     SDLTest_AssertCheck(SDL_EVENT_USER == event_out.type, "Check event type is SDL_EVENT_USER, expected: 0x%x, got: 0x%" SDL_PRIx32, SDL_EVENT_USER, event_out.type);
     SDLTest_AssertCheck(ref_code == event_out.user.code, "Check SDL_Event.user.code, expected: 0x%" SDL_PRIx32 ", got: 0x%" SDL_PRIx32 , ref_code, event_out.user.code);
     SDLTest_AssertCheck(0 == event_out.user.windowID, "Check SDL_Event.user.windowID, expected: NULL , got: %" SDL_PRIu32, event_out.user.windowID);
-    SDLTest_AssertCheck((void *)&g_userdataValue1 == event_out.user.data1, "Check SDL_Event.user.data1, expected: %p, got: %p", (void *)&g_userdataValue1, event_out.user.data1);
-    SDLTest_AssertCheck((void *)&g_userdataValue2 == event_out.user.data2, "Check SDL_Event.user.data2, expected: %p, got: %p", (void *)&g_userdataValue2, event_out.user.data2);
+    SDLTest_AssertCheck((void *)&g_userdataValue1 == event_out.user.data1, "Check SDL_Event.user.data1, expected: %p, got: %p", &g_userdataValue1, event_out.user.data1);
+    SDLTest_AssertCheck((void *)&g_userdataValue2 == event_out.user.data2, "Check SDL_Event.user.data2, expected: %p, got: %p", &g_userdataValue2, event_out.user.data2);
     event_window = SDL_GetWindowFromEvent(&event_out);
     SDLTest_AssertCheck(NULL == SDL_GetWindowFromEvent(&event_out), "Check SDL_GetWindowFromEvent returns the window id from a user event, expected: NULL, got: %p", event_window);
 

+ 1 - 1
test/testcamera.c

@@ -285,7 +285,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
 
     #if 0
     if (frame_next) {
-        SDL_Log("frame: %p  at %" SDL_PRIu64, (void*)frame_next->pixels, timestampNS);
+        SDL_Log("frame: %p  at %" SDL_PRIu64, frame_next->pixels, timestampNS);
     }
     #endif