aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNick Shaforostoff <shafff@ukr.net>2015-03-20 22:12:43 +0000
committerNick Shaforostoff <shafff@ukr.net>2015-03-20 22:12:43 +0000
commit5a8fe6681fdb283fdf22fefaca7d19ccfc43c7cd (patch)
tree59eb91c579b2f2fd1a09da36222cebea21889d77 /src/core
parent094c91f86baf1e82e55b435c07c5ba37ff107dd9 (diff)
downloadkconfig-5a8fe6681fdb283fdf22fefaca7d19ccfc43c7cd.tar.gz
kconfig-5a8fe6681fdb283fdf22fefaca7d19ccfc43c7cd.tar.bz2
mini-optimization by fixing defects found by coverity and using QByteArrayLiteral
Diffstat (limited to 'src/core')
-rw-r--r--src/core/kconfiggroup.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/kconfiggroup.cpp b/src/core/kconfiggroup.cpp
index 1ad79f8c..e09d602e 100644
--- a/src/core/kconfiggroup.cpp
+++ b/src/core/kconfiggroup.cpp
@@ -92,7 +92,7 @@ public:
QByteArray name() const
{
if (mName.isEmpty()) {
- return "<default>";
+ return QByteArrayLiteral("<default>");
}
return mName;
}
@@ -112,7 +112,7 @@ public:
{
QExplicitlySharedDataPointer<KConfigGroupPrivate> data;
if (dynamic_cast<KConfigGroup *>(master)) {
- data = new KConfigGroupPrivate(dynamic_cast<KConfigGroup *>(master), isImmutable, isConst, name);
+ data = new KConfigGroupPrivate(static_cast<KConfigGroup *>(master), isImmutable, isConst, name);
} else {
data = new KConfigGroupPrivate(dynamic_cast<KConfig *>(master), isImmutable, isConst, name);
}
@@ -125,13 +125,13 @@ public:
QByteArray KConfigGroupPrivate::serializeList(const QList<QByteArray> &list)
{
- QByteArray value = "";
+ QByteArray value;
if (!list.isEmpty()) {
QList<QByteArray>::ConstIterator it = list.constBegin();
const QList<QByteArray>::ConstIterator end = list.constEnd();
- value = QByteArray(*it).replace('\\', "\\\\").replace(',', "\\,");
+ value = QByteArray(*it).replace('\\', QByteArrayLiteral("\\\\")).replace(',', QByteArrayLiteral("\\,"));
while (++it != end) {
// In the loop, so it is not done when there is only one element.
@@ -139,12 +139,12 @@ QByteArray KConfigGroupPrivate::serializeList(const QList<QByteArray> &list)
value.reserve(4096);
value += ',';
- value += QByteArray(*it).replace('\\', "\\\\").replace(',', "\\,");
+ value += QByteArray(*it).replace('\\', QByteArrayLiteral("\\\\")).replace(',', QByteArrayLiteral("\\,"));
}
// To be able to distinguish an empty list from a list with one empty element.
if (value.isEmpty()) {
- value = "\\0";
+ value = QByteArrayLiteral("\\0");
}
}