diff options
author | Jędrzej Nowacki <jedrzej.nowacki@digia.com> | 2013-01-07 16:57:32 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-07 18:07:29 +0100 |
commit | ae2359d49e171c61450b17b1eb0e0dd7a20c7ca4 (patch) | |
tree | fbf5ef281002a47659d80405ae38f48b57e19c22 /src/corelib/tools | |
parent | 998899cf3a2501d3bf30ad06ce47a2cf81e1d60b (diff) | |
parent | cdf13ce286b14273e1e29c5bb02cbc880f31b786 (diff) |
Merge "Merge branch 'stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 12 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_win.cpp | 3 | ||||
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index f84644b37d..f4770b528c 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3533,6 +3533,18 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) This could have meant 1 January 00:30.00 but the M will grab two digits. + Incorrectly specified fields of the \a string will cause an invalid + QDateTime to be returned. For example, consider the following code, + where the two digit year 12 is read as 1912 (see the table below for all + field defaults); the resulting datetime is invalid because 23 April 1912 + was a Tuesday, not a Monday: + + \snippet code/src_corelib_tools_qdatetime.cpp 20 + + The correct code is: + + \snippet code/src_corelib_tools_qdatetime.cpp 21 + For any field that is not represented in the format, the following defaults are used: diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index ec9db24b57..a61f9b39fe 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -113,8 +113,6 @@ struct QSystemLocalePrivate void update(); private: - QByteArray langEnvVar; - enum SubstitutionType { SUnknown, SContext, @@ -142,7 +140,6 @@ Q_GLOBAL_STATIC(QSystemLocalePrivate, systemLocalePrivate) QSystemLocalePrivate::QSystemLocalePrivate() : substitutionType(SUnknown) { - langEnvVar = qgetenv("LANG"); lcid = GetUserDefaultLCID(); } diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 6393cc3970..2c8e03a5dd 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -813,6 +813,8 @@ template <class X, class T> Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src) { register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid + if (!ptr) + return QSharedPointer<X>(); return QtSharedPointer::copyAndSetPointer(ptr, src); } template <class X, class T> |