summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qsystemerror.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qsystemerror.cpp')
-rw-r--r--src/corelib/kernel/qsystemerror.cpp58
1 files changed, 33 insertions, 25 deletions
diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp
index eabb20001c..708eba89a6 100644
--- a/src/corelib/kernel/qsystemerror.cpp
+++ b/src/corelib/kernel/qsystemerror.cpp
@@ -46,6 +46,10 @@
# if defined(Q_CC_MSVC)
# include <crtdbg.h>
# endif
+#else
+# if (_WIN32_WCE >= 0x700)
+# include <errno.h>
+# endif
#endif
#ifdef Q_OS_WIN
#include <windows.h>
@@ -76,6 +80,27 @@ namespace {
}
#endif
+#ifdef Q_OS_WIN
+static QString windowsErrorString(int errorCode)
+{
+ QString ret;
+ wchar_t *string = 0;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ errorCode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPWSTR)&string,
+ 0,
+ NULL);
+ ret = QString::fromWCharArray(string);
+ LocalFree((HLOCAL)string);
+
+ if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
+ ret = QString::fromLatin1("The specified module could not be found.");
+ return ret;
+}
+#endif
+
static QString standardLibraryErrorString(int errorCode)
{
const char *s = 0;
@@ -96,11 +121,15 @@ static QString standardLibraryErrorString(int errorCode)
s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device");
break;
default: {
- #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
- QByteArray buf(1024, '\0');
- ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);
+ #ifdef Q_OS_WINCE
+ ret = windowsErrorString(errorCode);
#else
- ret = QString::fromLocal8Bit(strerror(errorCode));
+ #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
+ QByteArray buf(1024, '\0');
+ ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);
+ #else
+ ret = QString::fromLocal8Bit(strerror(errorCode));
+ #endif
#endif
break; }
}
@@ -112,27 +141,6 @@ static QString standardLibraryErrorString(int errorCode)
return ret.trimmed();
}
-#ifdef Q_OS_WIN
-static QString windowsErrorString(int errorCode)
-{
- QString ret;
- wchar_t *string = 0;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- errorCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR)&string,
- 0,
- NULL);
- ret = QString::fromWCharArray(string);
- LocalFree((HLOCAL)string);
-
- if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
- ret = QString::fromLatin1("The specified module could not be found.");
- return ret;
-}
-#endif
-
#ifdef Q_OS_SYMBIAN
static QString symbianErrorString(int errorCode)
{