SDL: tests: several -Wwrite-strings fixes.

From 990fb668f71fb51dc1c698083bb0fd006b77189f Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 20 Nov 2021 01:02:02 +0300
Subject: [PATCH] tests: several -Wwrite-strings fixes.

---
 include/SDL_test_harness.h     |  6 ++--
 src/test/SDL_test_harness.c    |  2 +-
 test/checkkeys.c               |  5 ++--
 test/checkkeysthreads.c        |  5 ++--
 test/testatomic.c              | 10 +++----
 test/testautomation_audio.c    | 20 ++++++-------
 test/testautomation_hints.c    | 54 +++++++++++++++++-----------------
 test/testautomation_keyboard.c | 18 ++++++------
 test/testautomation_pixels.c   | 16 +++++-----
 test/testiconv.c               | 10 +++----
 test/testmultiaudio.c          |  8 ++---
 test/testnative.c              |  2 +-
 test/testpower.c               |  4 +--
 test/testrendertarget.c        |  2 +-
 test/testscale.c               |  2 +-
 test/testspriteminimal.c       |  2 +-
 test/testviewport.c            |  2 +-
 17 files changed, 84 insertions(+), 84 deletions(-)

diff --git a/include/SDL_test_harness.h b/include/SDL_test_harness.h
index 106464cf5a..3353fb72a3 100644
--- a/include/SDL_test_harness.h
+++ b/include/SDL_test_harness.h
@@ -76,9 +76,9 @@ typedef struct SDLTest_TestCaseReference {
     /* !< Func2Stress */
     SDLTest_TestCaseFp testCase;
     /* !< Short name (or function name) "Func2Stress" */
-    char *name;
+    const char *name;
     /* !< Long name or full description "This test pushes func2() to the limit." */
-    char *description;
+    const char *description;
     /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
     int enabled;
 } SDLTest_TestCaseReference;
@@ -88,7 +88,7 @@ typedef struct SDLTest_TestCaseReference {
  */
 typedef struct SDLTest_TestSuiteReference {
     /* !< "PlatformSuite" */
-    char *name;
+    const char *name;
     /* !< The function that is run before each test. NULL skips. */
     SDLTest_TestCaseSetUpFp testSetUp;
     /* !< The test cases that are run as part of the suite. Last item should be NULL. */
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index 7a1d261956..978bea4896 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -98,7 +98,7 @@ SDLTest_GenerateRunSeed(const int length)
 *
 */
 static Uint64
-SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, int iteration)
+SDLTest_GenerateExecKey(const char *runSeed, const char *suiteName, const char *testName, int iteration)
 {
     SDLTest_Md5Context md5Context;
     Uint64 *keys;
diff --git a/test/checkkeys.c b/test/checkkeys.c
index f2ddc7f0eb..8188db8299 100644
--- a/test/checkkeys.c
+++ b/test/checkkeys.c
@@ -137,9 +137,10 @@ PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat)
 }
 
 static void
-PrintText(char *eventtype, char *text)
+PrintText(const char *eventtype, const char *text)
 {
-    char *spot, expanded[1024];
+    const char *spot;
+    char expanded[1024];
 
     expanded[0] = '\0';
     for ( spot = text; *spot; ++spot )
diff --git a/test/checkkeysthreads.c b/test/checkkeysthreads.c
index f9de1d8027..e636b71820 100644
--- a/test/checkkeysthreads.c
+++ b/test/checkkeysthreads.c
@@ -138,9 +138,10 @@ PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat)
 }
 
 static void
-PrintText(char *eventtype, char *text)
+PrintText(const char *eventtype, const char *text)
 {
-    char *spot, expanded[1024];
+    const char *spot;
+    char expanded[1024];
 
     expanded[0] = '\0';
     for ( spot = text; *spot; ++spot )
diff --git a/test/testatomic.c b/test/testatomic.c
index ba04967b26..cc5e249418 100644
--- a/test/testatomic.c
+++ b/test/testatomic.c
@@ -19,13 +19,13 @@
 */
 
 static
-char *
-tf(SDL_bool tf)
+const char *
+tf(SDL_bool _tf)
 {
-    static char *t = "TRUE";
-    static char *f = "FALSE";
+    static const char *t = "TRUE";
+    static const char *f = "FALSE";
 
-    if (tf)
+    if (_tf)
     {
        return t;
     }
diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c
index be0f15e3dd..96c174f5c2 100644
--- a/test/testautomation_audio.c
+++ b/test/testautomation_audio.c
@@ -498,7 +498,7 @@ const int _numAudioFormats = 18;
 SDL_AudioFormat _audioFormats[] = { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S16SYS, AUDIO_S16, AUDIO_U16LSB,
                 AUDIO_U16MSB, AUDIO_U16SYS, AUDIO_U16, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S32SYS, AUDIO_S32,
                                 AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_F32SYS, AUDIO_F32 };
-char *_audioFormatsVerbose[] = { "AUDIO_S8", "AUDIO_U8", "AUDIO_S16LSB", "AUDIO_S16MSB", "AUDIO_S16SYS", "AUDIO_S16", "AUDIO_U16LSB",
+const char *_audioFormatsVerbose[] = { "AUDIO_S8", "AUDIO_U8", "AUDIO_S16LSB", "AUDIO_S16MSB", "AUDIO_S16SYS", "AUDIO_S16", "AUDIO_U16LSB",
                 "AUDIO_U16MSB", "AUDIO_U16SYS", "AUDIO_U16", "AUDIO_S32LSB", "AUDIO_S32MSB", "AUDIO_S32SYS", "AUDIO_S32",
                                 "AUDIO_F32LSB", "AUDIO_F32MSB", "AUDIO_F32SYS", "AUDIO_F32" };
 const int _numAudioChannels = 4;
@@ -697,7 +697,7 @@ int audio_openCloseAndGetAudioStatus()
    SDL_AudioStatus result;
    int i;
    int count;
-   char *device;
+   const char *device;
    SDL_AudioDeviceID id;
    SDL_AudioSpec desired, obtained;
 
@@ -707,7 +707,7 @@ int audio_openCloseAndGetAudioStatus()
    if (count > 0) {
      for (i = 0; i < count; i++) {
        /* Get device name */
-       device = (char *)SDL_GetAudioDeviceName(i, 0);
+       device = SDL_GetAudioDeviceName(i, 0);
        SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
        SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
        if (device == NULL) return TEST_ABORTED;
@@ -721,7 +721,7 @@ int audio_openCloseAndGetAudioStatus()
        desired.userdata=NULL;
 
        /* Open device */
-       id = SDL_OpenAudioDevice((const char *)device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
+       id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
        SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
        SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %i", id);
        if (id > 1) {
@@ -755,7 +755,7 @@ int audio_lockUnlockOpenAudioDevice()
 {
    int i;
    int count;
-   char *device;
+   const char *device;
    SDL_AudioDeviceID id;
    SDL_AudioSpec desired, obtained;
 
@@ -765,7 +765,7 @@ int audio_lockUnlockOpenAudioDevice()
    if (count > 0) {
      for (i = 0; i < count; i++) {
        /* Get device name */
-       device = (char *)SDL_GetAudioDeviceName(i, 0);
+       device = SDL_GetAudioDeviceName(i, 0);
        SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
        SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
        if (device == NULL) return TEST_ABORTED;
@@ -779,7 +779,7 @@ int audio_lockUnlockOpenAudioDevice()
        desired.userdata=NULL;
 
        /* Open device */
-       id = SDL_OpenAudioDevice((const char *)device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
+       id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
        SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
        SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >=2, got: %i", id);
        if (id > 1) {
@@ -917,7 +917,7 @@ int audio_openCloseAudioDeviceConnected()
    int result = -1;
    int i;
    int count;
-   char *device;
+   const char *device;
    SDL_AudioDeviceID id;
    SDL_AudioSpec desired, obtained;
 
@@ -927,7 +927,7 @@ int audio_openCloseAudioDeviceConnected()
    if (count > 0) {
      for (i = 0; i < count; i++) {
        /* Get device name */
-       device = (char *)SDL_GetAudioDeviceName(i, 0);
+       device = SDL_GetAudioDeviceName(i, 0);
        SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
        SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
        if (device == NULL) return TEST_ABORTED;
@@ -941,7 +941,7 @@ int audio_openCloseAudioDeviceConnected()
        desired.userdata=NULL;
 
        /* Open device */
-       id = SDL_OpenAudioDevice((const char *)device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
+       id = SDL_OpenAudioDevice(device, 0, &desired, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
        SDLTest_AssertPass("SDL_OpenAudioDevice('%s',...)", device);
        SDLTest_AssertCheck(id > 1, "Validate device ID; expected: >1, got: %i", id);
        if (id > 1) {
diff --git a/test/testautomation_hints.c b/test/testautomation_hints.c
index 2c491100d9..0d1b7b6f54 100644
--- a/test/testautomation_hints.c
+++ b/test/testautomation_hints.c
@@ -9,7 +9,7 @@
 
 
 const int _numHintsEnum = 25;
-char* _HintsEnum[] =
+const char* _HintsEnum[] =
   {
     SDL_HINT_ACCELEROMETER_AS_JOYSTICK,
     SDL_HINT_FRAMEBUFFER_ACCELERATION,
@@ -37,7 +37,7 @@ char* _HintsEnum[] =
     SDL_HINT_VIDEO_X11_XVIDMODE,
     SDL_HINT_XINPUT_ENABLED,
   };
-char* _HintsVerbose[] =
+const char* _HintsVerbose[] =
   {
     "SDL_ACCELEROMETER_AS_JOYSTICK",
     "SDL_FRAMEBUFFER_ACCELERATION",
@@ -75,14 +75,14 @@ char* _HintsVerbose[] =
 int
 hints_getHint(void *arg)
 {
-  char *result1;
-  char *result2;
+  const char *result1;
+  const char *result2;
   int i;
-    
+
   for (i=0; i<_numHintsEnum; i++) {
-    result1 = (char *)SDL_GetHint((char*)_HintsEnum[i]);
+    result1 = SDL_GetHint(_HintsEnum[i]);
     SDLTest_AssertPass("Call to SDL_GetHint(%s) - using define definition", (char*)_HintsEnum[i]);
-    result2 = (char *)SDL_GetHint((char *)_HintsVerbose[i]);
+    result2 = SDL_GetHint(_HintsVerbose[i]);
     SDLTest_AssertPass("Call to SDL_GetHint(%s) - using string definition", (char*)_HintsVerbose[i]);
     SDLTest_AssertCheck(
       (result1 == NULL && result2 == NULL) || (SDL_strcmp(result1, result2) == 0),
@@ -90,7 +90,7 @@ hints_getHint(void *arg)
       (result1 == NULL) ? "null" : result1,
       (result2 == NULL) ? "null" : result2);
   }
-  
+
   return TEST_COMPLETED;
 }
 
@@ -100,52 +100,52 @@ hints_getHint(void *arg)
 int
 hints_setHint(void *arg)
 {
-  char *originalValue;
-  char *value;
-  char *testValue;
+  const char *originalValue;
+  const char *value;
+  const char *testValue;
   SDL_bool result;
   int i, j;
 
-  /* Create random values to set */                    
+  /* Create random values to set */
   value = SDLTest_RandomAsciiStringOfSize(10);
-    
+
   for (i=0; i<_numHintsEnum; i++) {
     /* Capture current value */
-    originalValue = (char *)SDL_GetHint((char*)_HintsEnum[i]);
-    SDLTest_AssertPass("Call to SDL_GetHint(%s)", (char*)_HintsEnum[i]);
+    originalValue = SDL_GetHint(_HintsEnum[i]);
+    SDLTest_AssertPass("Call to SDL_GetHint(%s)", _HintsEnum[i]);
 
     /* Copy the original value, since it will be freed when we set it again */
     originalValue = originalValue ? SDL_strdup(originalValue) : NULL;
-    
+
     /* Set value (twice) */
     for (j=1; j<=2; j++) {
-      result = SDL_SetHint((char*)_HintsEnum[i], value);
-      SDLTest_AssertPass("Call to SDL_SetHint(%s, %s) (iteration %i)", (char*)_HintsEnum[i], value, j);
+      result = SDL_SetHint(_HintsEnum[i], value);
+      SDLTest_AssertPass("Call to SDL_SetHint(%s, %s) (iteration %i)", _HintsEnum[i], value, j);
       SDLTest_AssertCheck(
         result == SDL_TRUE || result == SDL_FALSE, 
         "Verify valid result was returned, got: %i",
         (int)result);
-      testValue = (char *)SDL_GetHint((char*)_HintsEnum[i]);
-      SDLTest_AssertPass("Call to SDL_GetHint(%s) - using string definition", (char*)_HintsVerbose[i]);
+      testValue = SDL_GetHint(_HintsEnum[i]);
+      SDLTest_AssertPass("Call to SDL_GetHint(%s) - using string definition", _HintsVerbose[i]);
       SDLTest_AssertCheck(
         (SDL_strcmp(value, testValue) == 0),
         "Verify returned value equals set value; got: testValue='%s' value='%s",
         (testValue == NULL) ? "null" : testValue,
         value);
     }
-      
+
     /* Reset original value */
-    result = SDL_SetHint((char*)_HintsEnum[i], originalValue);
-    SDLTest_AssertPass("Call to SDL_SetHint(%s, originalValue)", (char*)_HintsEnum[i]);
+    result = SDL_SetHint(_HintsEnum[i], originalValue);
+    SDLTest_AssertPass("Call to SDL_SetHint(%s, originalValue)", _HintsEnum[i]);
     SDLTest_AssertCheck(
       result == SDL_TRUE || result == SDL_FALSE, 
       "Verify valid result was returned, got: %i",
       (int)result);
-    SDL_free(originalValue);
+    SDL_free((void *)originalValue);
   }
-  
-  SDL_free(value);
-  
+
+  SDL_free((void *)value);
+
   return TEST_COMPLETED;
 }
 
diff --git a/test/testautomation_keyboard.c b/test/testautomation_keyboard.c
index f415da478a..84a763589d 100644
--- a/test/testautomation_keyboard.c
+++ b/test/testautomation_keyboard.c
@@ -168,8 +168,8 @@ keyboard_getKeyFromScancode(void *arg)
 int
 keyboard_getKeyName(void *arg)
 {
-   char *result;
-   char *expected;
+   const char *result;
+   const char *expected;
 
    /* Case where key has a 1 character name */
    expected = "3";
@@ -225,8 +225,8 @@ int
 keyboard_getScancodeNameNegative(void *arg)
 {
    SDL_Scancode scancode;
-   char *result;
-   char *expected = "";
+   const char *result;
+   const char *expected = "";
 
    /* Clear error message */
    SDL_ClearError();
@@ -252,8 +252,8 @@ int
 keyboard_getKeyNameNegative(void *arg)
 {
    SDL_Keycode keycode;
-   char *result;
-   char *expected = "";
+   const char *result;
+   const char *expected = "";
 
    /* Unknown keycode */
    keycode = SDLK_UNKNOWN;
@@ -612,7 +612,7 @@ _checkInvalidNameError()
 int
 keyboard_getScancodeFromNameNegative(void *arg)
 {
-   char *name;
+   const char *name;
    SDL_Scancode scancode;
 
    /* Clear error message */
@@ -625,9 +625,9 @@ keyboard_getScancodeFromNameNegative(void *arg)
    if (name == NULL) {
       return TEST_ABORTED;
    }
-   scancode = SDL_GetScancodeFromName((const char *)name);
+   scancode = SDL_GetScancodeFromName(name);
    SDLTest_AssertPass("Call to SDL_GetScancodeFromName('%s')", name);
-   SDL_free(name);
+   SDL_free((void *)name);
    SDLTest_AssertCheck(scancode == SDL_SCANCODE_UNKNOWN, "Validate return value from SDL_GetScancodeFromName, expected: %i, got: %i", SDL_SCANCODE_UNKNOWN, scancode);
    _checkInvalidNameError();
 
diff --git a/test/testautomation_pixels.c b/test/testautomation_pixels.c
index 2ff2d8705b..0f6870c9a5 100644
--- a/test/testautomation_pixels.c
+++ b/test/testautomation_pixels.c
@@ -45,7 +45,7 @@ Uint32 _RGBPixelFormats[] =
     SDL_PIXELFORMAT_BGRA8888,
     SDL_PIXELFORMAT_ARGB2101010
   };
-char* _RGBPixelFormatsVerbose[] =
+const char* _RGBPixelFormatsVerbose[] =
   {
     "SDL_PIXELFORMAT_INDEX1LSB",
     "SDL_PIXELFORMAT_INDEX1MSB",
@@ -92,7 +92,7 @@ Uint32 _nonRGBPixelFormats[] =
     SDL_PIXELFORMAT_NV12,
     SDL_PIXELFORMAT_NV21
   };
-char* _nonRGBPixelFormatsVerbose[] =
+const char* _nonRGBPixelFormatsVerbose[] =
   {
     "SDL_PIXELFORMAT_YV12",
     "SDL_PIXELFORMAT_IYUV",
@@ -110,7 +110,7 @@ Uint32 _invalidPixelFormats[] =
     0xfffffffe,
     0xffffffff
   };
-char* _invalidPixelFormatsVerbose[] =
+const char* _invalidPixelFormatsVerbose[] =
   {
     "SDL_PIXELFORMAT_UNKNOWN",
     "SDL_PIXELFORMAT_UNKNOWN"
@@ -237,14 +237,14 @@ pixels_getPixelFormatName(void *arg)
   const char *error;
   int i;
   Uint32 format;
-  char* result;
+  const char *result;
 
   /* Blank/undefined format */
   format = 0;
   SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format);
 
   /* Get name of format */
-  result = (char *)SDL_GetPixelFormatName(format);
+  result = SDL_GetPixelFormatName(format);
   SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   if (result != NULL) {
@@ -259,7 +259,7 @@ pixels_getPixelFormatName(void *arg)
     SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format);
 
     /* Get name of format */
-    result = (char *)SDL_GetPixelFormatName(format);
+    result = SDL_GetPixelFormatName(format);
     SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
     if (result != NULL) {
@@ -275,7 +275,7 @@ pixels_getPixelFormatName(void *arg)
     SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format);
 
     /* Get name of format */
-    result = (char *)SDL_GetPixelFormatName(format);
+    result = SDL_GetPixelFormatName(format);
     SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
     if (result != NULL) {
@@ -292,7 +292,7 @@ pixels_getPixelFormatName(void *arg)
   SDLTest_AssertPass("Call to SDL_ClearError()");
   for (i = 0; i < _numInvalidPixelFormats; i++) {
     format = _invalidPixelFormats[i];
-    result = (char *)SDL_GetPixelFormatName(format);
+    result = SDL_GetPixelFormatName(format);
     SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format);
     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
     if (result != NULL) {
diff --git a/test/testiconv.c b/test/testiconv.c
index 29c54e6509..c05fa418ab 100644
--- a/test/testiconv.c
+++ b/test/testiconv.c
@@ -42,6 +42,8 @@ main(int argc, char *argv[])
         "UCS4",
         "UCS-4",
     };
+
+    const char * fname;
     char buffer[BUFSIZ];
     char *ucs4;
     char *test[2];
@@ -52,12 +54,10 @@ main(int argc, char *argv[])
     /* Enable standard application logging */
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
-    if (!argv[1]) {
-        argv[1] = "utf8.txt";
-    }
-    file = fopen(argv[1], "rb");
+    fname = (argc < 2) ? "utf8.txt" : argv[1];
+    file = fopen(fname, "rb");
     if (!file) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", argv[1]);
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname);
         return (1);
     }
 
diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c
index b2b52326ed..130e4d1e36 100644
--- a/test/testmultiaudio.c
+++ b/test/testmultiaudio.c
@@ -180,13 +180,11 @@ main(int argc, char **argv)
     if (devcount < 1) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n");
     } else {
-        if (argv[1] == NULL) {
-            argv[1] = "sample.wav";
-        }
+        const char *file = (argc < 2) ? "sample.wav" : argv[1];
 
         /* Load the wave file into memory */
-        if (SDL_LoadWAV(argv[1], &spec, &sound, &soundlen) == NULL) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", argv[1],
+        if (SDL_LoadWAV(file, &spec, &sound, &soundlen) == NULL) {
+            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file,
                     SDL_GetError());
         } else {
             test_multi_audio(devcount);
diff --git a/test/testnative.c b/test/testnative.c
index 21aee04c16..ced04ab434 100644
--- a/test/testnative.c
+++ b/test/testnative.c
@@ -53,7 +53,7 @@ quit(int rc)
 }
 
 SDL_Texture *
-LoadSprite(SDL_Renderer *renderer, char *file)
+LoadSprite(SDL_Renderer *renderer, const char *file)
 {
     SDL_Surface *temp;
     SDL_Texture *sprite;
diff --git a/test/testpower.c b/test/testpower.c
index 2e36966528..7b41f43a78 100644
--- a/test/testpower.c
+++ b/test/testpower.c
@@ -19,7 +19,7 @@ report_power(void)
 {
     int seconds, percent;
     const SDL_PowerState state = SDL_GetPowerInfo(&seconds, &percent);
-    char *statestr = NULL;
+    const char *statestr = NULL;
 
     SDL_Log("SDL-reported power info...\n");
     switch (state) {
@@ -55,7 +55,7 @@ report_power(void)
         SDL_Log("Time left: unknown\n");
     } else {
         SDL_Log("Time left: %d minutes, %d seconds\n", (int) (seconds / 60),
-               (int) (seconds % 60));
+                (int) (seconds % 60));
     }
 }
 
diff --git a/test/testrendertarget.c b/test/testrendertarget.c
index 5366d50400..021e727b49 100644
--- a/test/testrendertarget.c
+++ b/test/testrendertarget.c
@@ -46,7 +46,7 @@ quit(int rc)
 }
 
 SDL_Texture *
-LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
+LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent)
 {
     SDL_Surface *temp;
     SDL_Texture *texture;
diff --git a/test/testscale.c b/test/testscale.c
index 5ce882d883..966b1693d9 100644
--- a/test/testscale.c
+++ b/test/testscale.c
@@ -47,7 +47,7 @@ quit(int rc)
 }
 
 SDL_Texture *
-LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
+LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent)
 {
     SDL_Surface *temp;
     SDL_Texture *texture;
diff --git a/test/testspriteminimal.c b/test/testspriteminimal.c
index 6d1024967b..23c8a59a6c 100644
--- a/test/testspriteminimal.c
+++ b/test/testspriteminimal.c
@@ -43,7 +43,7 @@ quit(int rc)
 }
 
 int
-LoadSprite(char *file)
+LoadSprite(const char *file)
 {
     SDL_Surface *temp;
 
diff --git a/test/testviewport.c b/test/testviewport.c
index 0c8f255415..775892b442 100644
--- a/test/testviewport.c
+++ b/test/testviewport.c
@@ -43,7 +43,7 @@ quit(int rc)
 }
 
 int
-LoadSprite(char *file, SDL_Renderer *renderer)
+LoadSprite(const char *file, SDL_Renderer *renderer)
 {
     SDL_Surface *temp;