summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-11-18 19:57:50 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-18 21:57:33 +0100
commit6ae16b87d0560ac06e882da122f43b0e9b913b34 (patch)
tree7719c68851b20116a9fdc62b3fd71085bdfcdbb7 /mobile-widgets
parentf8fcd65bc4598ac150477f6caa64c617ec220982 (diff)
downloadsubsurface-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 'mobile-widgets')
-rw-r--r--mobile-widgets/qmlmanager.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index b0e597f6f..2c28ccf83 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -383,7 +383,7 @@ void QMLManager::saveCloudCredentials()
s.setValue("cloud_verification_status", credentialStatus());
s.sync();
if (!same_string(prefs.cloud_storage_email, qPrintable(cloudUser))) {
- free(prefs.cloud_storage_email);
+ free((void *)prefs.cloud_storage_email);
prefs.cloud_storage_email = strdup(qPrintable(cloudUser));
cloudCredentialsChanged = true;
}
@@ -396,7 +396,7 @@ void QMLManager::saveCloudCredentials()
}
if (!same_string(prefs.cloud_storage_password, qPrintable(cloudPwd))) {
- free(prefs.cloud_storage_password);
+ free((void *)prefs.cloud_storage_password);
prefs.cloud_storage_password = strdup(qPrintable(cloudPwd));
}
if (cloudUser.isEmpty() || cloudPwd.isEmpty()) {
@@ -404,7 +404,7 @@ void QMLManager::saveCloudCredentials()
} else if (cloudCredentialsChanged) {
// let's make sure there are no unsaved changes
saveChangesLocal();
- free(prefs.userid);
+ free((void *)prefs.userid);
prefs.userid = NULL;
syncLoadFromCloud();
QString url;
@@ -550,7 +550,7 @@ void QMLManager::retrieveUserid()
}
if (!userid.isEmpty()) {
// overwrite the existing userid
- free(prefs.userid);
+ free((void *)prefs.userid);
prefs.userid = strdup(qPrintable(userid));
QSettings s;
s.setValue("subsurface_webservice_uid", prefs.userid);
@@ -649,9 +649,9 @@ void QMLManager::revertToNoCloudIfNeeded()
appendTextToLog(QStringLiteral("taking things back offline since sync with cloud failed"));
prefs.git_local_only = syncToCloud();
}
- free(prefs.cloud_storage_email);
+ free((void *)prefs.cloud_storage_email);
prefs.cloud_storage_email = NULL;
- free(prefs.cloud_storage_password);
+ free((void *)prefs.cloud_storage_password);
prefs.cloud_storage_password = NULL;
setCloudUserName("");
setCloudPassword("");