Skip to content
Snippets Groups Projects
Commit b0da255a authored by hjk's avatar hjk
Browse files

Debugger: Restrict QTimeZone use to Qt >= 5.2


Change-Id: Iba786c265ddf7163fd7bb779d103065de3f83547
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent cfe84eaa
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#include <QDateTime> #include <QDateTime>
#include <QDebug> #include <QDebug>
#include <QHostAddress> #include <QHostAddress>
#if QT_VERSION >= 0x050200
#include <QTimeZone> #include <QTimeZone>
#endif
#include <ctype.h> #include <ctype.h>
...@@ -504,6 +506,7 @@ static QTime timeFromData(int ms) ...@@ -504,6 +506,7 @@ static QTime timeFromData(int ms)
return ms == -1 ? QTime() : QTime(0, 0, 0, 0).addMSecs(ms); return ms == -1 ? QTime() : QTime(0, 0, 0, 0).addMSecs(ms);
} }
#if QT_VERSION >= 0x050200
// Stolen and adapted from qdatetime.cpp // Stolen and adapted from qdatetime.cpp
static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time) static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time)
{ {
...@@ -550,6 +553,7 @@ static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time) ...@@ -550,6 +553,7 @@ static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time)
*date = (status & NullDate) ? QDate() : QDate::fromJulianDay(jd); *date = (status & NullDate) ? QDate() : QDate::fromJulianDay(jd);
*time = (status & NullTime) ? QTime() : QTime::fromMSecsSinceStartOfDay(ds); *time = (status & NullTime) ? QTime() : QTime::fromMSecsSinceStartOfDay(ds);
} }
#endif
QString decodeData(const QByteArray &ba, int encoding) QString decodeData(const QByteArray &ba, int encoding)
{ {
...@@ -678,6 +682,7 @@ QString decodeData(const QByteArray &ba, int encoding) ...@@ -678,6 +682,7 @@ QString decodeData(const QByteArray &ba, int encoding)
return QString::fromUtf8(decodedBa); return QString::fromUtf8(decodedBa);
} }
case DateTimeInternal: { // 29, DateTimeInternal: msecs, spec, offset, tz, status case DateTimeInternal: { // 29, DateTimeInternal: msecs, spec, offset, tz, status
#if QT_VERSION >= 0x050200
int p0 = ba.indexOf('/'); int p0 = ba.indexOf('/');
int p1 = ba.indexOf('/', p0 + 1); int p1 = ba.indexOf('/', p0 + 1);
int p2 = ba.indexOf('/', p1 + 1); int p2 = ba.indexOf('/', p1 + 1);
...@@ -708,6 +713,10 @@ QString decodeData(const QByteArray &ba, int encoding) ...@@ -708,6 +713,10 @@ QString decodeData(const QByteArray &ba, int encoding)
dateTime = QDateTime(date, time, spec); dateTime = QDateTime(date, time, spec);
} }
return dateTime.toString(); return dateTime.toString();
#else
// "Very plain".
return QString::fromLatin1(ba);
#endif
} }
} }
qDebug() << "ENCODING ERROR: " << encoding; qDebug() << "ENCODING ERROR: " << encoding;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment