diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index 3323ff0707..5e3e07f6ee 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -1020,7 +1020,7 @@ bool QXmlStreamReaderPrivate::scanString(const char *str, short tokenToInject, b } textBuffer += QLatin1StringView(str, n); if (requireSpace) { - int s = fastScanSpace(); + const qsizetype s = fastScanSpace(); if (!s || atEnd) { qsizetype pos = textBuffer.size() - n - s; putString(textBuffer, pos); @@ -1132,9 +1132,9 @@ bool QXmlStreamReaderPrivate::scanAttType() encountered. */ -inline int QXmlStreamReaderPrivate::fastScanLiteralContent() +inline qsizetype QXmlStreamReaderPrivate::fastScanLiteralContent() { - int n = 0; + qsizetype n = 0; uint c; while ((c = getChar()) != StreamEOF) { switch (ushort(c)) { @@ -1182,9 +1182,9 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent() return n; } -inline int QXmlStreamReaderPrivate::fastScanSpace() +inline qsizetype QXmlStreamReaderPrivate::fastScanSpace() { - int n = 0; + qsizetype n = 0; uint c; while ((c = getChar()) != StreamEOF) { switch (c) { @@ -1215,9 +1215,9 @@ inline int QXmlStreamReaderPrivate::fastScanSpace() Used for text nodes essentially. That is, characters appearing inside elements. */ -inline int QXmlStreamReaderPrivate::fastScanContentCharList() +inline qsizetype QXmlStreamReaderPrivate::fastScanContentCharList() { - int n = 0; + qsizetype n = 0; uint c; while ((c = getChar()) != StreamEOF) { switch (ushort(c)) { @@ -1279,9 +1279,9 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList() return n; } -inline int QXmlStreamReaderPrivate::fastScanName(qint16 *prefix) +inline qsizetype QXmlStreamReaderPrivate::fastScanName(qint16 *prefix) { - int n = 0; + qsizetype n = 0; uint c; while ((c = getChar()) != StreamEOF) { if (n >= 4096) { @@ -1400,9 +1400,9 @@ static inline NameChar fastDetermineNameChar(QChar ch) return NotName; } -inline int QXmlStreamReaderPrivate::fastScanNMTOKEN() +inline qsizetype QXmlStreamReaderPrivate::fastScanNMTOKEN() { - int n = 0; + qsizetype n = 0; uint c; while ((c = getChar()) != StreamEOF) { if (fastDetermineNameChar(QChar(c)) == NotName) { diff --git a/src/corelib/serialization/qxmlstream.g b/src/corelib/serialization/qxmlstream.g index db9be6d8ac..201e06ba20 100644 --- a/src/corelib/serialization/qxmlstream.g +++ b/src/corelib/serialization/qxmlstream.g @@ -1217,9 +1217,9 @@ attribute ::= qname space_opt EQ space_opt attribute_value; if (normalize) { // normalize attribute value (simplify and trim) const qsizetype pos = textBuffer.size(); - int n = 0; + qsizetype n = 0; bool wasSpace = true; - for (int i = 0; i < attribute.value.len; ++i) { + for (qsizetype i = 0; i < attribute.value.len; ++i) { QChar c = textBuffer.at(attribute.value.pos + i); if (c.unicode() == ' ') { if (wasSpace) diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h index 4897735796..56a40885bb 100644 --- a/src/corelib/serialization/qxmlstream_p.h +++ b/src/corelib/serialization/qxmlstream_p.h @@ -410,7 +410,7 @@ public: int stack_size; struct Value { qsizetype pos; // offset into textBuffer - int len; + qsizetype len; // length incl. prefix (if any) qint16 prefix; // prefix of a name (as in "prefix:name") limited to 4k in fastScanName() ushort c; }; @@ -504,11 +504,11 @@ public: // scan optimization functions. Not strictly necessary but LALR is // not very well suited for scanning fast - int fastScanLiteralContent(); - int fastScanSpace(); - int fastScanContentCharList(); - int fastScanName(qint16 *prefix = nullptr); - inline int fastScanNMTOKEN(); + qsizetype fastScanLiteralContent(); + qsizetype fastScanSpace(); + qsizetype fastScanContentCharList(); + qsizetype fastScanName(qint16 *prefix = nullptr); + inline qsizetype fastScanNMTOKEN(); bool parse(); diff --git a/src/corelib/serialization/qxmlstreamparser_p.h b/src/corelib/serialization/qxmlstreamparser_p.h index de8cfcbd23..b72ab34bea 100644 --- a/src/corelib/serialization/qxmlstreamparser_p.h +++ b/src/corelib/serialization/qxmlstreamparser_p.h @@ -780,9 +780,9 @@ bool QXmlStreamReaderPrivate::parse() if (normalize) { // normalize attribute value (simplify and trim) const qsizetype pos = textBuffer.size(); - int n = 0; + qsizetype n = 0; bool wasSpace = true; - for (int i = 0; i < attribute.value.len; ++i) { + for (qsizetype i = 0; i < attribute.value.len; ++i) { QChar c = textBuffer.at(attribute.value.pos + i); if (c.unicode() == ' ') { if (wasSpace)