Convert QTextStream internals to char16_t QChar::unicode()

Pick-to: 6.8
Change-Id: If11457fbc472b2bc2ff7b76f4456fc87dd0014e5
Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 908b814fcdf209d113951331cb274f9b0fc4a87a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2025-04-07 13:44:47 +02:00 committed by Qt Cherry-pick Bot
parent dc3659f70f
commit f07a3e07d1

View File

@ -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: {