43 #if defined(Q_CC_MSVC)
49 #ifndef QT_BOOTSTRAPPED
55 #if !defined(Q_OS_WIN) && QT_CONFIG(thread) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
56 defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L
79 static QString windowsErrorString(
int errorCode)
82 wchar_t *
string =
nullptr;
83 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
86 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
91 LocalFree((HLOCAL)
string);
93 if (
ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
104 static QString standardLibraryErrorString(
int errorCode)
106 const char *
s =
nullptr;
112 s = QT_TRANSLATE_NOOP(
"QIODevice",
"Permission denied");
115 s = QT_TRANSLATE_NOOP(
"QIODevice",
"Too many open files");
118 s = QT_TRANSLATE_NOOP(
"QIODevice",
"No such file or directory");
121 s = QT_TRANSLATE_NOOP(
"QIODevice",
"No space left on device");
124 #if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
126 ret = fromstrerror_helper(strerror_r(errorCode,
buf.data(),
buf.size()),
buf);
133 #ifndef QT_BOOTSTRAPPED
139 return ret.trimmed();
146 #if defined(Q_OS_WIN)
150 return standardLibraryErrorString(
errorCode);
165 QString QSystemError::windowsString(
int errorCode)
172 return windowsErrorString(
code == -1 ? GetLastError() :
code);
177 return standardLibraryErrorString(
code == -1 ? errno :
code);
The QByteArray class provides an array of bytes.
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
The QString class provides a Unicode character string.
static QString fromLatin1(QByteArrayView ba)
static QString fromLocal8Bit(QByteArrayView ba)
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=QLatin1Char(' ')) const
static Q_CORE_EXPORT QString stdString(int errorCode=-1)
static Q_CORE_EXPORT QString string(ErrorScope errorScope, int errorCode)
constexpr Initialization Uninitialized
GLenum GLuint GLenum GLsizei const GLchar * buf
QString qt_error_string(int code)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.