From 908b814fcdf209d113951331cb274f9b0fc4a87a 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() Pick-to: 6.9 6.8 Change-Id: If11457fbc472b2bc2ff7b76f4456fc87dd0014e5 Reviewed-by: Rym Bouabid Reviewed-by: Thiago Macieira --- 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 1b40ff44d9e..0a95f5e05f8 100644 --- a/src/corelib/serialization/qtextstream.cpp +++ b/src/corelib/serialization/qtextstream.cpp @@ -1674,10 +1674,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; @@ -1694,16 +1694,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; @@ -1858,23 +1858,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: {