diff options
author | Christian Kamm <mail@ckamm.de> | 2017-02-07 15:52:15 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2017-02-08 17:15:19 +0300 |
commit | 4c1fdf1dee74bd3e1b3ada5ca6e7a8209f4e4659 (patch) | |
tree | ed0fe9fe5ec2aa914995b6360126c262d33e4c38 /src/libsync/configfile.cpp | |
parent | 50029645465f0e0e98988a71af9a4ffc6c15f0d9 (diff) |
Double check usage of asserts #5429
A few are supposed to be fatal.
Diffstat (limited to 'src/libsync/configfile.cpp')
-rw-r--r-- | src/libsync/configfile.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 8982b33b3..39f6303f6 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -17,6 +17,7 @@ #include "configfile.h" #include "theme.h" #include "utility.h" +#include "asserts.h" #include "creds/abstractcredentials.h" @@ -139,7 +140,7 @@ void ConfigFile::setOptionalDesktopNotifications(bool show) void ConfigFile::saveGeometry(QWidget *w) { #ifndef TOKEN_AUTH_ONLY - Q_ASSERT(!w->objectName().isNull()); + ASSERT(!w->objectName().isNull()); QSettings settings(configFile(), QSettings::IniFormat); settings.beginGroup(w->objectName()); settings.setValue(QLatin1String(geometryC), w->saveGeometry()); @@ -158,7 +159,7 @@ void ConfigFile::saveGeometryHeader(QHeaderView *header) { #ifndef TOKEN_AUTH_ONLY if(!header) return; - Q_ASSERT(!header->objectName().isEmpty()); + ASSERT(!header->objectName().isEmpty()); QSettings settings(configFile(), QSettings::IniFormat); settings.beginGroup(header->objectName()); @@ -171,7 +172,7 @@ void ConfigFile::restoreGeometryHeader(QHeaderView *header) { #ifndef TOKEN_AUTH_ONLY if(!header) return; - Q_ASSERT(!header->objectName().isNull()); + ASSERT(!header->objectName().isNull()); QSettings settings(configFile(), QSettings::IniFormat); settings.beginGroup(header->objectName()); @@ -230,8 +231,8 @@ QString ConfigFile::excludeFile(Scope scope) const // directories. QFileInfo fi; - if (scope != SystemScope) { - QFileInfo fi; + switch (scope) { + case UserScope: fi.setFile( configPath(), exclFile ); if( ! fi.isReadable() ) { @@ -241,12 +242,12 @@ QString ConfigFile::excludeFile(Scope scope) const fi.setFile( configPath(), exclFile ); } return fi.absoluteFilePath(); - } else if (scope != UserScope) { + case SystemScope: return ConfigFile::excludeFileFromSystem(); - } else { - Q_ASSERT(false); - return QString(); // unreachable } + + ASSERT(false); + return QString(); } QString ConfigFile::excludeFileFromSystem() |