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:
parent
dc3659f70f
commit
f07a3e07d1
@ -1672,10 +1672,10 @@ QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong
|
|||||||
// Parse digits
|
// Parse digits
|
||||||
int ndigits = 0;
|
int ndigits = 0;
|
||||||
while (getChar(&dig)) {
|
while (getChar(&dig)) {
|
||||||
int n = dig.toLower().unicode();
|
char16_t n = dig.toLower().unicode();
|
||||||
if (n == '0' || n == '1') {
|
if (n == u'0' || n == u'1') {
|
||||||
val <<= 1;
|
val <<= 1;
|
||||||
val += n - '0';
|
val += n - u'0';
|
||||||
} else {
|
} else {
|
||||||
ungetChar(dig);
|
ungetChar(dig);
|
||||||
break;
|
break;
|
||||||
@ -1692,16 +1692,16 @@ QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong
|
|||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
QChar pf, dig;
|
QChar pf, dig;
|
||||||
// Parse prefix '0'
|
// Parse prefix u'0'
|
||||||
if (!getChar(&pf) || pf != u'0')
|
if (!getChar(&pf) || pf != u'0')
|
||||||
return npsInvalidPrefix;
|
return npsInvalidPrefix;
|
||||||
// Parse digits
|
// Parse digits
|
||||||
int ndigits = 0;
|
int ndigits = 0;
|
||||||
while (getChar(&dig)) {
|
while (getChar(&dig)) {
|
||||||
int n = dig.toLower().unicode();
|
char16_t n = dig.toLower().unicode();
|
||||||
if (isOctalDigit(n)) {
|
if (isOctalDigit(n)) {
|
||||||
val *= 8;
|
val *= 8;
|
||||||
val += n - '0';
|
val += n - u'0';
|
||||||
} else {
|
} else {
|
||||||
ungetChar(dig);
|
ungetChar(dig);
|
||||||
break;
|
break;
|
||||||
@ -1856,23 +1856,23 @@ bool QTextStreamPrivate::getReal(double *f)
|
|||||||
QChar c;
|
QChar c;
|
||||||
while (getChar(&c)) {
|
while (getChar(&c)) {
|
||||||
switch (c.unicode()) {
|
switch (c.unicode()) {
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case u'0': case u'1': case u'2': case u'3': case u'4':
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
case u'5': case u'6': case u'7': case u'8': case u'9':
|
||||||
input = InputDigit;
|
input = InputDigit;
|
||||||
break;
|
break;
|
||||||
case 'i': case 'I':
|
case u'i': case u'I':
|
||||||
input = InputI;
|
input = InputI;
|
||||||
break;
|
break;
|
||||||
case 'n': case 'N':
|
case u'n': case u'N':
|
||||||
input = InputN;
|
input = InputN;
|
||||||
break;
|
break;
|
||||||
case 'f': case 'F':
|
case u'f': case u'F':
|
||||||
input = InputF;
|
input = InputF;
|
||||||
break;
|
break;
|
||||||
case 'a': case 'A':
|
case u'a': case u'A':
|
||||||
input = InputA;
|
input = InputA;
|
||||||
break;
|
break;
|
||||||
case 't': case 'T':
|
case u't': case u'T':
|
||||||
input = InputT;
|
input = InputT;
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user