diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-11-18 19:57:50 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-18 21:57:33 +0100 |
commit | 6ae16b87d0560ac06e882da122f43b0e9b913b34 (patch) | |
tree | 7719c68851b20116a9fdc62b3fd71085bdfcdbb7 /core/qthelper.cpp | |
parent | f8fcd65bc4598ac150477f6caa64c617ec220982 (diff) | |
download | subsurface-6ae16b87d0560ac06e882da122f43b0e9b913b34.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r-- | core/qthelper.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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); |