From 93fb29c19b1504f3239a65f034161309cc39f78a Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 1 Mar 2018 20:05:37 +0200 Subject: [PATCH 01/47] Make I_Error format string parameter const --- src/i_system.c | 2 +- src/i_system.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_system.c b/src/i_system.c index ad60dc46..60a6f64c 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -260,7 +260,7 @@ void I_Quit (void) static boolean already_quitting = false; -void I_Error (char *error, ...) +void I_Error (const char *error, ...) { char msgbuf[512]; va_list argptr; diff --git a/src/i_system.h b/src/i_system.h index 1b023d17..141d03f1 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -52,7 +52,7 @@ ticcmd_t* I_BaseTiccmd (void); // Clean exit, displays sell blurb. void I_Quit (void); -void I_Error (char *error, ...) PRINTF_ATTR(1, 2); +void I_Error (const char *error, ...) PRINTF_ATTR(1, 2); void I_Tactile (int on, int off, int total); From a580241955255e0e95db02f17d62e65c0bca7033 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 1 Mar 2018 20:10:38 +0200 Subject: [PATCH 02/47] Make I_PrintBanner parameter const --- src/i_system.c | 2 +- src/i_system.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_system.c b/src/i_system.c index 60a6f64c..4bf8b98b 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -157,7 +157,7 @@ byte *I_ZoneBase (int *size) return zonemem; } -void I_PrintBanner(char *msg) +void I_PrintBanner(const char *msg) { int i; int spaces = 35 - (strlen(msg) / 2); diff --git a/src/i_system.h b/src/i_system.h index 141d03f1..022d6610 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -76,7 +76,7 @@ void I_PrintStartupBanner(char *gamedescription); // Print a centered text banner displaying the given string. -void I_PrintBanner(char *text); +void I_PrintBanner(const char *text); // Print a dividing line for startup banners. From fc6d7daf3a31c73a223724df94fa57578f52b0af Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 1 Mar 2018 20:15:22 +0200 Subject: [PATCH 03/47] Make I_PrintStartupBanner parameter const --- src/i_system.c | 2 +- src/i_system.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_system.c b/src/i_system.c index 4bf8b98b..e8c3c3cf 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -180,7 +180,7 @@ void I_PrintDivider(void) putchar('\n'); } -void I_PrintStartupBanner(char *gamedescription) +void I_PrintStartupBanner(const char *gamedescription) { I_PrintDivider(); I_PrintBanner(gamedescription); diff --git a/src/i_system.h b/src/i_system.h index 022d6610..f87d92f6 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -72,7 +72,7 @@ void I_BindVariables(void); // Print startup banner copyright message. -void I_PrintStartupBanner(char *gamedescription); +void I_PrintStartupBanner(const char *gamedescription); // Print a centered text banner displaying the given string. From 6e76f031a17f4067a89d00657659c27b2741616d Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 1 Mar 2018 20:30:51 +0200 Subject: [PATCH 04/47] dehacked: Make NextFormatArgument and ValidFormatReplacement parameters const --- src/deh_str.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/deh_str.c b/src/deh_str.c index 1422b759..8eb82b55 100644 --- a/src/deh_str.c +++ b/src/deh_str.c @@ -251,7 +251,7 @@ static format_arg_t FormatArgumentType(char c) // Given the specified string, get the type of the first format // string encountered. -static format_arg_t NextFormatArgument(char **str) +static format_arg_t NextFormatArgument(const char **str) { format_arg_t argtype; @@ -326,10 +326,10 @@ static boolean ValidArgumentReplacement(format_arg_t original, // Return true if the specified string contains no format arguments. -static boolean ValidFormatReplacement(char *original, char *replacement) +static boolean ValidFormatReplacement(const char *original, const char *replacement) { - char *rover1; - char *rover2; + const char *rover1; + const char *rover2; int argtype1, argtype2; // Check each argument in turn and compare types. From 4f1a13f96544292b496416ee7dd993623209ed54 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 1 Mar 2018 20:33:35 +0200 Subject: [PATCH 05/47] dehacked: Make strhash parameter const --- src/deh_str.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/deh_str.c b/src/deh_str.c index 8eb82b55..036abf06 100644 --- a/src/deh_str.c +++ b/src/deh_str.c @@ -38,9 +38,9 @@ static int hash_table_length = -1; // This is the algorithm used by glib -static unsigned int strhash(char *s) +static unsigned int strhash(const char *s) { - char *p = s; + const char *p = s; unsigned int h = *p; if (h) From 398412c156993464a6824e278c34d5a7ccd80387 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 1 Mar 2018 20:35:14 +0200 Subject: [PATCH 06/47] dehacked: Make SubstitutionForString parameter const --- src/deh_str.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deh_str.c b/src/deh_str.c index 036abf06..b8f27ca1 100644 --- a/src/deh_str.c +++ b/src/deh_str.c @@ -52,7 +52,7 @@ static unsigned int strhash(const char *s) return h; } -static deh_substitution_t *SubstitutionForString(char *s) +static deh_substitution_t *SubstitutionForString(const char *s) { int entry; From 7ad49f8e9413f33a2518d0c6367038482ee7e2c8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 1 Mar 2018 21:10:14 +0200 Subject: [PATCH 07/47] doom: Make HUlib_addMessageToSText string parameters const --- src/doom/hu_lib.c | 4 ++-- src/doom/hu_lib.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doom/hu_lib.c b/src/doom/hu_lib.c index 850d7f95..6a42b04b 100644 --- a/src/doom/hu_lib.c +++ b/src/doom/hu_lib.c @@ -208,8 +208,8 @@ void HUlib_addLineToSText(hu_stext_t* s) void HUlib_addMessageToSText ( hu_stext_t* s, - char* prefix, - char* msg ) + const char* prefix, + const char* msg ) { HUlib_addLineToSText(s); if (prefix) diff --git a/src/doom/hu_lib.h b/src/doom/hu_lib.h index 8f0994e6..ca5eb8d8 100644 --- a/src/doom/hu_lib.h +++ b/src/doom/hu_lib.h @@ -134,8 +134,8 @@ void HUlib_addLineToSText(hu_stext_t* s); void HUlib_addMessageToSText ( hu_stext_t* s, - char* prefix, - char* msg ); + const char* prefix, + const char* msg ); // draws stext void HUlib_drawSText(hu_stext_t* s); From bad8774dc90d1284708c9ef8769005144508ba08 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Thu, 1 Mar 2018 21:29:10 +0200 Subject: [PATCH 08/47] Make DEH_AddStringReplacement parameters const --- src/deh_str.c | 2 +- src/deh_str.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/deh_str.c b/src/deh_str.c index b8f27ca1..b60f46a0 100644 --- a/src/deh_str.c +++ b/src/deh_str.c @@ -165,7 +165,7 @@ static void DEH_AddToHashtable(deh_substitution_t *sub) ++hash_table_entries; } -void DEH_AddStringReplacement(char *from_text, char *to_text) +void DEH_AddStringReplacement(const char *from_text, const char *to_text) { deh_substitution_t *sub; size_t len; diff --git a/src/deh_str.h b/src/deh_str.h index e69f5a03..22b66b2d 100644 --- a/src/deh_str.h +++ b/src/deh_str.h @@ -28,7 +28,7 @@ char *DEH_String(char *s) PRINTF_ARG_ATTR(1); void DEH_printf(char *fmt, ...) PRINTF_ATTR(1, 2); void DEH_fprintf(FILE *fstream, char *fmt, ...) PRINTF_ATTR(2, 3); void DEH_snprintf(char *buffer, size_t len, char *fmt, ...) PRINTF_ATTR(3, 4); -void DEH_AddStringReplacement(char *from_text, char *to_text); +void DEH_AddStringReplacement(const char *from_text, const char *to_text); #if 0 From deefc1dd49cfefcd0d36331574523f49654bf0b8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 23:13:47 +0200 Subject: [PATCH 09/47] Make M_WriteFile name parameter const --- src/m_misc.c | 2 +- src/m_misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index e82fffd6..795b1248 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -178,7 +178,7 @@ long M_FileLength(FILE *handle) // M_WriteFile // -boolean M_WriteFile(char *name, void *source, int length) +boolean M_WriteFile(const char *name, void *source, int length) { FILE *handle; int count; diff --git a/src/m_misc.h b/src/m_misc.h index 0225b827..62a94620 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -25,7 +25,7 @@ #include "doomtype.h" -boolean M_WriteFile(char *name, void *source, int length); +boolean M_WriteFile(const char *name, void *source, int length); int M_ReadFile(char *name, byte **buffer); void M_MakeDirectory(char *dir); char *M_TempFile(char *s); From 5508740367ca91d4f266803d70d9b8fbe86f5cba Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 23:21:01 +0200 Subject: [PATCH 10/47] Make M_ReadFile name parameter const --- src/m_misc.c | 2 +- src/m_misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 795b1248..408bdb60 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -202,7 +202,7 @@ boolean M_WriteFile(const char *name, void *source, int length) // M_ReadFile // -int M_ReadFile(char *name, byte **buffer) +int M_ReadFile(const char *name, byte **buffer) { FILE *handle; int count, length; diff --git a/src/m_misc.h b/src/m_misc.h index 62a94620..a607cb81 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -26,7 +26,7 @@ #include "doomtype.h" boolean M_WriteFile(const char *name, void *source, int length); -int M_ReadFile(char *name, byte **buffer); +int M_ReadFile(const char *name, byte **buffer); void M_MakeDirectory(char *dir); char *M_TempFile(char *s); boolean M_FileExists(char *file); From 19bae1157cf0de3461b05d87c1bf2a25f376d51d Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 23:23:30 +0200 Subject: [PATCH 11/47] Make M_MakeDirectory parameter const --- src/m_misc.c | 2 +- src/m_misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 408bdb60..f1930a13 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -52,7 +52,7 @@ // Create a directory // -void M_MakeDirectory(char *path) +void M_MakeDirectory(const char *path) { #ifdef _WIN32 mkdir(path); diff --git a/src/m_misc.h b/src/m_misc.h index a607cb81..4c360414 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -27,7 +27,7 @@ boolean M_WriteFile(const char *name, void *source, int length); int M_ReadFile(const char *name, byte **buffer); -void M_MakeDirectory(char *dir); +void M_MakeDirectory(const char *dir); char *M_TempFile(char *s); boolean M_FileExists(char *file); char *M_FileCaseExists(char *file); From 2ac504e292204aac575e1e10cd66745ec06a7254 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 23:39:04 +0200 Subject: [PATCH 12/47] Make M_TempFile parameter const --- src/m_misc.c | 2 +- src/m_misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index f1930a13..2187e672 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -233,7 +233,7 @@ int M_ReadFile(const char *name, byte **buffer) // // The returned value must be freed with Z_Free after use. -char *M_TempFile(char *s) +char *M_TempFile(const char *s) { char *tempdir; diff --git a/src/m_misc.h b/src/m_misc.h index 4c360414..9d14b18b 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -28,7 +28,7 @@ boolean M_WriteFile(const char *name, void *source, int length); int M_ReadFile(const char *name, byte **buffer); void M_MakeDirectory(const char *dir); -char *M_TempFile(char *s); +char *M_TempFile(const char *s); boolean M_FileExists(char *file); char *M_FileCaseExists(char *file); long M_FileLength(FILE *handle); From 2efb4fb87b94345456bb2f7d19c3f5fe59316511 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 23:42:57 +0200 Subject: [PATCH 13/47] Make M_FileExists parameter const --- src/m_misc.c | 2 +- src/m_misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 2187e672..1be69be8 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -63,7 +63,7 @@ void M_MakeDirectory(const char *path) // Check if a file exists -boolean M_FileExists(char *filename) +boolean M_FileExists(const char *filename) { FILE *fstream; diff --git a/src/m_misc.h b/src/m_misc.h index 9d14b18b..316a871f 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -29,7 +29,7 @@ boolean M_WriteFile(const char *name, void *source, int length); int M_ReadFile(const char *name, byte **buffer); void M_MakeDirectory(const char *dir); char *M_TempFile(const char *s); -boolean M_FileExists(char *file); +boolean M_FileExists(const char *file); char *M_FileCaseExists(char *file); long M_FileLength(FILE *handle); boolean M_StrToInt(const char *str, int *result); From 95fef9ea786a52bfa07e94fdaae22c6d0e3f30c8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 23:48:35 +0200 Subject: [PATCH 14/47] Make M_FileCaseExists parameter const --- src/m_misc.c | 2 +- src/m_misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 1be69be8..c48d54d7 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -86,7 +86,7 @@ boolean M_FileExists(const char *filename) // Check if a file exists by probing for common case variation of its filename. // Returns a newly allocated string that the caller is responsible for freeing. -char *M_FileCaseExists(char *path) +char *M_FileCaseExists(const char *path) { char *path_dup, *filename, *ext; diff --git a/src/m_misc.h b/src/m_misc.h index 316a871f..803b7ad7 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -30,7 +30,7 @@ int M_ReadFile(const char *name, byte **buffer); void M_MakeDirectory(const char *dir); char *M_TempFile(const char *s); boolean M_FileExists(const char *file); -char *M_FileCaseExists(char *file); +char *M_FileCaseExists(const char *file); long M_FileLength(FILE *handle); boolean M_StrToInt(const char *str, int *result); void M_ExtractFileBase(char *path, char *dest); From 746f429371aa0d6e03a62d6c00e97ccbffd5acea Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 23:50:32 +0200 Subject: [PATCH 15/47] Make M_ExtractFileBase path parameter const --- src/m_misc.c | 6 +++--- src/m_misc.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index c48d54d7..d330532a 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -264,10 +264,10 @@ boolean M_StrToInt(const char *str, int *result) || sscanf(str, " %d", result) == 1; } -void M_ExtractFileBase(char *path, char *dest) +void M_ExtractFileBase(const char *path, char *dest) { - char *src; - char *filename; + const char *src; + const char *filename; int length; src = path + strlen(path) - 1; diff --git a/src/m_misc.h b/src/m_misc.h index 803b7ad7..71fe0032 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -33,7 +33,7 @@ boolean M_FileExists(const char *file); char *M_FileCaseExists(const char *file); long M_FileLength(FILE *handle); boolean M_StrToInt(const char *str, int *result); -void M_ExtractFileBase(char *path, char *dest); +void M_ExtractFileBase(const char *path, char *dest); void M_ForceUppercase(char *text); void M_ForceLowercase(char *text); char *M_StrCaseStr(char *haystack, char *needle); From 47091d24fbe24e4ccbb10df225e61316d9c229ea Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 23:57:56 +0200 Subject: [PATCH 16/47] Make M_StrCaseStr parameters and return value const --- src/m_misc.c | 2 +- src/m_misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index d330532a..3469ba86 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -343,7 +343,7 @@ void M_ForceLowercase(char *text) // Case-insensitive version of strstr() // -char *M_StrCaseStr(char *haystack, char *needle) +const char *M_StrCaseStr(const char *haystack, const char *needle) { unsigned int haystack_len; unsigned int needle_len; diff --git a/src/m_misc.h b/src/m_misc.h index 71fe0032..067995e1 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -36,7 +36,7 @@ boolean M_StrToInt(const char *str, int *result); void M_ExtractFileBase(const char *path, char *dest); void M_ForceUppercase(char *text); void M_ForceLowercase(char *text); -char *M_StrCaseStr(char *haystack, char *needle); +const char *M_StrCaseStr(const char *haystack, const char *needle); char *M_StringDuplicate(const char *orig); boolean M_StringCopy(char *dest, const char *src, size_t dest_size); boolean M_StringConcat(char *dest, const char *src, size_t dest_size); From 8ec41dca6cad8f47c439fd16f78bc35a54de53bc Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 2 Mar 2018 22:53:32 +0200 Subject: [PATCH 17/47] Make TXT_SetWindowTitle parameter const --- textscreen/txt_main.h | 2 +- textscreen/txt_sdl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_main.h b/textscreen/txt_main.h index 3cc78b30..3c98265c 100644 --- a/textscreen/txt_main.h +++ b/textscreen/txt_main.h @@ -180,7 +180,7 @@ void TXT_Sleep(int timeout); void TXT_SetInputMode(txt_input_mode_t mode); // Set the window title of the window containing the text mode screen -void TXT_SetWindowTitle(char *title); +void TXT_SetWindowTitle(const char *title); // Safe string copy. void TXT_StringCopy(char *dest, const char *src, size_t dest_len); diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index a0739042..7c8c193f 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -890,7 +890,7 @@ void TXT_SetInputMode(txt_input_mode_t mode) input_mode = mode; } -void TXT_SetWindowTitle(char *title) +void TXT_SetWindowTitle(const char *title) { SDL_SetWindowTitle(TXT_SDLWindow, title); } From 83d0f369df6d5582efad2c4a40454b114abe9a9e Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sat, 3 Mar 2018 00:09:33 +0200 Subject: [PATCH 18/47] Make TXT_SetDesktopTitle parameter const --- textscreen/txt_desktop.c | 2 +- textscreen/txt_desktop.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_desktop.c b/textscreen/txt_desktop.c index e56a5ee4..d8428294 100644 --- a/textscreen/txt_desktop.c +++ b/textscreen/txt_desktop.c @@ -220,7 +220,7 @@ static void DrawHelpIndicator(void) TXT_DrawString("=Help "); } -void TXT_SetDesktopTitle(char *title) +void TXT_SetDesktopTitle(const char *title) { free(desktop_title); desktop_title = strdup(title); diff --git a/textscreen/txt_desktop.h b/textscreen/txt_desktop.h index c8f5d543..8883c39d 100644 --- a/textscreen/txt_desktop.h +++ b/textscreen/txt_desktop.h @@ -39,7 +39,7 @@ int TXT_WindowKeyPress(txt_window_t *window, int c); * @param title The title to display (UTF-8 format). */ -void TXT_SetDesktopTitle(char *title); +void TXT_SetDesktopTitle(const char *title); /** * Exit the currently-running main loop and return from the From 54a38844f79ba18122e185ad4f8ad9108f703e78 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sat, 3 Mar 2018 00:11:30 +0200 Subject: [PATCH 19/47] textscreen: Make name member const in txt_font_t --- textscreen/txt_sdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index 7c8c193f..28211201 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -34,7 +34,7 @@ typedef struct { - char *name; + const char *name; const uint8_t *data; unsigned int w; unsigned int h; From fff3741c781c0faa0c80ed60b8957e74f7dd3d7f Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 18:33:51 +0200 Subject: [PATCH 20/47] textscreen: Make FontForName parameter const --- textscreen/txt_sdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index 28211201..d1764e8a 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -133,7 +133,7 @@ static int Win32_UseLargeFont(void) #endif -static const txt_font_t *FontForName(char *name) +static const txt_font_t *FontForName(const char *name) { int i; const txt_font_t *fonts[] = From 10d2130a2a82fed36d9d16ea4dc222f2fbbdb3c8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 18:35:56 +0200 Subject: [PATCH 21/47] textscreen: Make TranslateKeysym parameter const --- textscreen/txt_sdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index d1764e8a..de304c33 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -518,7 +518,7 @@ static int TranslateScancode(SDL_Scancode scancode) } } -static int TranslateKeysym(SDL_Keysym *sym) +static int TranslateKeysym(const SDL_Keysym *sym) { int translated; From 1758e8908027337097aacce0d150d30aa7c3a6b6 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 18:38:29 +0200 Subject: [PATCH 22/47] textscreen: Make SDLWheelToTXTButton parameter const --- textscreen/txt_sdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index de304c33..ac563b23 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -558,7 +558,7 @@ static int SDLButtonToTXTButton(int button) // Convert an SDL wheel motion to a textscreen button index. -static int SDLWheelToTXTButton(SDL_MouseWheelEvent *wheel) +static int SDLWheelToTXTButton(const SDL_MouseWheelEvent *wheel) { if (wheel->y <= 0) { From 44b80b2a7a1b2a4866267ca7d7bda11ae926a4bb Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 18:45:08 +0200 Subject: [PATCH 23/47] Make TXT_SetButtonLabel label parameter const --- textscreen/txt_button.c | 2 +- textscreen/txt_button.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_button.c b/textscreen/txt_button.c index 8865e1a4..688f3db3 100644 --- a/textscreen/txt_button.c +++ b/textscreen/txt_button.c @@ -93,7 +93,7 @@ txt_widget_class_t txt_button_class = NULL, }; -void TXT_SetButtonLabel(txt_button_t *button, char *label) +void TXT_SetButtonLabel(txt_button_t *button, const char *label) { free(button->label); button->label = strdup(label); diff --git a/textscreen/txt_button.h b/textscreen/txt_button.h index cde528f6..5350798d 100644 --- a/textscreen/txt_button.h +++ b/textscreen/txt_button.h @@ -67,7 +67,7 @@ txt_button_t *TXT_NewButton2(char *label, TxtWidgetSignalFunc func, * @param label The new label (UTF-8 format). */ -void TXT_SetButtonLabel(txt_button_t *button, char *label); +void TXT_SetButtonLabel(txt_button_t *button, const char *label); #endif /* #ifndef TXT_BUTTON_H */ From 4b48cd7f9d810955352cb03fab9cfa39f747c68b Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 18:54:45 +0200 Subject: [PATCH 24/47] Make TXT_NewButton parameter const --- textscreen/txt_button.c | 2 +- textscreen/txt_button.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_button.c b/textscreen/txt_button.c index 688f3db3..48fb782e 100644 --- a/textscreen/txt_button.c +++ b/textscreen/txt_button.c @@ -99,7 +99,7 @@ void TXT_SetButtonLabel(txt_button_t *button, const char *label) button->label = strdup(label); } -txt_button_t *TXT_NewButton(char *label) +txt_button_t *TXT_NewButton(const char *label) { txt_button_t *button; diff --git a/textscreen/txt_button.h b/textscreen/txt_button.h index 5350798d..ee411be7 100644 --- a/textscreen/txt_button.h +++ b/textscreen/txt_button.h @@ -45,7 +45,7 @@ struct txt_button_s * @return Pointer to the new button widget. */ -txt_button_t *TXT_NewButton(char *label); +txt_button_t *TXT_NewButton(const char *label); /** * Create a new button widget, binding the "pressed" signal to a From 898442b1015f2300751eb465d4d0eb577aa2a633 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 18:58:26 +0200 Subject: [PATCH 25/47] Make TXT_NewButton2 label parameter const --- textscreen/txt_button.c | 2 +- textscreen/txt_button.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_button.c b/textscreen/txt_button.c index 48fb782e..aaf711d7 100644 --- a/textscreen/txt_button.c +++ b/textscreen/txt_button.c @@ -113,7 +113,7 @@ txt_button_t *TXT_NewButton(const char *label) // Button with a callback set automatically -txt_button_t *TXT_NewButton2(char *label, TxtWidgetSignalFunc func, +txt_button_t *TXT_NewButton2(const char *label, TxtWidgetSignalFunc func, void *user_data) { txt_button_t *button; diff --git a/textscreen/txt_button.h b/textscreen/txt_button.h index ee411be7..e0455441 100644 --- a/textscreen/txt_button.h +++ b/textscreen/txt_button.h @@ -57,7 +57,7 @@ txt_button_t *TXT_NewButton(const char *label); * @return Pointer to the new button widget. */ -txt_button_t *TXT_NewButton2(char *label, TxtWidgetSignalFunc func, +txt_button_t *TXT_NewButton2(const char *label, TxtWidgetSignalFunc func, void *user_data); /** From 27a28b8ad9a594fd395ba9c7437752098cdee75d Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 19:14:45 +0200 Subject: [PATCH 26/47] Make TXT_NewCheckBox label parameter const --- textscreen/txt_checkbox.c | 2 +- textscreen/txt_checkbox.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_checkbox.c b/textscreen/txt_checkbox.c index 8610c719..49f66f43 100644 --- a/textscreen/txt_checkbox.c +++ b/textscreen/txt_checkbox.c @@ -116,7 +116,7 @@ txt_widget_class_t txt_checkbox_class = NULL, }; -txt_checkbox_t *TXT_NewCheckBox(char *label, int *variable) +txt_checkbox_t *TXT_NewCheckBox(const char *label, int *variable) { txt_checkbox_t *checkbox; diff --git a/textscreen/txt_checkbox.h b/textscreen/txt_checkbox.h index 08f37d44..91e7d61c 100644 --- a/textscreen/txt_checkbox.h +++ b/textscreen/txt_checkbox.h @@ -55,7 +55,7 @@ struct txt_checkbox_s * @return Pointer to the new checkbox. */ -txt_checkbox_t *TXT_NewCheckBox(char *label, int *variable); +txt_checkbox_t *TXT_NewCheckBox(const char *label, int *variable); /** * Create a new inverted checkbox. From 5f82ebd75bc5dc6af2ea7325217b002feccef817 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 19:22:26 +0200 Subject: [PATCH 27/47] Make TXT_NewInvertedCheckBox label parameter const --- textscreen/txt_checkbox.c | 2 +- textscreen/txt_checkbox.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_checkbox.c b/textscreen/txt_checkbox.c index 49f66f43..a5984dc5 100644 --- a/textscreen/txt_checkbox.c +++ b/textscreen/txt_checkbox.c @@ -130,7 +130,7 @@ txt_checkbox_t *TXT_NewCheckBox(const char *label, int *variable) return checkbox; } -txt_checkbox_t *TXT_NewInvertedCheckBox(char *label, int *variable) +txt_checkbox_t *TXT_NewInvertedCheckBox(const char *label, int *variable) { txt_checkbox_t *result; diff --git a/textscreen/txt_checkbox.h b/textscreen/txt_checkbox.h index 91e7d61c..039c0643 100644 --- a/textscreen/txt_checkbox.h +++ b/textscreen/txt_checkbox.h @@ -69,7 +69,7 @@ txt_checkbox_t *TXT_NewCheckBox(const char *label, int *variable); * @return Pointer to the new checkbox. */ -txt_checkbox_t *TXT_NewInvertedCheckBox(char *label, int *variable); +txt_checkbox_t *TXT_NewInvertedCheckBox(const char *label, int *variable); #endif /* #ifndef TXT_CHECKBOX_H */ From 90ded64b2b24fb64b31519769a8ceee986c75c44 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 19:50:15 +0200 Subject: [PATCH 28/47] textscreen: Make ExpandExtension parameter const --- textscreen/txt_fileselect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textscreen/txt_fileselect.c b/textscreen/txt_fileselect.c index 6f6332a3..ddc00fed 100644 --- a/textscreen/txt_fileselect.c +++ b/textscreen/txt_fileselect.c @@ -523,7 +523,7 @@ int TXT_CanSelectFiles(void) // return a pointer to a string that is a case-insensitive // pattern representation (like [Ww][Aa][Dd]) // -static char *ExpandExtension(char *orig) +static char *ExpandExtension(const char *orig) { int oldlen, newlen, i; char *c, *newext = NULL; From 49b5751693974214848439b429667a82254f5606 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 20:05:31 +0200 Subject: [PATCH 29/47] Make TXT_SelectFile window_title parameter const --- textscreen/txt_fileselect.c | 2 +- textscreen/txt_fileselect.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_fileselect.c b/textscreen/txt_fileselect.c index ddc00fed..c9dcaee0 100644 --- a/textscreen/txt_fileselect.c +++ b/textscreen/txt_fileselect.c @@ -556,7 +556,7 @@ static char *ExpandExtension(const char *orig) return newext; } -char *TXT_SelectFile(char *window_title, char **extensions) +char *TXT_SelectFile(const char *window_title, char **extensions) { unsigned int i; size_t len; diff --git a/textscreen/txt_fileselect.h b/textscreen/txt_fileselect.h index c72c6135..9b291859 100644 --- a/textscreen/txt_fileselect.h +++ b/textscreen/txt_fileselect.h @@ -50,7 +50,7 @@ int TXT_CanSelectFiles(void); * to select directories. */ -char *TXT_SelectFile(char *prompt, char **extensions); +char *TXT_SelectFile(const char *prompt, char **extensions); /** * Create a new txt_fileselect_t widget. From 19a0939300f332e32e6dfc05889651f91e7663c0 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Mar 2018 20:12:40 +0200 Subject: [PATCH 30/47] Make TXT_NewWindow parameter const --- textscreen/txt_window.c | 2 +- textscreen/txt_window.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index 54f84fdb..aca34e57 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -52,7 +52,7 @@ void TXT_SetWindowAction(txt_window_t *window, } } -txt_window_t *TXT_NewWindow(char *title) +txt_window_t *TXT_NewWindow(const char *title) { int i; diff --git a/textscreen/txt_window.h b/textscreen/txt_window.h index 13a0e171..f9cc4754 100644 --- a/textscreen/txt_window.h +++ b/textscreen/txt_window.h @@ -100,7 +100,7 @@ struct txt_window_s * representing the new window. */ -txt_window_t *TXT_NewWindow(char *title); +txt_window_t *TXT_NewWindow(const char *title); /** * Close a window. From aa555a22c129d5f94456142f3ebab1ebca17b66d Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:03:13 +0200 Subject: [PATCH 31/47] textscreen: Use more const-correct loop in TXT_SetLabel --- textscreen/txt_label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textscreen/txt_label.c b/textscreen/txt_label.c index e1f845cb..61df188d 100644 --- a/textscreen/txt_label.c +++ b/textscreen/txt_label.c @@ -131,7 +131,7 @@ void TXT_SetLabel(txt_label_t *label, char *value) label->h = 1; - for (p = value; *p != '\0'; ++p) + for (p = label->label; *p != '\0'; ++p) { if (*p == '\n') { From 50e55526b3d84bfd030c1d1ee02ba66b1a875a4d Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:07:30 +0200 Subject: [PATCH 32/47] Make TXT_SetLabel value parameter const --- textscreen/txt_label.c | 2 +- textscreen/txt_label.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_label.c b/textscreen/txt_label.c index 61df188d..191064cd 100644 --- a/textscreen/txt_label.c +++ b/textscreen/txt_label.c @@ -113,7 +113,7 @@ txt_widget_class_t txt_label_class = NULL, }; -void TXT_SetLabel(txt_label_t *label, char *value) +void TXT_SetLabel(txt_label_t *label, const char *value) { char *p; unsigned int y; diff --git a/textscreen/txt_label.h b/textscreen/txt_label.h index 3786843a..546e83e6 100644 --- a/textscreen/txt_label.h +++ b/textscreen/txt_label.h @@ -58,7 +58,7 @@ txt_label_t *TXT_NewLabel(char *label); * @param value The string to display (UTF-8 format). */ -void TXT_SetLabel(txt_label_t *label, char *value); +void TXT_SetLabel(txt_label_t *label, const char *value); /** * Set the background color of a label widget. From 6283e91fbd797eed1720ed5b23512f4c3783227c Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:19:14 +0200 Subject: [PATCH 33/47] Make TXT_NewLabel parameter const --- textscreen/txt_label.c | 2 +- textscreen/txt_label.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_label.c b/textscreen/txt_label.c index 191064cd..07834f46 100644 --- a/textscreen/txt_label.c +++ b/textscreen/txt_label.c @@ -168,7 +168,7 @@ void TXT_SetLabel(txt_label_t *label, const char *value) } } -txt_label_t *TXT_NewLabel(char *text) +txt_label_t *TXT_NewLabel(const char *text) { txt_label_t *label; diff --git a/textscreen/txt_label.h b/textscreen/txt_label.h index 546e83e6..8700c326 100644 --- a/textscreen/txt_label.h +++ b/textscreen/txt_label.h @@ -49,7 +49,7 @@ struct txt_label_s * @return Pointer to the new label widget. */ -txt_label_t *TXT_NewLabel(char *label); +txt_label_t *TXT_NewLabel(const char *label); /** * Set the string displayed in a label widget. From 334232d3b46d15c0169cb2f7080030e4ae4f1253 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:25:51 +0200 Subject: [PATCH 34/47] Make TXT_MessageBox message parameter const --- textscreen/txt_window.c | 2 +- textscreen/txt_window.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index aca34e57..c6db55c5 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -566,7 +566,7 @@ void TXT_OpenWindowHelpURL(txt_window_t *window) } } -txt_window_t *TXT_MessageBox(char *title, char *message, ...) +txt_window_t *TXT_MessageBox(char *title, const char *message, ...) { txt_window_t *window; char buf[256]; diff --git a/textscreen/txt_window.h b/textscreen/txt_window.h index f9cc4754..055b80f3 100644 --- a/textscreen/txt_window.h +++ b/textscreen/txt_window.h @@ -197,7 +197,7 @@ void TXT_SetMouseListener(txt_window_t *window, * @return The new window. */ -txt_window_t *TXT_MessageBox(char *title, char *message, ...); +txt_window_t *TXT_MessageBox(char *title, const char *message, ...); /** * Set the help URL for the given window. From 10fda2ac5343389de295bfa69aea4c4b0a366f5f Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:27:18 +0200 Subject: [PATCH 35/47] Make TXT_MessageBox title character const --- textscreen/txt_window.c | 2 +- textscreen/txt_window.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index c6db55c5..6c9e7009 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -566,7 +566,7 @@ void TXT_OpenWindowHelpURL(txt_window_t *window) } } -txt_window_t *TXT_MessageBox(char *title, const char *message, ...) +txt_window_t *TXT_MessageBox(const char *title, const char *message, ...) { txt_window_t *window; char buf[256]; diff --git a/textscreen/txt_window.h b/textscreen/txt_window.h index 055b80f3..55f9980f 100644 --- a/textscreen/txt_window.h +++ b/textscreen/txt_window.h @@ -197,7 +197,7 @@ void TXT_SetMouseListener(txt_window_t *window, * @return The new window. */ -txt_window_t *TXT_MessageBox(char *title, const char *message, ...); +txt_window_t *TXT_MessageBox(const char *title, const char *message, ...); /** * Set the help URL for the given window. From 592edc0d87486097c0bda044db144a4961a6ff7d Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:30:44 +0200 Subject: [PATCH 36/47] Make TXT_OpenURL parameter const --- textscreen/txt_window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index 6c9e7009..47dee6fc 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -515,14 +515,14 @@ void TXT_SetWindowHelpURL(txt_window_t *window, char *help_url) #ifdef _WIN32 -void TXT_OpenURL(char *url) +void TXT_OpenURL(const char *url) { ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL); } #else -void TXT_OpenURL(char *url) +void TXT_OpenURL(const char *url) { char *cmd; size_t cmd_len; From 232c968ed9bb922f99ef802f450b9c38ab156da6 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:33:06 +0200 Subject: [PATCH 37/47] textscreen: Make help_url member const in txt_window_s --- textscreen/txt_window.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textscreen/txt_window.h b/textscreen/txt_window.h index 55f9980f..4424055c 100644 --- a/textscreen/txt_window.h +++ b/textscreen/txt_window.h @@ -88,7 +88,7 @@ struct txt_window_s // URL of a webpage with help about this window. If set, a help key // indicator is shown while this window is active. - char *help_url; + const char *help_url; }; /** From 94d85c51b0aa49fbfcc72fc969815fb477052319 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:44:25 +0200 Subject: [PATCH 38/47] Make TXT_SetWindowHelpURL help_url parameter const --- textscreen/txt_window.c | 2 +- textscreen/txt_window.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index 47dee6fc..422e3e17 100644 --- a/textscreen/txt_window.c +++ b/textscreen/txt_window.c @@ -508,7 +508,7 @@ void TXT_SetWindowFocus(txt_window_t *window, int focused) TXT_SetWidgetFocus(window, focused); } -void TXT_SetWindowHelpURL(txt_window_t *window, char *help_url) +void TXT_SetWindowHelpURL(txt_window_t *window, const char *help_url) { window->help_url = help_url; } diff --git a/textscreen/txt_window.h b/textscreen/txt_window.h index 4424055c..7042ecf5 100644 --- a/textscreen/txt_window.h +++ b/textscreen/txt_window.h @@ -207,7 +207,7 @@ txt_window_t *TXT_MessageBox(const char *title, const char *message, ...); * window, or NULL to set no help for this window. */ -void TXT_SetWindowHelpURL(txt_window_t *window, char *help_url); +void TXT_SetWindowHelpURL(txt_window_t *window, const char *help_url); /** * Open the help URL for the given window, if one is set. From a6fbae76cd2725485cb8d98572dfa6b0eb884349 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:46:36 +0200 Subject: [PATCH 39/47] Make TXT_SetSeparatorLabel label parameter const --- textscreen/txt_separator.c | 2 +- textscreen/txt_separator.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_separator.c b/textscreen/txt_separator.c index d5b9562e..1905bc44 100644 --- a/textscreen/txt_separator.c +++ b/textscreen/txt_separator.c @@ -73,7 +73,7 @@ static void TXT_SeparatorDestructor(TXT_UNCAST_ARG(separator)) free(separator->label); } -void TXT_SetSeparatorLabel(txt_separator_t *separator, char *label) +void TXT_SetSeparatorLabel(txt_separator_t *separator, const char *label) { free(separator->label); diff --git a/textscreen/txt_separator.h b/textscreen/txt_separator.h index a9948c45..5c88938e 100644 --- a/textscreen/txt_separator.h +++ b/textscreen/txt_separator.h @@ -59,7 +59,7 @@ txt_separator_t *TXT_NewSeparator(char *label); * @param label The new label (UTF-8 format). */ -void TXT_SetSeparatorLabel(txt_separator_t *separator, char *label); +void TXT_SetSeparatorLabel(txt_separator_t *separator, const char *label); #endif /* #ifndef TXT_SEPARATOR_H */ From 569787da58542a02b830e016115de1ca05a3a25f Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:47:59 +0200 Subject: [PATCH 40/47] Make TXT_NewSeparator parameter const --- textscreen/txt_separator.c | 2 +- textscreen/txt_separator.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_separator.c b/textscreen/txt_separator.c index 1905bc44..1f30fc64 100644 --- a/textscreen/txt_separator.c +++ b/textscreen/txt_separator.c @@ -98,7 +98,7 @@ txt_widget_class_t txt_separator_class = NULL, }; -txt_separator_t *TXT_NewSeparator(char *label) +txt_separator_t *TXT_NewSeparator(const char *label) { txt_separator_t *separator; diff --git a/textscreen/txt_separator.h b/textscreen/txt_separator.h index 5c88938e..665c5a34 100644 --- a/textscreen/txt_separator.h +++ b/textscreen/txt_separator.h @@ -50,7 +50,7 @@ extern txt_widget_class_t txt_separator_class; * @return The new separator widget. */ -txt_separator_t *TXT_NewSeparator(char *label); +txt_separator_t *TXT_NewSeparator(const char *label); /** * Change the label on a separator. From 71ea0f904f3d1212d9b29f22575de43ad07e5853 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:53:42 +0200 Subject: [PATCH 41/47] Make TXT_SetRadioButtonLabel value parameter const --- textscreen/txt_radiobutton.c | 2 +- textscreen/txt_radiobutton.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_radiobutton.c b/textscreen/txt_radiobutton.c index e165ff2c..31d9fb9d 100644 --- a/textscreen/txt_radiobutton.c +++ b/textscreen/txt_radiobutton.c @@ -135,7 +135,7 @@ txt_radiobutton_t *TXT_NewRadioButton(char *label, int *variable, int value) return radiobutton; } -void TXT_SetRadioButtonLabel(txt_radiobutton_t *radiobutton, char *value) +void TXT_SetRadioButtonLabel(txt_radiobutton_t *radiobutton, const char *value) { free(radiobutton->label); radiobutton->label = strdup(value); diff --git a/textscreen/txt_radiobutton.h b/textscreen/txt_radiobutton.h index ec5eead8..9e550733 100644 --- a/textscreen/txt_radiobutton.h +++ b/textscreen/txt_radiobutton.h @@ -72,7 +72,7 @@ txt_radiobutton_t *TXT_NewRadioButton(char *label, int *variable, int value); * @param value The new label (UTF-8 format). */ -void TXT_SetRadioButtonLabel(txt_radiobutton_t *radiobutton, char *value); +void TXT_SetRadioButtonLabel(txt_radiobutton_t *radiobutton, const char *value); #endif /* #ifndef TXT_RADIOBUTTON_H */ From aacff41c26a3130bde300ea5c184497379e03af8 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 19:57:07 +0200 Subject: [PATCH 42/47] Make TXT_NewRadioButton label parameter const --- textscreen/txt_radiobutton.c | 2 +- textscreen/txt_radiobutton.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/textscreen/txt_radiobutton.c b/textscreen/txt_radiobutton.c index 31d9fb9d..1319bd69 100644 --- a/textscreen/txt_radiobutton.c +++ b/textscreen/txt_radiobutton.c @@ -121,7 +121,7 @@ txt_widget_class_t txt_radiobutton_class = NULL, }; -txt_radiobutton_t *TXT_NewRadioButton(char *label, int *variable, int value) +txt_radiobutton_t *TXT_NewRadioButton(const char *label, int *variable, int value) { txt_radiobutton_t *radiobutton; diff --git a/textscreen/txt_radiobutton.h b/textscreen/txt_radiobutton.h index 9e550733..6ba25a5f 100644 --- a/textscreen/txt_radiobutton.h +++ b/textscreen/txt_radiobutton.h @@ -63,7 +63,7 @@ struct txt_radiobutton_s * @return Pointer to the new radio button widget. */ -txt_radiobutton_t *TXT_NewRadioButton(char *label, int *variable, int value); +txt_radiobutton_t *TXT_NewRadioButton(const char *label, int *variable, int value); /** * Set the label on a radio button. From eb0c1ba61a7230c457442124ebbb7c6c28c9662e Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 20:02:43 +0200 Subject: [PATCH 43/47] Make Z_ChangeTag2 file parameter const --- src/z_native.c | 2 +- src/z_zone.c | 2 +- src/z_zone.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/z_native.c b/src/z_native.c index 26e12a06..0d52a622 100644 --- a/src/z_native.c +++ b/src/z_native.c @@ -442,7 +442,7 @@ void Z_CheckHeap (void) // Z_ChangeTag // -void Z_ChangeTag2(void *ptr, int tag, char *file, int line) +void Z_ChangeTag2(void *ptr, int tag, const char *file, int line) { memblock_t* block; diff --git a/src/z_zone.c b/src/z_zone.c index 828fd7eb..c5c2dbf7 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -490,7 +490,7 @@ void Z_CheckHeap (void) // // Z_ChangeTag // -void Z_ChangeTag2(void *ptr, int tag, char *file, int line) +void Z_ChangeTag2(void *ptr, int tag, const char *file, int line) { memblock_t* block; diff --git a/src/z_zone.h b/src/z_zone.h index 526f30d3..22bd6264 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -57,7 +57,7 @@ void Z_FreeTags (int lowtag, int hightag); void Z_DumpHeap (int lowtag, int hightag); void Z_FileDumpHeap (FILE *f); void Z_CheckHeap (void); -void Z_ChangeTag2 (void *ptr, int tag, char *file, int line); +void Z_ChangeTag2 (void *ptr, int tag, const char *file, int line); void Z_ChangeUser(void *ptr, void **user); int Z_FreeMemory (void); unsigned int Z_ZoneSize(void); From 77eb05a2f9f2a531204ed08e88829683b7d124ba Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 20:06:22 +0200 Subject: [PATCH 44/47] Make W_CheckNumForName parameter const --- src/w_wad.c | 2 +- src/w_wad.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index ceea18cd..63d517bc 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -258,7 +258,7 @@ int W_NumLumps (void) // Returns -1 if name not found. // -lumpindex_t W_CheckNumForName(char* name) +lumpindex_t W_CheckNumForName(const char *name) { lumpindex_t i; diff --git a/src/w_wad.h b/src/w_wad.h index 06cf3951..9c18458b 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -56,7 +56,7 @@ extern unsigned int numlumps; wad_file_t *W_AddFile(char *filename); void W_Reload(void); -lumpindex_t W_CheckNumForName(char *name); +lumpindex_t W_CheckNumForName(const char *name); lumpindex_t W_GetNumForName(char *name); int W_LumpLength(lumpindex_t lump); From 0eb2d12ecbf5ca27d5874651bebb9f3f13361aab Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 20:10:45 +0200 Subject: [PATCH 45/47] Make W_GetNumForName parameter const --- src/w_wad.c | 2 +- src/w_wad.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 63d517bc..f00d6175 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -307,7 +307,7 @@ lumpindex_t W_CheckNumForName(const char *name) // W_GetNumForName // Calls W_CheckNumForName, but bombs out if not found. // -lumpindex_t W_GetNumForName(char* name) +lumpindex_t W_GetNumForName(const char *name) { lumpindex_t i; diff --git a/src/w_wad.h b/src/w_wad.h index 9c18458b..364b9a90 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -57,7 +57,7 @@ wad_file_t *W_AddFile(char *filename); void W_Reload(void); lumpindex_t W_CheckNumForName(const char *name); -lumpindex_t W_GetNumForName(char *name); +lumpindex_t W_GetNumForName(const char *name); int W_LumpLength(lumpindex_t lump); void W_ReadLump(lumpindex_t lump, void *dest); From cc5a879a848c161253bf5e9d543aaff70ac38ec2 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 20:14:45 +0200 Subject: [PATCH 46/47] Make W_CacheLumpName name parameter const --- src/w_wad.c | 2 +- src/w_wad.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index f00d6175..be6bf33e 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -428,7 +428,7 @@ void *W_CacheLumpNum(lumpindex_t lumpnum, int tag) // // W_CacheLumpName // -void *W_CacheLumpName(char *name, int tag) +void *W_CacheLumpName(const char *name, int tag) { return W_CacheLumpNum(W_GetNumForName(name), tag); } diff --git a/src/w_wad.h b/src/w_wad.h index 364b9a90..49d6d10d 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -63,7 +63,7 @@ int W_LumpLength(lumpindex_t lump); void W_ReadLump(lumpindex_t lump, void *dest); void *W_CacheLumpNum(lumpindex_t lump, int tag); -void *W_CacheLumpName(char *name, int tag); +void *W_CacheLumpName(const char *name, int tag); void W_GenerateHashTable(void); From c72143846b0d04d9e966e96357dac30fcce03921 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 13 Mar 2018 20:17:28 +0200 Subject: [PATCH 47/47] Make W_ReleaseLumpName parameter const --- src/w_wad.c | 2 +- src/w_wad.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index be6bf33e..ac226c93 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -464,7 +464,7 @@ void W_ReleaseLumpNum(lumpindex_t lumpnum) } } -void W_ReleaseLumpName(char *name) +void W_ReleaseLumpName(const char *name) { W_ReleaseLumpNum(W_GetNumForName(name)); } diff --git a/src/w_wad.h b/src/w_wad.h index 49d6d10d..ef026f6d 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -70,6 +70,6 @@ void W_GenerateHashTable(void); extern unsigned int W_LumpNameHash(const char *s); void W_ReleaseLumpNum(lumpindex_t lump); -void W_ReleaseLumpName(char *name); +void W_ReleaseLumpName(const char *name); #endif