From 8a355116d1a846274753ed3cf5506ac45bd28657 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Tue, 21 Dec 2021 20:01:02 +0300 Subject: [PATCH] silence -Wwrite-strings in visualtest --- visualtest/include/SDL_visualtest_action_configparser.h | 2 +- visualtest/src/action_configparser.c | 2 +- visualtest/src/harness_argparser.c | 4 ++-- visualtest/src/linux/linux_process.c | 6 +++--- visualtest/src/testharness.c | 6 +++--- visualtest/src/windows/windows_process.c | 2 +- visualtest/src/windows/windows_screenshot.c | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/visualtest/include/SDL_visualtest_action_configparser.h b/visualtest/include/SDL_visualtest_action_configparser.h index 490c8a359..40481f379 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 45803437d..f3b1afd73 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 b7f9d0d99..8bc57064b 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 d81a32eb7..b93f3407e 100644 --- a/visualtest/src/linux/linux_process.c +++ b/visualtest/src/linux/linux_process.c @@ -20,11 +20,11 @@ #include 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 e93b0958a..db3ca55b2 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 346d60582..e7e265c7c 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 c8fd1e441..6d9189dc4 100644 --- a/visualtest/src/windows/windows_screenshot.c +++ b/visualtest/src/windows/windows_screenshot.c @@ -16,7 +16,7 @@ #if defined(__WIN32__) #include -void LogLastError(char* str); +void LogLastError(const char* str); static int img_num; static SDL_ProcessInfo screenshot_pinfo;