summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-07 15:18:16 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-01-07 15:18:16 +0100
commitcdf13ce286b14273e1e29c5bb02cbc880f31b786 (patch)
tree10733cb3fb35647b19cfd15ab158f56b1cb550e1 /src/corelib/tools
parent21d607c81af0cd285e9bb3869ac3cd18358f1c8f (diff)
parenta8321f21fb82714771b4717c99dd475f2c74649e (diff)
Merge branch 'stable' into dev
Conflicts: tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp Change-Id: I6b8d505fc22f052c307ca27f58f7d16f98965f47
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qdatetime.cpp12
-rw-r--r--src/corelib/tools/qlocale_win.cpp3
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h2
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>