diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-29 22:14:53 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-07-18 15:51:25 +0000 |
commit | bf410ed529789f89a63af6a35bb06837b31b95a2 (patch) | |
tree | 27aaa3d4a13d556b2af9a998de3c5d5e5560913f /src/corelib/io/qfsfileengine.cpp | |
parent | f3205a49498d3084f46bc2c2abcd085c8436553b (diff) |
Convert improper uses of qt_error_string() to QSystemError::stdString()
On Windows, qt_error_string() returns the string corresponding to the
Win32 API, not an errno. Replace those uses for a function that works
for errno values.
Change-Id: I1eba2b016de74620bfc8fffd14ccce6162bafdca
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/io/qfsfileengine.cpp')
-rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 0b9cd0557f..88e8baedca 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -268,7 +268,7 @@ bool QFSFileEnginePrivate::openFh(QIODevice::OpenMode openMode, FILE *fh) if (ret != 0) { q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError, - qt_error_string(int(errno))); + QSystemError::stdString()); this->openMode = QIODevice::NotOpen; this->fh = 0; @@ -332,7 +332,7 @@ bool QFSFileEnginePrivate::openFd(QIODevice::OpenMode openMode, int fd) if (ret == -1) { q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError, - qt_error_string(int(errno))); + QSystemError::stdString()); this->openMode = QIODevice::NotOpen; this->fd = -1; @@ -391,7 +391,7 @@ bool QFSFileEnginePrivate::closeFdFh() if (!flushed || !closed) { if (flushed) { // If not flushed, we want the flush error to fall through. - q->setError(QFile::UnspecifiedError, qt_error_string(errno)); + q->setError(QFile::UnspecifiedError, QSystemError::stdString()); } return false; } @@ -443,7 +443,7 @@ bool QFSFileEnginePrivate::flushFh() if (ret != 0) { q->setError(errno == ENOSPC ? QFile::ResourceError : QFile::WriteError, - qt_error_string(errno)); + QSystemError::stdString()); return false; } return true; @@ -539,14 +539,14 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos) } while (ret != 0 && errno == EINTR); if (ret != 0) { - q->setError(QFile::ReadError, qt_error_string(int(errno))); + q->setError(QFile::ReadError, QSystemError::stdString()); return false; } } else { // Unbuffered stdio mode. if (QT_LSEEK(fd, QT_OFF_T(pos), SEEK_SET) == -1) { qWarning("QFile::at: Cannot set file position %lld", pos); - q->setError(QFile::PositionError, qt_error_string(errno)); + q->setError(QFile::PositionError, QSystemError::stdString()); return false; } } @@ -588,7 +588,7 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len) Q_Q(QFSFileEngine); if (len < 0 || len != qint64(size_t(len))) { - q->setError(QFile::ReadError, qt_error_string(EINVAL)); + q->setError(QFile::ReadError, QSystemError::stdString(EINVAL)); return -1; } @@ -634,7 +634,7 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len) if (!eof && readBytes == 0) { readBytes = -1; - q->setError(QFile::ReadError, qt_error_string(errno)); + q->setError(QFile::ReadError, QSystemError::stdString()); } return readBytes; @@ -680,7 +680,7 @@ qint64 QFSFileEnginePrivate::readLineFdFh(char *data, qint64 maxlen) // solves this. if (!fgets(data, int(maxlen + 1), fh)) { if (!feof(fh)) - q->setError(QFile::ReadError, qt_error_string(int(errno))); + q->setError(QFile::ReadError, QSystemError::stdString()); return -1; // error } @@ -719,7 +719,7 @@ qint64 QFSFileEnginePrivate::writeFdFh(const char *data, qint64 len) Q_Q(QFSFileEngine); if (len < 0 || len != qint64(size_t(len))) { - q->setError(QFile::WriteError, qt_error_string(EINVAL)); + q->setError(QFile::WriteError, QSystemError::stdString(EINVAL)); return -1; } @@ -756,7 +756,7 @@ qint64 QFSFileEnginePrivate::writeFdFh(const char *data, qint64 len) if (len && writtenBytes == 0) { writtenBytes = -1; - q->setError(errno == ENOSPC ? QFile::ResourceError : QFile::WriteError, qt_error_string(errno)); + q->setError(errno == ENOSPC ? QFile::ResourceError : QFile::WriteError, QSystemError::stdString()); } else { // reset the cached size, if any metaData.clearFlags(QFileSystemMetaData::SizeAttribute); |