From 5a8fe6681fdb283fdf22fefaca7d19ccfc43c7cd Mon Sep 17 00:00:00 2001 From: Nick Shaforostoff Date: Fri, 20 Mar 2015 22:12:43 +0000 Subject: mini-optimization by fixing defects found by coverity and using QByteArrayLiteral --- src/core/kconfiggroup.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/core/kconfiggroup.cpp') 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 ""; + return QByteArrayLiteral(""); } return mName; } @@ -112,7 +112,7 @@ public: { QExplicitlySharedDataPointer data; if (dynamic_cast(master)) { - data = new KConfigGroupPrivate(dynamic_cast(master), isImmutable, isConst, name); + data = new KConfigGroupPrivate(static_cast(master), isImmutable, isConst, name); } else { data = new KConfigGroupPrivate(dynamic_cast(master), isImmutable, isConst, name); } @@ -125,13 +125,13 @@ public: QByteArray KConfigGroupPrivate::serializeList(const QList &list) { - QByteArray value = ""; + QByteArray value; if (!list.isEmpty()) { QList::ConstIterator it = list.constBegin(); const QList::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 &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"); } } -- cgit v1.2.1