Implement qt_error_string for WinRT
Change-Id: I6049d67da0295aeec311b644ccedf8f27f86b1d1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>bb10
parent
f89d30aa34
commit
785eee0bf2
|
|
@ -2132,7 +2132,9 @@ QString qt_error_string(int errorCode)
|
|||
s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device");
|
||||
break;
|
||||
default: {
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN)
|
||||
// Retrieve the system error message for the last-error code.
|
||||
# ifndef Q_OS_WINRT
|
||||
wchar_t *string = 0;
|
||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
|
|
@ -2143,6 +2145,17 @@ QString qt_error_string(int errorCode)
|
|||
NULL);
|
||||
ret = QString::fromWCharArray(string);
|
||||
LocalFree((HLOCAL)string);
|
||||
# else // !Q_OS_WINRT
|
||||
__declspec(thread) static wchar_t errorString[4096];
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
errorCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
errorString,
|
||||
ARRAYSIZE(errorString),
|
||||
NULL);
|
||||
ret = QString::fromWCharArray(errorString);
|
||||
# endif // Q_OS_WINRT
|
||||
|
||||
if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
|
||||
ret = QString::fromLatin1("The specified module could not be found.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue