From 6ae16b87d0560ac06e882da122f43b0e9b913b34 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 18 Nov 2017 19:57:50 +0100 Subject: Constify strings in pref.h Make all char * pointers in pref.h const to make it clear that these strings are not mutable. This meant adding a number of (void *) casts in calls to free(). Apart from being the right thing to do, this commit makes the code more consistent, as many of the strings in pref.h were already const. While touching core/qthelper.cpp turn three instances of (void*) into (void *). Signed-off-by: Berthold Stoeger --- core/qthelper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/qthelper.cpp') diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 628fffa97..53cf1f841 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -537,11 +537,11 @@ QString uiLanguage(QLocale *callerLoc) // messes things up there dateFormat.replace("'en' 'den' d:'e'", " d"); if (!prefs.date_format_override || same_string(prefs.date_format, "")) { - free((void*)prefs.date_format); + free((void *)prefs.date_format); prefs.date_format = strdup(qPrintable(dateFormat)); } if (!prefs.date_format_override || same_string(prefs.date_format_short, "")) { - free((void*)prefs.date_format_short); + free((void *)prefs.date_format_short); prefs.date_format_short = strdup(qPrintable(shortDateFormat)); } } @@ -549,7 +549,7 @@ QString uiLanguage(QLocale *callerLoc) timeFormat = loc.timeFormat(); timeFormat.replace("(t)", "").replace(" t", "").replace("t", "").replace("hh", "h").replace("HH", "H").replace("'kl'.", ""); timeFormat.replace(".ss", "").replace(":ss", "").replace("ss", ""); - free((void*)prefs.time_format); + free((void *)prefs.time_format); prefs.time_format = strdup(qPrintable(timeFormat)); } return uiLang; @@ -1438,7 +1438,7 @@ int getCloudURL(QString &filename) if (email.isEmpty() || same_string(prefs.cloud_storage_password, "")) return report_error("Please configure Cloud storage email and password in the preferences"); if (email != prefs.cloud_storage_email_encoded) { - free(prefs.cloud_storage_email_encoded); + free((void *)prefs.cloud_storage_email_encoded); prefs.cloud_storage_email_encoded = strdup(qPrintable(email)); } filename = QString(QString(prefs.cloud_git_url) + "/%1[%1]").arg(email); -- cgit v1.2.3-70-g09d2