summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdebug.h28
-rw-r--r--src/corelib/io/qdir.cpp10
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp12
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/io/qprocess.cpp2
-rw-r--r--src/corelib/io/qprocess_win.cpp20
-rw-r--r--src/corelib/io/qresource.cpp8
-rw-r--r--src/corelib/io/qsettings_win.cpp2
-rw-r--r--src/corelib/io/qtemporaryfile.cpp2
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/io/qurl.cpp6
-rw-r--r--src/corelib/io/qurl.h2
12 files changed, 47 insertions, 49 deletions
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 9b0fbe5..54121f6 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -85,11 +85,11 @@ public:
delete stream;
}
}
- inline QDebug &space() { stream->space = true; stream->ts << " "; return *this; }
+ inline QDebug &space() { stream->space = true; stream->ts << ' '; return *this; }
inline QDebug &nospace() { stream->space = false; return *this; }
- inline QDebug &maybeSpace() { if (stream->space) stream->ts << " "; return *this; }
+ inline QDebug &maybeSpace() { if (stream->space) stream->ts << ' '; return *this; }
- inline QDebug &operator<<(QChar t) { stream->ts << "\'" << t << "\'"; return maybeSpace(); }
+ inline QDebug &operator<<(QChar t) { stream->ts << '\'' << t << '\''; return maybeSpace(); }
inline QDebug &operator<<(QBool t) { stream->ts << (bool(t) ? "true" : "false"); return maybeSpace(); }
inline QDebug &operator<<(bool t) { stream->ts << (t ? "true" : "false"); return maybeSpace(); }
inline QDebug &operator<<(char t) { stream->ts << t; return maybeSpace(); }
@@ -106,10 +106,10 @@ public:
inline QDebug &operator<<(float t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(const char* t) { stream->ts << QString::fromAscii(t); return maybeSpace(); }
- inline QDebug &operator<<(const QString & t) { stream->ts << "\"" << t << "\""; return maybeSpace(); }
+ inline QDebug &operator<<(const QString & t) { stream->ts << '\"' << t << '\"'; return maybeSpace(); }
inline QDebug &operator<<(const QStringRef & t) { return operator<<(t.toString()); }
- inline QDebug &operator<<(const QLatin1String &t) { stream->ts << "\"" << t.latin1() << "\""; return maybeSpace(); }
- inline QDebug &operator<<(const QByteArray & t) { stream->ts << "\"" << t << "\""; return maybeSpace(); }
+ inline QDebug &operator<<(const QLatin1String &t) { stream->ts << '\"' << t.latin1() << '\"'; return maybeSpace(); }
+ inline QDebug &operator<<(const QByteArray & t) { stream->ts << '\"' << t << '\"'; return maybeSpace(); }
inline QDebug &operator<<(const void * t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(QTextStreamFunction f) {
stream->ts << f;
@@ -159,13 +159,13 @@ template <class T>
inline QDebug operator<<(QDebug debug, const QList<T> &list)
#endif
{
- debug.nospace() << "(";
+ debug.nospace() << '(';
for (Q_TYPENAME QList<T>::size_type i = 0; i < list.count(); ++i) {
if (i)
debug << ", ";
debug << list.at(i);
}
- debug << ")";
+ debug << ')';
return debug.space();
}
@@ -192,9 +192,9 @@ inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map)
debug.nospace() << "QMap(";
for (typename QMap<aKey, aT>::const_iterator it = map.constBegin();
it != map.constEnd(); ++it) {
- debug << "(" << it.key() << ", " << it.value() << ")";
+ debug << '(' << it.key() << ", " << it.value() << ')';
}
- debug << ")";
+ debug << ')';
return debug.space();
}
@@ -209,8 +209,8 @@ inline QDebug operator<<(QDebug debug, const QHash<aKey, aT> &hash)
debug.nospace() << "QHash(";
for (typename QHash<aKey, aT>::const_iterator it = hash.constBegin();
it != hash.constEnd(); ++it)
- debug << "(" << it.key() << ", " << it.value() << ")";
- debug << ")";
+ debug << '(' << it.key() << ", " << it.value() << ')';
+ debug << ')';
return debug.space();
}
@@ -222,7 +222,7 @@ template <class T1, class T2>
inline QDebug operator<<(QDebug debug, const QPair<T1, T2> &pair)
#endif
{
- debug.nospace() << "QPair(" << pair.first << "," << pair.second << ")";
+ debug.nospace() << "QPair(" << pair.first << ',' << pair.second << ')';
return debug.space();
}
@@ -247,7 +247,7 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
if (i != cache.lastIndex())
debug << ", ";
}
- debug << ")";
+ debug << ')';
return debug.space();
}
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 0dc8a63..7d330e6 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -2417,7 +2417,7 @@ QDebug operator<<(QDebug debug, QDir::Filters filters)
if (filters & QDir::System) flags << QLatin1String("System");
if (filters & QDir::CaseSensitive) flags << QLatin1String("CaseSensitive");
}
- debug << "QDir::Filters(" << qPrintable(flags.join(QLatin1String("|"))) << ")";
+ debug << "QDir::Filters(" << qPrintable(flags.join(QLatin1String("|"))) << ')';
return debug;
}
@@ -2439,8 +2439,8 @@ QDebug operator<<(QDebug debug, QDir::SortFlags sorting)
if (sorting & QDir::LocaleAware) flags << QLatin1String("LocaleAware");
if (sorting & QDir::Type) flags << QLatin1String("Type");
debug << "QDir::SortFlags(" << qPrintable(type)
- << "|"
- << qPrintable(flags.join(QLatin1String("|"))) << ")";
+ << '|'
+ << qPrintable(flags.join(QLatin1String("|"))) << ')';
}
return debug;
}
@@ -2452,9 +2452,9 @@ QDebug operator<<(QDebug debug, const QDir &dir)
<< qPrintable(dir.nameFilters().join(QLatin1String(",")))
<< "}, "
<< dir.sorting()
- << ","
+ << ','
<< dir.filter()
- << ")";
+ << ')';
return debug.space();
}
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 5d6cd06..aee9fde 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -433,7 +433,7 @@ static QString nativeAbsoluteFilePathW(const QString &path)
if (retLen != 0)
ret = QString::fromUtf16((unsigned short *)buf.data(), retLen);
#else
- if (path.startsWith(QLatin1String("/")) || path.startsWith(QLatin1String("\\")))
+ if (path.startsWith(QLatin1Char('/')) || path.startsWith(QLatin1Char('\\')))
ret = QDir::toNativeSeparators(path);
else
ret = QDir::toNativeSeparators(QDir::cleanPath(qfsPrivateCurrentDir + QLatin1Char('/') + path));
@@ -1240,7 +1240,7 @@ QString QFSFileEngine::rootPath()
QString ret = QString::fromLatin1(qgetenv("SystemDrive").constData());
if(ret.isEmpty())
ret = QLatin1String("c:");
- ret += QLatin1String("/");
+ ret += QLatin1Char('/');
#elif defined(Q_OS_OS2EMX)
char dir[4];
_abspath(dir, QLatin1String("/"), _MAX_PATH);
@@ -1288,19 +1288,17 @@ QFileInfoList QFSFileEngine::drives()
exit(1);
driveBits &= 0x3ffffff;
#endif
- char driveName[4];
-
- qstrcpy(driveName, "A:/");
+ char driveName[] = "A:/";
while(driveBits) {
if(driveBits & 1)
- ret.append(QString::fromLatin1(driveName).toUpper());
+ ret.append(QString::fromLatin1(driveName));
driveName[0]++;
driveBits = driveBits >> 1;
}
return ret;
#else
- ret.append(QString::fromLatin1("/").toUpper());
+ ret.append(QLatin1Char('/'));
return ret;
#endif
}
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 2ccc6ea..8924b77 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1745,7 +1745,7 @@ QDebug operator<<(QDebug debug, QIODevice::OpenMode modes)
}
qSort(modeList);
debug << modeList.join(QLatin1String("|"));
- debug << ")";
+ debug << ')';
return debug;
}
#endif
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 30f4291..afeaad6 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1586,7 +1586,7 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM
}
#if defined QPROCESS_DEBUG
- qDebug() << "QProcess::start(" << program << "," << arguments << "," << mode << ")";
+ qDebug() << "QProcess::start(" << program << ',' << arguments << ',' << mode << ')';
#endif
d->outputReadBuffer.clear();
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 5d862e5..179c3d0 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -272,12 +272,12 @@ static QString qt_create_commandline(const QString &program, const QStringList &
QString args;
if (!program.isEmpty()) {
QString programName = program;
- if (!programName.startsWith(QLatin1Char('\"')) && !programName.endsWith(QLatin1Char('\"')) && programName.contains(QLatin1String(" ")))
- programName = QLatin1String("\"") + programName + QLatin1String("\"");
- programName.replace(QLatin1String("/"), QLatin1String("\\"));
+ if (!programName.startsWith(QLatin1Char('\"')) && !programName.endsWith(QLatin1Char('\"')) && programName.contains(QLatin1Char(' ')))
+ programName = QLatin1Char('\"') + programName + QLatin1Char('\"');
+ programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
// add the prgram as the first arg ... it works better
- args = programName + QLatin1String(" ");
+ args = programName + QLatin1Char(' ');
}
for (int i=0; i<arguments.size(); ++i) {
@@ -285,16 +285,16 @@ static QString qt_create_commandline(const QString &program, const QStringList &
// in the case of \" already being in the string the \ must also be escaped
tmp.replace( QLatin1String("\\\""), QLatin1String("\\\\\"") );
// escape a single " because the arguments will be parsed
- tmp.replace( QLatin1String("\""), QLatin1String("\\\"") );
+ tmp.replace( QLatin1Char('\"'), QLatin1String("\\\"") );
if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) {
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
- QString endQuote(QLatin1String("\""));
+ QString endQuote(QLatin1Char('\"'));
int i = tmp.length();
while (i>0 && tmp.at(i-1) == QLatin1Char('\\')) {
--i;
- endQuote += QLatin1String("\\");
+ endQuote += QLatin1Char('\\');
}
args += QLatin1String(" \"") + tmp.left(i) + endQuote;
} else {
@@ -427,7 +427,7 @@ void QProcessPrivate::startProcess()
QString fullPathProgram = program;
if (!QDir::isAbsolutePath(fullPathProgram))
fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath();
- fullPathProgram.replace(QLatin1String("/"), QLatin1String("\\"));
+ fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
success = CreateProcessW((WCHAR*)fullPathProgram.utf16(),
(WCHAR*)args.utf16(),
0, 0, false, 0, 0, 0, 0, pid);
@@ -887,8 +887,8 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
#if defined(Q_OS_WINCE)
QString fullPathProgram = program;
if (!QDir::isAbsolutePath(fullPathProgram))
- fullPathProgram.prepend(QDir::currentPath().append(QLatin1String("/")));
- fullPathProgram.replace(QLatin1String("/"), QLatin1String("\\"));
+ fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/')));
+ fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
success = CreateProcessW((WCHAR*)fullPathProgram.utf16(),
(WCHAR*)args.utf16(),
0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo);
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 3b704f6..94dfd4d 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -623,14 +623,14 @@ int QResourceRoot::findNode(const QString &_path, const QLocale &locale) const
QString root = mappingRoot();
if(!root.isEmpty()) {
if(root == path) {
- path = QLatin1String("/");
+ path = QLatin1Char('/');
} else {
- if(!root.endsWith(QLatin1String("/")))
- root += QLatin1String("/");
+ if(!root.endsWith(QLatin1Char('/')))
+ root += QLatin1Char('/');
if(path.size() >= root.size() && path.startsWith(root))
path = path.mid(root.length()-1);
if(path.isEmpty())
- path = QLatin1String("/");
+ path = QLatin1Char('/');
}
}
}
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index a08c969..57f65d6 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -148,7 +148,7 @@ static QString errorCodeToString(DWORD errorCode)
if (data != 0)
LocalFree(data);
})
- if (result.endsWith(QLatin1String("\n")))
+ if (result.endsWith(QLatin1Char('\n')))
result.truncate(result.length() - 1);
return result;
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index b4d8a48..728bf4f 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -203,7 +203,7 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen)
if (QDir::isAbsolutePath(QString::fromLatin1(path)))
targetPath = QLatin1String(path);
else
- targetPath = QDir::currentPath().append(QLatin1String("/")) + QLatin1String(path);
+ targetPath = QDir::currentPath().append(QLatin1Char('/')) + QLatin1String(path);
if ((*doopen =
QT_OPEN(targetPath.toLocal8Bit(), O_CREAT|O_EXCL|O_RDWR
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 612d7f7..4563e84 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -2292,7 +2292,7 @@ bool QTextStreamPrivate::putNumber(qulonglong number, bool negative)
// ShowBase flag set zero should be written as '00'
if (number == 0 && base == 8 && numberFlags & QTextStream::ShowBase
&& result == QLatin1String("0")) {
- result.prepend(QLatin1String("0"));
+ result.prepend(QLatin1Char('0'));
}
}
return putString(result, true);
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index d1a5cdd..94a53f1 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -5698,7 +5698,7 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
// magic for drives on windows
if (deslashified.length() > 1 && deslashified.at(1) == QLatin1Char(':') && deslashified.at(0) != QLatin1Char('/')) {
- url.setPath(QLatin1String("/") + deslashified);
+ url.setPath(QLatin1Char('/') + deslashified);
// magic for shared drive on windows
} else if (deslashified.startsWith(QLatin1String("//"))) {
int indexOfPath = deslashified.indexOf(QLatin1Char('/'), 2);
@@ -5728,7 +5728,7 @@ QString QUrl::toLocalFile() const
// magic for shared drive on windows
if (!d->host.isEmpty()) {
tmp = QLatin1String("//") + d->host + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/')
- ? QLatin1String("/") + ourPath : ourPath);
+ ? QLatin1Char('/') + ourPath : ourPath);
} else {
tmp = ourPath;
// magic for drives on windows
@@ -5976,7 +5976,7 @@ QDataStream &operator>>(QDataStream &in, QUrl &url)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QUrl &url)
{
- d.maybeSpace() << "QUrl(" << url.toString() << ")";
+ d.maybeSpace() << "QUrl(" << url.toString() << ')';
return d.space();
}
#endif
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 9242092..e9c4a8d 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -223,7 +223,7 @@ public:
inline QT3_SUPPORT QString ref() const { return fragment(); }
inline QT3_SUPPORT void setRef(const QString &txt) { setFragment(txt); }
inline QT3_SUPPORT bool hasRef() const { return !fragment().isEmpty(); }
- inline QT3_SUPPORT void addPath(const QString &p) { setPath(path() + QLatin1String("/") + p); }
+ inline QT3_SUPPORT void addPath(const QString &p) { setPath(path() + QLatin1Char('/') + p); }
QT3_SUPPORT void setFileName(const QString &txt);
QT3_SUPPORT QString fileName() const;
QT3_SUPPORT QString dirPath() const;