Fix QString::toHtmlEscaped() for >2Gi character strings
More unfinished int → qsizetype porting. Fixes: QTBUG-105104 Pick-to: 6.4 6.3 6.2 Change-Id: I3470de31c476b3d7736661550916828e43546573 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
929bb153ee
commit
c1991c63fc
@ -10896,19 +10896,19 @@ qsizetype QtPrivate::count(QStringView haystack, const QRegularExpression &re)
|
||||
QString QString::toHtmlEscaped() const
|
||||
{
|
||||
QString rich;
|
||||
const int len = length();
|
||||
const qsizetype len = length();
|
||||
rich.reserve(qsizetype(len * 1.1));
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (at(i) == u'<')
|
||||
for (QChar ch : *this) {
|
||||
if (ch == u'<')
|
||||
rich += "<"_L1;
|
||||
else if (at(i) == u'>')
|
||||
else if (ch == u'>')
|
||||
rich += ">"_L1;
|
||||
else if (at(i) == u'&')
|
||||
else if (ch == u'&')
|
||||
rich += "&"_L1;
|
||||
else if (at(i) == u'"')
|
||||
else if (ch == u'"')
|
||||
rich += """_L1;
|
||||
else
|
||||
rich += at(i);
|
||||
rich += ch;
|
||||
}
|
||||
rich.squeeze();
|
||||
return rich;
|
||||
|
Loading…
Reference in New Issue
Block a user