summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:27:50 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:31:07 (GMT)
commitf390f9b51cf8686e9ed44f13a33c7349b9e96a09 (patch)
tree162c768769713a7215bca64daf8f2bdc75c9fbee /src/corelib
parent0bb0699d403b7541472a72a4057ecf0ca366a7cd (diff)
downloadQt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.zip
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.gz
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.bz2
improved string operations all over the place
used character operations whenever possible better usage of QLatin1String
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp6
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp8
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp2
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp2
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp2
-rw-r--r--src/corelib/tools/qdatetime.cpp2
-rw-r--r--src/corelib/tools/qlocale.cpp4
-rw-r--r--src/corelib/xml/qxmlstream.cpp2
9 files changed, 15 insertions, 15 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 8ea48d1..3c443ff 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -83,12 +83,12 @@ static QByteArray openModeToFopenMode(QIODevice::OpenMode flags, const QString &
} else if (flags & QIODevice::WriteOnly) {
mode = "wb";
if (flags & QIODevice::ReadOnly)
- mode += "+";
+ mode += '+';
}
if (flags & QIODevice::Append) {
mode = "ab";
if (flags & QIODevice::ReadOnly)
- mode += "+";
+ mode += '+';
}
return mode;
}
@@ -723,7 +723,7 @@ QString QFSFileEngine::fileName(FileName file) const
bool isDir = ret.endsWith(QLatin1Char('/'));
ret = QDir::cleanPath(ret);
if (isDir)
- ret += QLatin1String("/");
+ ret += QLatin1Char('/');
if (file == AbsolutePathName) {
int slash = ret.lastIndexOf(QLatin1Char('/'));
if (slash == -1)
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 0b87e2b..790f1eb 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1770,10 +1770,10 @@ QString QFSFileEngine::fileName(FileName file) const
if(slash == -1) {
if(d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':'))
return d->filePath.left(2);
- return QString::fromLatin1(".");
+ return QLatin1Char('.');
} else {
if(!slash)
- return QString::fromLatin1("/");
+ return QLatin1Char('/');
if(slash == 2 && d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':'))
slash++;
return d->filePath.left(slash);
@@ -1831,7 +1831,7 @@ QString QFSFileEngine::fileName(FileName file) const
if (slash == -1)
ret = QDir::currentPath();
else if (slash == 0)
- ret = QLatin1String("/");
+ ret = QLatin1Char('/');
ret = ret.left(slash);
}
return ret;
@@ -1893,7 +1893,7 @@ QString QFSFileEngine::owner(FileOwner own) const
#else
Q_UNUSED(own);
#endif
- return QString(QLatin1String(""));
+ return QString();
}
bool QFSFileEngine::setPermissions(uint perms)
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 94a53f1..5846e23 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -5330,7 +5330,7 @@ QString QUrl::toString(FormattingOptions options) const
url += QLatin1Char('/');
url += ourPath;
// check if we need to remove trailing slashes
- while ((options & StripTrailingSlash) && url.right(1) == QLatin1String("/"))
+ while ((options & StripTrailingSlash) && url.endsWith(QLatin1Char('/')))
url.chop(1);
}
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 6847173..cb40f19 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1908,7 +1908,7 @@ QStringList QCoreApplication::arguments()
wchar_t tempFilename[MAX_PATH+1];
if (GetModuleFileNameW(0, tempFilename, MAX_PATH)) {
tempFilename[MAX_PATH] = 0;
- cmdline.prepend(QLatin1Char('\"') + QString::fromUtf16((unsigned short *)tempFilename) + QString(QLatin1String("\" ")));
+ cmdline.prepend(QLatin1Char('\"') + QString::fromUtf16((unsigned short *)tempFilename) + QLatin1String("\" "));
}
#endif // Q_OS_WINCE
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 9868c23..815a558 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -840,7 +840,7 @@ QString decodeMSG(const MSG& msg)
FLGSTR(ISC_SHOWUICANDIDATEWINDOW << 2),
FLGSTR(ISC_SHOWUICANDIDATEWINDOW << 3),
FLAG_STRING());
- parameters.sprintf("Input context(%s) Show flags(%s)", (fSet?"Active":"Inactive"), showFlgs.toLatin1().data());
+ parameters.sprintf("Input context(%s) Show flags(%s)", (fSet? "Active" : "Inactive"), showFlgs.toLatin1().data());
}
break;
#endif
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index 08bd2d0..de1baac 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -71,7 +71,7 @@ static QString qdlerror()
#else
const char *err = strerror(errno);
#endif
- return err ? QLatin1String("(")+QString::fromLocal8Bit(err) + QLatin1String(")"): QString();
+ return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')'): QString();
}
bool QLibraryPrivate::load_sys()
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 090ca61..de41360 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -4688,7 +4688,7 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
if (fixup && tmpstate == Intermediate && used < sn.count) {
const FieldInfo fi = fieldInfo(index);
if ((fi & (Numeric|FixedWidth)) == (Numeric|FixedWidth)) {
- const QString newText = QString(QLatin1String("%1")).arg(num, sn.count, 10, QLatin1Char('0'));
+ const QString newText = QString::fromLatin1("%1").arg(num, sn.count, 10, QLatin1Char('0'));
input.replace(pos, used, newText);
used = sn.count;
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 248137a..9953155 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -321,7 +321,7 @@ static QString readEscapedFormatString(const QString &format, int *idx)
{
int &i = *idx;
- Q_ASSERT(format.at(i).unicode() == '\'');
+ Q_ASSERT(format.at(i) == QLatin1Char('\''));
++i;
if (i == format.size())
return QString();
@@ -635,7 +635,7 @@ static QLocale::MeasurementSystem winSystemMeasurementSystem()
QString iMeasure = QT_WA_INLINE(
QString::fromUtf16(reinterpret_cast<ushort*>(output)),
QString::fromLocal8Bit(reinterpret_cast<char*>(output)));
- if (iMeasure == QString::fromLatin1("1")) {
+ if (iMeasure == QLatin1String("1")) {
return QLocale::ImperialSystem;
}
}
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index ff1a01f..5e1fec3 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -3058,7 +3058,7 @@ QXmlStreamPrivateTagStack::NamespaceDeclaration &QXmlStreamWriterPrivate::findNa
QString s;
int n = ++namespacePrefixCount;
forever {
- s = QLatin1String("n") + QString::number(n++);
+ s = QLatin1Char('n') + QString::number(n++);
int j = namespaceDeclarations.size() - 2;
while (j >= 0 && namespaceDeclarations.at(j).prefix != s)
--j;