From baf5eed1ef5a71cdcf4ee56cb3e9c9eaa45ea60b Mon Sep 17 00:00:00 2001 From: Daniel Seither Date: Tue, 4 Feb 2014 12:36:27 +0100 Subject: QDateTime: Fix sign handling in the timezone offset parser Previously, parsing negative timezone offsets with minutes != 00 produced wrong results. Examples (in -> out) -00:15 -> +00:15 -01:15 -> -00:45 Change-Id: I6fa30810a08bdf2996365661720b2e362e8aeb93 Reviewed-by: Thiago Macieira Reviewed-by: John Layt --- src/corelib/tools/qdatetime.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index e38a5f569a..280d516452 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -265,17 +265,24 @@ static int fromOffsetString(const QString &offsetString, bool *valid) if (size < 2 || size > 6) return 0; + // sign will be +1 for a positive and -1 for a negative offset + int sign; + // First char must be + or - - const QChar sign = offsetString.at(0); - if (sign != QLatin1Char('+') && sign != QLatin1Char('-')) + const QChar signChar = offsetString.at(0); + if (signChar == QLatin1Char('+')) + sign = 1; + else if (signChar == QLatin1Char('-')) + sign = -1; + else return 0; // Split the hour and minute parts - QStringList parts = offsetString.split(QLatin1Char(':')); + QStringList parts = offsetString.mid(1).split(QLatin1Char(':')); if (parts.count() == 1) { // [+-]HHMM format - parts.append(parts.at(0).mid(3)); - parts[0] = parts.at(0).left(3); + parts.append(parts.at(0).mid(2)); + parts[0] = parts.at(0).left(2); } bool ok = false; @@ -288,7 +295,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid) return 0; *valid = true; - return ((hour * 60) + minute) * 60; + return sign * ((hour * 60) + minute) * 60; } /***************************************************************************** -- cgit v1.2.3 From ac109e1316750175100cafc7f486b0c8ff03f716 Mon Sep 17 00:00:00 2001 From: Daniel Seither Date: Tue, 4 Feb 2014 12:39:17 +0100 Subject: QDateTime: Fix sign handling in the timezone offset writer Previously, this produced wrong results, for example -3:30 became -3:-30. Change-Id: I10efdfb48e5542b917c86b29cf8a99bfc26f7fe0 Reviewed-by: John Layt Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 280d516452..801876629c 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -253,7 +253,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) return result.arg(offset >= 0 ? QLatin1Char('+') : QLatin1Char('-')) .arg(qAbs(offset) / SECS_PER_HOUR, 2, 10, QLatin1Char('0')) - .arg((offset / 60) % 60, 2, 10, QLatin1Char('0')); + .arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0')); } // Parse offset in [+-]HH[:]MM format -- cgit v1.2.3 From f2a40fa07123748ece2fc93790345379f15ef07f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 14 Apr 2014 15:31:06 -0700 Subject: Don't assume QLocale::codecForLocale always returns non-null It may return null during program exit, due to QCoreGlobalData global static already having been destroyed. If that's the case, QTextStream needs to fall back to Latin 1, like QString::toLocal8Bit and fromLocal8Bit already do. Task-number: QTBUG-38316 Change-Id: I5949c8dec15b60f4a13b5d9307ed6abfc799fe20 Reviewed-by: Olivier Goffart --- src/corelib/io/qtextstream.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 163b087436..288a939ab2 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -569,7 +569,9 @@ void QTextStreamPrivate::flushWriteBuffer() #endif // convert from unicode to raw data - QByteArray data = codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState); + // codec might be null if we're already inside global destructors (QTestCodec::codecForLocale returned null) + QByteArray data = Q_LIKELY(codec) ? codec->fromUnicode(writeBuffer.data(), writeBuffer.size(), &writeConverterState) + : writeBuffer.toLatin1(); #else QByteArray data = writeBuffer.toLocal8Bit(); #endif -- cgit v1.2.3 From 0a0cc6afc8be1ab38367ad803a303f35f29ed5de Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 10 Apr 2014 11:07:46 -0700 Subject: Doc: change the name of the QTemporaryDir parameter name Make it very clear that this is a path, so it's relative to the working dir, not relative to tempPath(). Task-number: QTBUG-38266 Change-Id: Ib7ca8df76b5a03c1631fe00d6b329d86538d4b5a Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qtemporarydir.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 2c526847b4..1e615956d7 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -218,25 +218,25 @@ QTemporaryDir::QTemporaryDir() } /*! - Constructs a QTemporaryFile with a template name of \a templateName. + Constructs a QTemporaryDir with a template of \a templatePath. - If \a templateName is a relative path, the path will be relative to the + If \a templatePath is a relative path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct \a - templateName if you want use the system's temporary directory. + templatePath if you want use the system's temporary directory. - If the \a templateName ends with XXXXXX it will be used as the dynamic portion + If the \a templatePath ends with XXXXXX it will be used as the dynamic portion of the directory name, otherwise it will be appended. Unlike QTemporaryFile, XXXXXX in the middle of the template string is not supported. \sa QDir::tempPath() */ -QTemporaryDir::QTemporaryDir(const QString &templateName) +QTemporaryDir::QTemporaryDir(const QString &templatePath) : d_ptr(new QTemporaryDirPrivate) { - if (templateName.isEmpty()) + if (templatePath.isEmpty()) d_ptr->create(defaultTemplateName()); else - d_ptr->create(templateName); + d_ptr->create(templatePath); } /*! -- cgit v1.2.3 From d075df993c078478e2eb8ff909dfe63ae1b2a6d7 Mon Sep 17 00:00:00 2001 From: Nedim Hadzic Date: Tue, 29 Apr 2014 12:27:20 +0200 Subject: QPpsObject compile added for QNX platform QPpsObject was only compiled for BlackBerry and not for QNX. Now, QNX platform is included together with lpps lib. Change-Id: Ib521664b430b202c0e67987d0bfda8373d2be70e Reviewed-by: Bernd Weimer Reviewed-by: Rafael Roquetto --- src/corelib/kernel/kernel.pri | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 1fec528b31..819c10e99f 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -164,11 +164,17 @@ vxworks { blackberry { SOURCES += \ - kernel/qeventdispatcher_blackberry.cpp \ + kernel/qeventdispatcher_blackberry.cpp + HEADERS += \ + kernel/qeventdispatcher_blackberry_p.h +} + +qqnx_pps { + LIBS_PRIVATE += -lpps + SOURCES += \ kernel/qppsattribute.cpp \ kernel/qppsobject.cpp HEADERS += \ - kernel/qeventdispatcher_blackberry_p.h \ kernel/qppsattribute_p.h \ kernel/qppsattributeprivate_p.h \ kernel/qppsobject_p.h \ -- cgit v1.2.3