summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.cpp92
-rw-r--r--src/corelib/global/qsystemdetection.h18
2 files changed, 18 insertions, 92 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 0e99daeb56..bfd97ed007 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -3148,98 +3148,6 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n)
void *qMemCopy(void *dest, const void *src, size_t n) { return memcpy(dest, src, n); }
void *qMemSet(void *dest, int c, size_t n) { return memset(dest, c, n); }
-#if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
- defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L
-namespace {
- // There are two incompatible versions of strerror_r:
- // a) the XSI/POSIX.1 version, which returns an int,
- // indicating success or not
- // b) the GNU version, which returns a char*, which may or may not
- // be the beginning of the buffer we used
- // The GNU libc manpage for strerror_r says you should use the XSI
- // version in portable code. However, it's impossible to do that if
- // _GNU_SOURCE is defined so we use C++ overloading to decide what to do
- // depending on the return type
- static inline Q_DECL_UNUSED QString fromstrerror_helper(int, const QByteArray &buf)
- {
- return QString::fromLocal8Bit(buf.constData());
- }
- static inline Q_DECL_UNUSED QString fromstrerror_helper(const char *str, const QByteArray &)
- {
- return QString::fromLocal8Bit(str);
- }
-}
-#endif
-
-QString qt_error_string(int errorCode)
-{
- const char *s = 0;
- QString ret;
- if (errorCode == -1) {
-#if defined(Q_OS_WIN)
- errorCode = GetLastError();
-#else
- errorCode = errno;
-#endif
- }
- switch (errorCode) {
- case 0:
- break;
- case EACCES:
- s = QT_TRANSLATE_NOOP("QIODevice", "Permission denied");
- break;
- case EMFILE:
- s = QT_TRANSLATE_NOOP("QIODevice", "Too many open files");
- break;
- case ENOENT:
- s = QT_TRANSLATE_NOOP("QIODevice", "No such file or directory");
- break;
- case ENOSPC:
- s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device");
- break;
- default: {
-#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_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,
- NULL,
- errorCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPWSTR)&string,
- 0,
- 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.");
-#elif !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
- break; }
- }
- if (s)
- // ######## this breaks moc build currently
-// ret = QCoreApplication::translate("QIODevice", s);
- ret = QString::fromLatin1(s);
- return ret.trimmed();
-}
-
// In the C runtime on all platforms access to the environment is not thread-safe. We
// add thread-safety for the Qt wrappers.
static QBasicMutex environmentMutex;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 3133b4a719..4a2c3f79bb 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -267,6 +267,9 @@
# if !defined(__MAC_10_12)
# define __MAC_10_12 101200
# endif
+# if !defined(__MAC_10_13)
+# define __MAC_10_13 101300
+# endif
# if !defined(MAC_OS_X_VERSION_10_7)
# define MAC_OS_X_VERSION_10_7 1070
# endif
@@ -285,6 +288,9 @@
# if !defined(MAC_OS_X_VERSION_10_12)
# define MAC_OS_X_VERSION_10_12 101200
# endif
+# if !defined(MAC_OS_X_VERSION_10_13)
+# define MAC_OS_X_VERSION_10_13 101300
+# endif
#
# if !defined(__IPHONE_4_3)
# define __IPHONE_4_3 40300
@@ -337,6 +343,18 @@
# if !defined(__IPHONE_10_0)
# define __IPHONE_10_0 100000
# endif
+# if !defined(__IPHONE_10_1)
+# define __IPHONE_10_1 100100
+# endif
+# if !defined(__IPHONE_10_2)
+# define __IPHONE_10_2 100200
+# endif
+# if !defined(__IPHONE_10_3)
+# define __IPHONE_10_3 100300
+# endif
+# if !defined(__IPHONE_11_0)
+# define __IPHONE_11_0 110000
+# endif
#endif
#ifdef __LSB_VERSION__