diff options
Diffstat (limited to 'src/corelib/io/qfile.cpp')
-rw-r--r-- | src/corelib/io/qfile.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 5e1a5e7..026c1fd 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -52,10 +52,6 @@ # include "qcoreapplication.h" #endif -#if !defined(Q_OS_WINCE) -#include <errno.h> -#endif - #ifdef QT_NO_QOBJECT #define tr(X) QString::fromLatin1(X) #endif @@ -653,11 +649,7 @@ QFile::remove() unsetError(); return true; } -#if defined(Q_OS_WIN) - d->setError(QFile::RemoveError, GetLastError()); -#else - d->setError(QFile::RemoveError, errno); -#endif + d->setError(QFile::RemoveError, fileEngine()->errorString()); } return false; } @@ -812,7 +804,7 @@ QFile::link(const QString &linkName) unsetError(); return true; } - d->setError(QFile::RenameError, errno); + d->setError(QFile::RenameError, fileEngine()->errorString()); return false; } @@ -1258,7 +1250,7 @@ QFile::resize(qint64 sz) unsetError(); return true; } - d->setError(QFile::ResizeError, errno); + d->setError(QFile::ResizeError, fileEngine()->errorString()); return false; } @@ -1322,7 +1314,7 @@ QFile::setPermissions(Permissions permissions) unsetError(); return true; } - d->setError(QFile::PermissionsError, errno); + d->setError(QFile::PermissionsError, fileEngine()->errorString()); return false; } @@ -1478,7 +1470,7 @@ bool QFile::seek(qint64 off) d->setError(err, fileEngine()->errorString()); return false; } - d->error = NoError; + unsetError(); return true; } @@ -1506,7 +1498,7 @@ qint64 QFile::readLineData(char *data, qint64 maxlen) qint64 QFile::readData(char *data, qint64 len) { Q_D(QFile); - d->error = NoError; + unsetError(); if (!d->ensureFlushed()) return -1; @@ -1588,7 +1580,7 @@ qint64 QFile::writeData(const char *data, qint64 len) { Q_D(QFile); - d->error = NoError; + unsetError(); d->lastWasWrite = true; bool buffered = !(d->openMode & Unbuffered); |