diff --git a/src/deh_str.c b/src/deh_str.c index 1422b759..b60f46a0 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) @@ -52,7 +52,7 @@ static unsigned int strhash(char *s) return h; } -static deh_substitution_t *SubstitutionForString(char *s) +static deh_substitution_t *SubstitutionForString(const char *s) { int entry; @@ -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; @@ -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. 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 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); diff --git a/src/i_system.c b/src/i_system.c index 681ecd4c..6a2e6969 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -158,7 +158,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); @@ -181,7 +181,7 @@ void I_PrintDivider(void) putchar('\n'); } -void I_PrintStartupBanner(char *gamedescription) +void I_PrintStartupBanner(const char *gamedescription) { I_PrintDivider(); I_PrintBanner(gamedescription); @@ -261,7 +261,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..f87d92f6 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); @@ -72,11 +72,11 @@ 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. -void I_PrintBanner(char *text); +void I_PrintBanner(const char *text); // Print a dividing line for startup banners. diff --git a/src/m_misc.c b/src/m_misc.c index e82fffd6..3469ba86 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); @@ -63,7 +63,7 @@ void M_MakeDirectory(char *path) // Check if a file exists -boolean M_FileExists(char *filename) +boolean M_FileExists(const char *filename) { FILE *fstream; @@ -86,7 +86,7 @@ boolean M_FileExists(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; @@ -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; @@ -202,7 +202,7 @@ boolean M_WriteFile(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; @@ -233,7 +233,7 @@ int M_ReadFile(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; @@ -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; @@ -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 0225b827..067995e1 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -25,18 +25,18 @@ #include "doomtype.h" -boolean M_WriteFile(char *name, void *source, int length); -int M_ReadFile(char *name, byte **buffer); -void M_MakeDirectory(char *dir); -char *M_TempFile(char *s); -boolean M_FileExists(char *file); -char *M_FileCaseExists(char *file); +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(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); +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); diff --git a/src/w_wad.c b/src/w_wad.c index ceea18cd..ac226c93 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; @@ -307,7 +307,7 @@ lumpindex_t W_CheckNumForName(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; @@ -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); } @@ -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 06cf3951..ef026f6d 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -56,20 +56,20 @@ extern unsigned int numlumps; wad_file_t *W_AddFile(char *filename); void W_Reload(void); -lumpindex_t W_CheckNumForName(char *name); -lumpindex_t W_GetNumForName(char *name); +lumpindex_t W_CheckNumForName(const char *name); +lumpindex_t W_GetNumForName(const char *name); 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); 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 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); diff --git a/textscreen/txt_button.c b/textscreen/txt_button.c index 8865e1a4..aaf711d7 100644 --- a/textscreen/txt_button.c +++ b/textscreen/txt_button.c @@ -93,13 +93,13 @@ 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); } -txt_button_t *TXT_NewButton(char *label) +txt_button_t *TXT_NewButton(const char *label) { txt_button_t *button; @@ -113,7 +113,7 @@ txt_button_t *TXT_NewButton(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 cde528f6..e0455441 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 @@ -57,7 +57,7 @@ txt_button_t *TXT_NewButton(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); /** @@ -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 */ diff --git a/textscreen/txt_checkbox.c b/textscreen/txt_checkbox.c index 8610c719..a5984dc5 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; @@ -130,7 +130,7 @@ txt_checkbox_t *TXT_NewCheckBox(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 08f37d44..039c0643 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. @@ -69,7 +69,7 @@ txt_checkbox_t *TXT_NewCheckBox(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 */ 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 diff --git a/textscreen/txt_fileselect.c b/textscreen/txt_fileselect.c index b40da89f..89934375 100644 --- a/textscreen/txt_fileselect.c +++ b/textscreen/txt_fileselect.c @@ -517,7 +517,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; @@ -550,7 +550,7 @@ static char *ExpandExtension(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. diff --git a/textscreen/txt_label.c b/textscreen/txt_label.c index e1f845cb..07834f46 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; @@ -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') { @@ -168,7 +168,7 @@ void TXT_SetLabel(txt_label_t *label, 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 3786843a..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. @@ -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. 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_radiobutton.c b/textscreen/txt_radiobutton.c index e165ff2c..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; @@ -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..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. @@ -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 */ diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index a0739042..ac563b23 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; @@ -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[] = @@ -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; @@ -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) { @@ -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); } diff --git a/textscreen/txt_separator.c b/textscreen/txt_separator.c index d5b9562e..1f30fc64 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); @@ -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 a9948c45..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. @@ -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 */ diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c index 54f84fdb..422e3e17 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; @@ -508,21 +508,21 @@ 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; } #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; @@ -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(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 13a0e171..7042ecf5 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; }; /** @@ -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. @@ -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(const char *title, const char *message, ...); /** * Set the help URL for the given window. @@ -207,7 +207,7 @@ txt_window_t *TXT_MessageBox(char *title, 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.