silence -Wwrite-strings in visualtest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
diff --git a/visualtest/include/SDL_visualtest_action_configparser.h b/visualtest/include/SDL_visualtest_action_configparser.h
index 490c8a3..40481f3 100644
--- a/visualtest/include/SDL_visualtest_action_configparser.h
+++ b/visualtest/include/SDL_visualtest_action_configparser.h
@@ -137,7 +137,7 @@ int SDLVisualTest_InsertIntoActionQueue(SDLVisualTest_ActionQueue* queue,
*
* \return 1 on success, 0 on failure.
*/
-int SDLVisualTest_ParseActionConfig(char* file, SDLVisualTest_ActionQueue* queue);
+int SDLVisualTest_ParseActionConfig(const char* file, SDLVisualTest_ActionQueue* queue);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/visualtest/src/action_configparser.c b/visualtest/src/action_configparser.c
index 4580343..f3b1afd 100644
--- a/visualtest/src/action_configparser.c
+++ b/visualtest/src/action_configparser.c
@@ -259,7 +259,7 @@ SDLVisualTest_InsertIntoActionQueue(SDLVisualTest_ActionQueue* queue,
}
int
-SDLVisualTest_ParseActionConfig(char* file, SDLVisualTest_ActionQueue* queue)
+SDLVisualTest_ParseActionConfig(const char* file, SDLVisualTest_ActionQueue* queue)
{
char line[MAX_ACTION_LINE_LENGTH];
SDLVisualTest_RWHelperBuffer buffer;
diff --git a/visualtest/src/harness_argparser.c b/visualtest/src/harness_argparser.c
index b7f9d0d..8bc5706 100644
--- a/visualtest/src/harness_argparser.c
+++ b/visualtest/src/harness_argparser.c
@@ -19,7 +19,7 @@
/* String compare s1 and s2 ignoring leading hyphens */
static int
-StrCaseCmpIgnoreHyphen(char* s1, char* s2)
+StrCaseCmpIgnoreHyphen(const char* s1, const char* s2)
{
/* treat NULL pointer as empty strings */
if(!s1)
@@ -199,7 +199,7 @@ ParseArg(char** argv, int index, SDLVisualTest_HarnessState* state)
/* TODO: Trailing/leading spaces and spaces between equals sign not supported. */
static int
-ParseConfig(char* file, SDLVisualTest_HarnessState* state)
+ParseConfig(const char* file, SDLVisualTest_HarnessState* state)
{
SDL_RWops* rw;
SDLVisualTest_RWHelperBuffer buffer;
diff --git a/visualtest/src/linux/linux_process.c b/visualtest/src/linux/linux_process.c
index d81a32e..b93f340 100644
--- a/visualtest/src/linux/linux_process.c
+++ b/visualtest/src/linux/linux_process.c
@@ -20,11 +20,11 @@
#include <errno.h>
static void
-LogLastError(char* str)
+LogLastError(const char* str)
{
- char* error = (char*)strerror(errno);
+ const char* error = strerror(errno);
if(!str || !error)
- return;
+ return;
SDLTest_LogError("%s: %s", str, error);
}
diff --git a/visualtest/src/testharness.c b/visualtest/src/testharness.c
index e93b095..db3ca55 100644
--- a/visualtest/src/testharness.c
+++ b/visualtest/src/testharness.c
@@ -49,8 +49,8 @@ static SDLVisualTest_ActionNode* current; /* the current action being performed
static SDL_TimerID action_timer, kill_timer;
/* returns a char* to be passed as the format argument of a printf-style function. */
-static char*
-usage()
+static const char*
+usage(void)
{
return "Usage: \n%s --sutapp xyz"
" [--sutargs abc | --parameter-config xyz.parameters"
@@ -462,7 +462,7 @@ main(int argc, char* argv[])
if(state.sut_config.num_options > 0)
{
- char* variator_name = state.variator_type == SDL_VARIATOR_RANDOM ?
+ const char* variator_name = (state.variator_type == SDL_VARIATOR_RANDOM) ?
"RANDOM" : "EXHAUSTIVE";
if(state.num_variations > 0)
SDLTest_Log("Testing SUT with variator: %s for %d variations",
diff --git a/visualtest/src/windows/windows_process.c b/visualtest/src/windows/windows_process.c
index 346d605..e7e265c 100644
--- a/visualtest/src/windows/windows_process.c
+++ b/visualtest/src/windows/windows_process.c
@@ -15,7 +15,7 @@
#if defined(__WIN32__)
void
-LogLastError(char* str)
+LogLastError(const char* str)
{
LPVOID buffer;
DWORD dw = GetLastError();
diff --git a/visualtest/src/windows/windows_screenshot.c b/visualtest/src/windows/windows_screenshot.c
index c8fd1e4..6d9189d 100644
--- a/visualtest/src/windows/windows_screenshot.c
+++ b/visualtest/src/windows/windows_screenshot.c
@@ -16,7 +16,7 @@
#if defined(__WIN32__)
#include <windows.h>
-void LogLastError(char* str);
+void LogLastError(const char* str);
static int img_num;
static SDL_ProcessInfo screenshot_pinfo;