ui/common/properties.c

changeset 753
882e49cf7192
parent 674
51670b0bc625
child 762
9452eccfc0f0
--- 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;
     }

mercurial