# HG changeset patch # User Olaf Wintermann # Date 1757427251 -7200 # Node ID 882e49cf7192dbfba4dd6c20c53242583a00e55b # Parent 08a2421957f114b0765eb955b5009fc8795c3c22 make some function parameters const diff -r 08a2421957f1 -r 882e49cf7192 ui/common/properties.c --- a/ui/common/properties.c Mon Sep 08 12:43:52 2025 +0200 +++ b/ui/common/properties.c Tue Sep 09 16:14:11 2025 +0200 @@ -73,7 +73,7 @@ #define UI_ENV_HOME "USERPROFILE" #endif -char* ui_configfile(char *name) { +char* ui_configfile(const char *name) { const char *appname = ui_appname(); if(!appname) { return NULL; @@ -241,12 +241,14 @@ #ifndef UI_COCOA -void ui_locales_dir(char *path) { - locales_dir = path; +void ui_locales_dir(const char *path) { + free(locales_dir); + locales_dir = path ? strdup(path) : NULL; } -void ui_pixmaps_dir(char *path) { - pixmaps_dir = path; +void ui_pixmaps_dir(const char *path) { + free(pixmaps_dir); + pixmaps_dir = path ? strdup(path) : NULL; } char* uic_get_image_path(const char *imgfilename) { @@ -257,7 +259,7 @@ } } -void ui_load_lang(char *locale) { +void ui_load_lang(const char *locale) { if(!locale) { locale = "en_EN"; } @@ -319,12 +321,12 @@ return 0; } -char* uistr(char *name) { +char* uistr(const char *name) { char *value = uistr_n(name); return value ? value : "missing string"; } -char* uistr_n(char *name) { +char* uistr_n(const char *name) { if(!language) { return NULL; } diff -r 08a2421957f1 -r 882e49cf7192 ui/ui/properties.h --- a/ui/ui/properties.h Mon Sep 08 12:43:52 2025 +0200 +++ b/ui/ui/properties.h Tue Sep 09 16:14:11 2025 +0200 @@ -41,14 +41,14 @@ int ui_properties_store(void); -void ui_locales_dir(char *path); -void ui_pixmaps_dir(char *path); +void ui_locales_dir(const char *path); +void ui_pixmaps_dir(const char *path); -void ui_load_lang(char *locale); +void ui_load_lang(const char *locale); void ui_load_lang_def(char *locale, char *default_locale); -char* uistr(char *name); -char* uistr_n(char *name); +char* uistr(const char *name); +char* uistr_n(const char *name); #ifdef __cplusplus } diff -r 08a2421957f1 -r 882e49cf7192 ui/ui/toolkit.h --- a/ui/ui/toolkit.h Mon Sep 08 12:43:52 2025 +0200 +++ b/ui/ui/toolkit.h Tue Sep 09 16:14:11 2025 +0200 @@ -672,7 +672,7 @@ UIEXPORT char* ui_getappdir(void); -UIEXPORT char* ui_configfile(char *name); +UIEXPORT char* ui_configfile(const char *name); UIEXPORT UiCondVar* ui_condvar_create(void); UIEXPORT void ui_condvar_wait(UiCondVar *var);