diff options
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 88d4877be5..8da94c8624 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -525,6 +525,31 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value)); made private. In that case, no error would be reported, but your application would probably crash when you called a member function of \c{w}. + + \sa Q_DISABLE_COPY_MOVE, Q_DISABLE_MOVE +*/ + +/*! + \macro Q_DISABLE_MOVE(Class) + \relates QObject + + Disables the use of move constructors and move assignment operators + for the given \a Class. + + \sa Q_DISABLE_COPY, Q_DISABLE_COPY_MOVE + \since 5.13 +*/ + +/*! + \macro Q_DISABLE_COPY_MOVE(Class) + \relates QObject + + A convenience macro that disables the use of copy constructors, assignment + operators, move constructors and move assignment operators for the given + \a Class, combining Q_DISABLE_COPY and Q_DISABLE_MOVE. + + \sa Q_DISABLE_COPY, Q_DISABLE_MOVE + \since 5.13 */ /*! @@ -2142,11 +2167,20 @@ struct QUnixOSVersion static QString unquote(const char *begin, const char *end) { + // man os-release says: + // Variable assignment values must be enclosed in double + // or single quotes if they include spaces, semicolons or + // other special characters outside of A–Z, a–z, 0–9. Shell + // special characters ("$", quotes, backslash, backtick) + // must be escaped with backslashes, following shell style. + // All strings should be in UTF-8 format, and non-printable + // characters should not be used. It is not supported to + // concatenate multiple individually quoted strings. if (*begin == '"') { Q_ASSERT(end[-1] == '"'); - return QString::fromLatin1(begin + 1, end - begin - 2); + return QString::fromUtf8(begin + 1, end - begin - 2); } - return QString::fromLatin1(begin, end - begin); + return QString::fromUtf8(begin, end - begin); } static QByteArray getEtcFileContent(const char *filename) { @@ -3243,6 +3277,34 @@ void *qMemSet(void *dest, int c, size_t n) { return memset(dest, c, n); } // add thread-safety for the Qt wrappers. static QBasicMutex environmentMutex; +/* + Wraps tzset(), which accesses the environment, so should only be called while + we hold the lock on the environment mutex. +*/ +void qTzSet() +{ + QMutexLocker locker(&environmentMutex); +#if defined(Q_OS_WIN) + _tzset(); +#else + tzset(); +#endif // Q_OS_WIN +} + +/* + Wrap mktime(), which is specified to behave as if it called tzset(), hence + shares its implicit environment-dependence. +*/ +time_t qMkTime(struct tm *when) +{ + QMutexLocker locker(&environmentMutex); + return mktime(when); +} + +// Also specified to behave as if they call tzset(): +// localtime() -- but not localtime_r(), which we use when threaded +// strftime() -- not used (except in tests) + /*! \relates <QtGlobal> \threadsafe |