summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-25 14:39:51 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-25 14:41:29 +0100
commitbce25a6340309938e06222663c2c7758bafab6e2 (patch)
tree1d36c82ff345a54abc23ea24904712650fd7cc86 /src/corelib
parent8a2f5445231fc871a9fd88dec5569deb3104983d (diff)
parent50aeedd86ce0244fbb77ebefdce8da72db881e45 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/gui/painting/qcoregraphics.mm src/gui/painting/qcoregraphics_p.h src/plugins/platforms/cocoa/qcocoahelpers.h src/plugins/platforms/cocoa/qcocoahelpers.mm Change-Id: Ibe5efcae73526b3d3931ed22730b13d372dcf54e
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/json/qjsonparser.cpp5
-rw-r--r--src/corelib/json/qjsonparser_p.h5
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp2
-rw-r--r--src/corelib/tools/qdatetime.cpp2
-rw-r--r--src/corelib/tools/qdatetimeparser_p.h84
5 files changed, 51 insertions, 47 deletions
diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp
index 0eb0d21ecf..39738b90a8 100644
--- a/src/corelib/json/qjsonparser.cpp
+++ b/src/corelib/json/qjsonparser.cpp
@@ -500,9 +500,10 @@ namespace {
memcpy(newValues, data, size*sizeof(QJsonPrivate::Value));
data = newValues;
} else {
- data = static_cast<QJsonPrivate::Value *>(realloc(data, alloc*sizeof(QJsonPrivate::Value)));
- if (!data)
+ void *newValues = realloc(data, alloc * sizeof(QJsonPrivate::Value));
+ if (!newValues)
return false;
+ data = static_cast<QJsonPrivate::Value *>(newValues);
}
return true;
}
diff --git a/src/corelib/json/qjsonparser_p.h b/src/corelib/json/qjsonparser_p.h
index afa2c1a8cf..379256847f 100644
--- a/src/corelib/json/qjsonparser_p.h
+++ b/src/corelib/json/qjsonparser_p.h
@@ -108,11 +108,12 @@ private:
inline int reserveSpace(int space) {
if (current + space >= dataLength) {
dataLength = 2*dataLength + space;
- data = (char *)realloc(data, dataLength);
- if (!data) {
+ char *newData = (char *)realloc(data, dataLength);
+ if (!newData) {
lastError = QJsonParseError::DocumentTooLarge;
return -1;
}
+ data = newData;
}
int pos = current;
current += space;
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index f786b2ae03..448e6117b1 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -264,7 +264,7 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent)
\code
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
- <mime-type type="application/vnd.nokia.qt.qmakeprofile">
+ <mime-type type="application/vnd.qt.qmakeprofile">
<comment xml:lang="en">Qt qmake Profile</comment>
<glob pattern="*.pro" weight="50"/>
</mime-type>
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index f784aa13fc..a642358770 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -3835,7 +3835,7 @@ QString QDateTime::toString(Qt::DateFormat format) const
\li the abbreviated localized day name (e.g. 'Mon' to 'Sun').
Uses the system locale to localize the name, i.e. QLocale::system().
\row \li dddd
- \li the long localized day name (e.g. 'Monday' to 'Qt::Sunday').
+ \li the long localized day name (e.g. 'Monday' to 'Sunday').
Uses the system locale to localize the name, i.e. QLocale::system().
\row \li M \li the month as number without a leading zero (1-12)
\row \li MM \li the month as number with a leading zero (01-12)
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index 6f381965a9..bc088a5f4c 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -104,14 +104,6 @@ public:
none.zeroesAdded = 0;
}
virtual ~QDateTimeParser() {}
- enum AmPmFinder {
- Neither = -1,
- AM = 0,
- PM = 1,
- PossibleAM = 2,
- PossiblePM = 3,
- PossibleBoth = 4
- };
enum Section {
NoSection = 0x00000,
@@ -187,33 +179,44 @@ public:
#ifndef QT_NO_DATESTRING
StateNode parse(QString &input, int &cursorPosition, const QDateTime &currentValue, bool fixup) const;
#endif
- int sectionMaxSize(int index) const;
- int sectionSize(int index) const;
- int sectionMaxSize(Section s, int count) const;
- int sectionPos(int index) const;
- int sectionPos(const SectionNode &sn) const;
-
- const SectionNode &sectionNode(int index) const;
- Section sectionType(int index) const;
- QString sectionText(int sectionIndex) const;
- QString sectionText(const QString &text, int sectionIndex, int index) const;
- int getDigit(const QDateTime &dt, int index) const;
- bool setDigit(QDateTime &t, int index, int newval) const;
- int parseSection(const QDateTime &currentValue, int sectionIndex, QString &txt, int &cursorPosition,
- int index, QDateTimeParser::State &state, int *used = 0) const;
- int absoluteMax(int index, const QDateTime &value = QDateTime()) const;
- int absoluteMin(int index) const;
bool parseFormat(const QString &format);
#ifndef QT_NO_DATESTRING
bool fromString(const QString &text, QDate *date, QTime *time) const;
#endif
+ enum FieldInfoFlag {
+ Numeric = 0x01,
+ FixedWidth = 0x02,
+ AllowPartial = 0x04,
+ Fraction = 0x08
+ };
+ Q_DECLARE_FLAGS(FieldInfo, FieldInfoFlag)
+
+ FieldInfo fieldInfo(int index) const;
+
+ void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; }
+ virtual QString displayText() const { return text; }
+
+private:
+ int sectionMaxSize(Section s, int count) const;
+ QString sectionText(const QString &text, int sectionIndex, int index) const;
+ int parseSection(const QDateTime &currentValue, int sectionIndex, QString &txt, int &cursorPosition,
+ int index, QDateTimeParser::State &state, int *used = 0) const;
#ifndef QT_NO_TEXTDATE
int findMonth(const QString &str1, int monthstart, int sectionIndex,
QString *monthName = 0, int *used = 0) const;
int findDay(const QString &str1, int intDaystart, int sectionIndex,
QString *dayName = 0, int *used = 0) const;
#endif
+
+ enum AmPmFinder {
+ Neither = -1,
+ AM = 0,
+ PM = 1,
+ PossibleAM = 2,
+ PossiblePM = 3,
+ PossibleBoth = 4
+ };
AmPmFinder findAmPm(QString &str, int index, int *used = 0) const;
bool potentialValue(const QStringRef &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const;
@@ -223,36 +226,37 @@ public:
return potentialValue(QStringRef(&str), min, max, index, currentValue, insert);
}
+protected: // for the benefit of QDateTimeEditPrivate
+ int sectionSize(int index) const;
+ int sectionMaxSize(int index) const;
+ int sectionPos(int index) const;
+ int sectionPos(const SectionNode &sn) const;
+
+ const SectionNode &sectionNode(int index) const;
+ Section sectionType(int index) const;
+ QString sectionText(int sectionIndex) const;
+ int getDigit(const QDateTime &dt, int index) const;
+ bool setDigit(QDateTime &t, int index, int newval) const;
+
+ int absoluteMax(int index, const QDateTime &value = QDateTime()) const;
+ int absoluteMin(int index) const;
+
bool skipToNextSection(int section, const QDateTime &current, const QStringRef &sectionText) const;
bool skipToNextSection(int section, const QDateTime &current, const QString &sectionText) const
{
return skipToNextSection(section, current, QStringRef(&sectionText));
}
-
QString stateName(State s) const;
-
- enum FieldInfoFlag {
- Numeric = 0x01,
- FixedWidth = 0x02,
- AllowPartial = 0x04,
- Fraction = 0x08
- };
- Q_DECLARE_FLAGS(FieldInfo, FieldInfoFlag)
-
- FieldInfo fieldInfo(int index) const;
-
- void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; }
virtual QDateTime getMinimum() const;
virtual QDateTime getMaximum() const;
virtual int cursorPosition() const { return -1; }
- virtual QString displayText() const { return text; }
virtual QString getAmPmText(AmPm ap, Case cs) const;
virtual QLocale locale() const { return defaultLocale; }
mutable int currentSectionIndex;
Sections display;
/*
- This stores the stores the most recently selected day.
+ This stores the most recently selected day.
It is useful when considering the following scenario:
1. Date is: 31/01/2000
@@ -272,9 +276,7 @@ public:
QString displayFormat;
QLocale defaultLocale;
QVariant::Type parserType;
-
bool fixday;
-
Qt::TimeSpec spec; // spec if used by QDateTimeEdit
Context context;
};