summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdatastream.cpp6
-rw-r--r--src/corelib/io/qfileselector.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm1
-rw-r--r--src/corelib/io/qfsfileengine.cpp27
-rw-r--r--src/corelib/io/qloggingcategory.cpp8
-rw-r--r--src/corelib/io/qloggingcategory.h7
-rw-r--r--src/corelib/io/qloggingregistry.cpp6
-rw-r--r--src/corelib/io/qprocess.cpp17
-rw-r--r--src/corelib/io/qsettings.cpp12
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp12
-rw-r--r--src/corelib/io/qstorageinfo_win.cpp2
11 files changed, 48 insertions, 54 deletions
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 5dd1e5e126..8d757a7773 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -133,7 +133,7 @@ QT_BEGIN_NAMESPACE
special requirements.
\target raw
- \section1 Reading and writing raw binary data
+ \section1 Reading and Writing Raw Binary Data
You may wish to read/write your own raw binary data to/from the
data stream directly. Data may be read from the stream into a
@@ -149,14 +149,14 @@ QT_BEGIN_NAMESPACE
data, followed by the data. Note that any encoding/decoding of
the data (apart from the length quint32) must be done by you.
- \section1 Reading and writing Qt collection classes
+ \section1 Reading and Writing Qt Collection Classes
The Qt container classes can also be serialized to a QDataStream.
These include QList, QLinkedList, QVector, QSet, QHash, and QMap.
The stream operators are declared as non-members of the classes.
\target Serializing Qt Classes
- \section1 Reading and writing other Qt classes.
+ \section1 Reading and Writing Other Qt Classes
In addition to the overloaded stream operators documented here,
any Qt classes that you might want to serialize to a QDataStream
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index c3c504c1aa..95fa970b2d 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -140,7 +140,7 @@ QFileSelectorPrivate::QFileSelectorPrivate()
deployment step as an optimization. As selectors come with a performance cost, it is
recommended to avoid their use in circumstances involving performance-critical code.
- \section1 Adding selectors
+ \section1 Adding Selectors
Selectors normally available are
\list
@@ -158,7 +158,7 @@ QFileSelectorPrivate::QFileSelectorPrivate()
future calls to select(). If the extra selectors list has been changed, calls to select() will
use the new list and may return differently.
- \section1 Conflict resolution when multiple selectors apply
+ \section1 Conflict Resolution when Multiple Selectors Apply
When multiple selectors could be applied to the same file, the first matching selector is chosen.
The order selectors are checked in are:
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm
index e713769735..eebca1cfb0 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.mm
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm
@@ -149,6 +149,7 @@ bool QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
}
if (dirChanged)
emit emitDirectoryChanged(info.origPath, false);
+ ++it;
}
return needsRestart;
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 674742fbf6..42250b629d 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -160,15 +160,9 @@ QFSFileEngine::~QFSFileEngine()
Q_D(QFSFileEngine);
if (d->closeFileHandle) {
if (d->fh) {
- int ret;
- do {
- ret = fclose(d->fh);
- } while (ret == EOF && errno == EINTR);
+ fclose(d->fh);
} else if (d->fd != -1) {
- int ret;
- do {
- ret = QT_CLOSE(d->fd);
- } while (ret == -1 && errno == EINTR);
+ QT_CLOSE(d->fd);
}
}
d->unmapAll();
@@ -365,15 +359,14 @@ bool QFSFileEnginePrivate::closeFdFh()
// Close the file if we created the handle.
if (closeFileHandle) {
int ret;
- do {
- if (fh) {
- // Close buffered file.
- ret = fclose(fh) != 0 ? -1 : 0;
- } else {
- // Close unbuffered file.
- ret = QT_CLOSE(fd);
- }
- } while (ret == -1 && errno == EINTR);
+
+ if (fh) {
+ // Close buffered file.
+ ret = fclose(fh);
+ } else {
+ // Close unbuffered file.
+ ret = QT_CLOSE(fd);
+ }
// We must reset these guys regardless; calling close again after a
// failed close causes crashes on some systems.
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 0b55f2376a..37503e032c 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -71,14 +71,14 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
boundaries, nor to manipulate the objects directly, nor to inherit from
QLoggingCategory.
- \section1 Creating category objects
+ \section1 Creating Category Objects
The Q_DECLARE_LOGGING_CATEGORY() and Q_LOGGING_CATEGORY() macros
conveniently declare and create QLoggingCategory objects:
\snippet qloggingcategory/main.cpp 1
- \section1 Checking category configuration
+ \section1 Checking Category Configuration
QLoggingCategory provides \l isDebugEnabled(), \l isWarningEnabled(),
\l isCriticalEnabled(), as well as \l isEnabled()
@@ -90,7 +90,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
\snippet qloggingcategory/main.cpp 4
- \section1 Default category configuration
+ \section1 Default Category Configuration
Both the QLoggingCategory constructor and the Q_LOGGING_CATEGORY() macro
accept an optional QtMsgType argument, which disables all message types with
@@ -172,7 +172,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
custom filter via \l installFilter(). All filter rules are ignored in this
case.
- \section1 Printing the category
+ \section1 Printing the Category
Use the \c %{category} place holder to print the category in the default
message handler:
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index cd3a7bf789..c7e242af08 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -110,15 +110,16 @@ private:
static const QLoggingCategory category(__VA_ARGS__); \
return category; \
}
+
#define qCDebug(category, ...) \
for (bool qt_category_enabled = category().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
+ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).debug(__VA_ARGS__)
#define qCWarning(category, ...) \
for (bool qt_category_enabled = category().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
+ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).warning(__VA_ARGS__)
#define qCCritical(category, ...) \
for (bool qt_category_enabled = category().isCriticalEnabled(); qt_category_enabled; qt_category_enabled = false) \
- QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__)
+ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).critical(__VA_ARGS__)
#else // defined(Q_COMPILER_VARIADIC_MACROS) || defined(Q_MOC_RUN)
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 4ee3068e27..e9ee8d9458 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -391,9 +391,9 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
Q_ASSERT(reg->categories.contains(cat));
QtMsgType enableForLevel = reg->categories.value(cat);
- bool debug = (enableForLevel == QtDebugMsg) ? true : false;
- bool warning = (enableForLevel <= QtWarningMsg) ? true : false;
- bool critical = (enableForLevel <= QtCriticalMsg) ? true : false;
+ bool debug = (enableForLevel == QtDebugMsg);
+ bool warning = (enableForLevel <= QtWarningMsg);
+ bool critical = (enableForLevel <= QtCriticalMsg);
// hard-wired implementation of
// qt.*.debug=false
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index ecb97ef3e9..e009191be9 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1659,11 +1659,10 @@ QProcess::ProcessState QProcess::state() const
/*!
\deprecated
- Sets the environment that QProcess will use when starting a process to the
- \a environment specified which consists of a list of key=value pairs.
+ Sets the environment that QProcess will pass to the child process.
+ The parameter \a environment is a list of key=value pairs.
- For example, the following code adds the \c{C:\\BIN} directory to the list of
- executable paths (\c{PATHS}) on Windows:
+ For example, the following code adds the environment variable \c{TMPDIR}:
\snippet qprocess-environment/main.cpp 0
@@ -1679,7 +1678,7 @@ void QProcess::setEnvironment(const QStringList &environment)
/*!
\deprecated
- Returns the environment that QProcess will use when starting a
+ Returns the environment that QProcess will pass to its child
process, or an empty QStringList if no environment has been set
using setEnvironment(). If no environment has been set, the
environment of the calling process will be used.
@@ -1697,11 +1696,9 @@ QStringList QProcess::environment() const
/*!
\since 4.6
- Sets the environment that QProcess will use when starting a process to the
- \a environment object.
+ Sets the \a environment that QProcess will pass to the child process.
- For example, the following code adds the \c{C:\\BIN} directory to the list of
- executable paths (\c{PATHS}) on Windows and sets \c{TMPDIR}:
+ For example, the following code adds the environment variable \c{TMPDIR}:
\snippet qprocess-environment/main.cpp 1
@@ -1717,7 +1714,7 @@ void QProcess::setProcessEnvironment(const QProcessEnvironment &environment)
/*!
\since 4.6
- Returns the environment that QProcess will use when starting a
+ Returns the environment that QProcess will pass to its child
process, or an empty object if no environment has been set using
setEnvironment() or setProcessEnvironment(). If no environment has
been set, the environment of the calling process will be used.
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 01a70720ee..f6cd5aa7c9 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -672,11 +672,11 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
}
}
-inline static void iniChopTrailingSpaces(QString &str)
+inline static void iniChopTrailingSpaces(QString &str, int limit)
{
int n = str.size() - 1;
QChar ch;
- while (n >= 0 && ((ch = str.at(n)) == QLatin1Char(' ') || ch == QLatin1Char('\t')))
+ while (n >= limit && ((ch = str.at(n)) == QLatin1Char(' ') || ch == QLatin1Char('\t')))
str.truncate(n--);
}
@@ -734,6 +734,7 @@ StSkipSpaces:
// fallthrough
StNormal:
+ int chopLimit = stringResult.length();
while (i < to) {
switch (str.at(i)) {
case '\\':
@@ -771,6 +772,7 @@ StNormal:
} else {
// the character is skipped
}
+ chopLimit = stringResult.length();
break;
case '"':
++i;
@@ -782,7 +784,7 @@ StNormal:
case ',':
if (!inQuotedString) {
if (!currentValueIsQuoted)
- iniChopTrailingSpaces(stringResult);
+ iniChopTrailingSpaces(stringResult, chopLimit);
if (!isStringList) {
isStringList = true;
stringListResult.clear();
@@ -822,6 +824,8 @@ StNormal:
}
}
}
+ if (!currentValueIsQuoted)
+ iniChopTrailingSpaces(stringResult, chopLimit);
goto end;
StHexEscape:
@@ -861,8 +865,6 @@ StOctEscape:
}
end:
- if (!currentValueIsQuoted)
- iniChopTrailingSpaces(stringResult);
if (isStringList)
stringListResult.append(stringResult);
return isStringList;
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index b22358ed27..481de6ee38 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -88,12 +88,12 @@ QT_BEGIN_NAMESPACE
static bool isPseudoFs(const QString &mountDir, const QByteArray &type)
{
- if (mountDir.startsWith(QStringLiteral("/dev"))
- || mountDir.startsWith(QStringLiteral("/proc"))
- || mountDir.startsWith(QStringLiteral("/run"))
- || mountDir.startsWith(QStringLiteral("/sys"))
- || mountDir.startsWith(QStringLiteral("/var/run"))
- || mountDir.startsWith(QStringLiteral("/var/lock"))) {
+ if (mountDir.startsWith(QLatin1String("/dev"))
+ || mountDir.startsWith(QLatin1String("/proc"))
+ || mountDir.startsWith(QLatin1String("/run"))
+ || mountDir.startsWith(QLatin1String("/sys"))
+ || mountDir.startsWith(QLatin1String("/var/run"))
+ || mountDir.startsWith(QLatin1String("/var/lock"))) {
return true;
}
#if defined(Q_OS_LINUX)
diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp
index aa970778e6..b0d3e7c6da 100644
--- a/src/corelib/io/qstorageinfo_win.cpp
+++ b/src/corelib/io/qstorageinfo_win.cpp
@@ -61,7 +61,7 @@ void QStorageInfoPrivate::initRootPath()
QString path = QDir::toNativeSeparators(rootPath);
rootPath.clear();
- if (path.startsWith(QStringLiteral("\\\\?\\")))
+ if (path.startsWith(QLatin1String("\\\\?\\")))
path.remove(0, 4);
if (path.length() < 2 || path.at(1) != QLatin1Char(':'))
return;