From eea6782ed6179c87ecc5860f1d46b2214d068160 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 7 Apr 2025 13:44:47 +0200 Subject: [PATCH] Convert QTextStream internals to char16_t QChar::unicode() Change-Id: If11457fbc472b2bc2ff7b76f4456fc87dd0014e5 Reviewed-by: Rym Bouabid Reviewed-by: Thiago Macieira (cherry picked from commit 908b814fcdf209d113951331cb274f9b0fc4a87a) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit f07a3e07d108650e3220d399f51f42fca086fd95) --- src/corelib/serialization/qtextstream.cpp | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/corelib/serialization/qtextstream.cpp b/src/corelib/serialization/qtextstream.cpp index 0dbbe04aadc..80212de3258 100644 --- a/src/corelib/serialization/qtextstream.cpp +++ b/src/corelib/serialization/qtextstream.cpp @@ -1672,10 +1672,10 @@ QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong // Parse digits int ndigits = 0; while (getChar(&dig)) { - int n = dig.toLower().unicode(); - if (n == '0' || n == '1') { + char16_t n = dig.toLower().unicode(); + if (n == u'0' || n == u'1') { val <<= 1; - val += n - '0'; + val += n - u'0'; } else { ungetChar(dig); break; @@ -1692,16 +1692,16 @@ QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong } case 8: { QChar pf, dig; - // Parse prefix '0' + // Parse prefix u'0' if (!getChar(&pf) || pf != u'0') return npsInvalidPrefix; // Parse digits int ndigits = 0; while (getChar(&dig)) { - int n = dig.toLower().unicode(); + char16_t n = dig.toLower().unicode(); if (isOctalDigit(n)) { val *= 8; - val += n - '0'; + val += n - u'0'; } else { ungetChar(dig); break; @@ -1856,23 +1856,23 @@ bool QTextStreamPrivate::getReal(double *f) QChar c; while (getChar(&c)) { switch (c.unicode()) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': + case u'0': case u'1': case u'2': case u'3': case u'4': + case u'5': case u'6': case u'7': case u'8': case u'9': input = InputDigit; break; - case 'i': case 'I': + case u'i': case u'I': input = InputI; break; - case 'n': case 'N': + case u'n': case u'N': input = InputN; break; - case 'f': case 'F': + case u'f': case u'F': input = InputF; break; - case 'a': case 'A': + case u'a': case u'A': input = InputA; break; - case 't': case 'T': + case u't': case u'T': input = InputT; break; default: {