diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 9 | ||||
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index bc39ea73ee..b82415cb26 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -82,12 +82,11 @@ static inline int openModeToOpenFlags(QIODevice::OpenMode mode) if (QFSFileEnginePrivate::openModeCanCreate(mode)) oflags |= QT_OPEN_CREAT; - if (mode & QFile::Append) { + if (mode & QFile::Truncate) + oflags |= QT_OPEN_TRUNC; + + if (mode & QFile::Append) oflags |= QT_OPEN_APPEND; - } else if (mode & QFile::WriteOnly) { - if ((mode & QFile::Truncate) || !(mode & QFile::ReadOnly)) - oflags |= QT_OPEN_TRUNC; - } if (mode & QFile::NewOnly) oflags |= QT_OPEN_EXCL; diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 95a5fb27cf..5dd5f8031e 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -312,8 +312,9 @@ QIODevicePrivate::~QIODevicePrivate() \value NotOpen The device is not open. \value ReadOnly The device is open for reading. - \value WriteOnly The device is open for writing. Note that this mode implies - Truncate. + \value WriteOnly The device is open for writing. Note that, for file-system + subclasses (e.g. QFile), this mode implies Truncate unless + combined with ReadOnly, Append or NewOnly. \value ReadWrite The device is open for reading and writing. \value Append The device is opened in append mode so that all data is written to the end of the file. |