Replace QString with QStringView and use qsizetype in QPdfEnginePrivate

Task-number: QTBUG-98763
Change-Id: Iab09d5a4d23215fd44e4b2cf4212688cd8f27a63
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Øystein Heskestad 2022-01-07 17:28:49 +01:00
parent 41f211d25f
commit 2a086a9857
2 changed files with 4 additions and 4 deletions

View File

@ -2182,7 +2182,7 @@ int QPdfEnginePrivate::addXrefEntry(int object, bool printostr)
return object;
}
void QPdfEnginePrivate::printString(const QString &string)
void QPdfEnginePrivate::printString(QStringView string)
{
if (string.isEmpty()) {
write("()");
@ -2193,9 +2193,9 @@ void QPdfEnginePrivate::printString(const QString &string)
// Unicode UTF-16 with a Unicode byte order mark as the first character
// (0xfeff), with the high-order byte first.
QByteArray array("(\xfe\xff");
const ushort *utf16 = string.utf16();
const char16_t *utf16 = string.utf16();
for (int i=0; i < string.size(); ++i) {
for (qsizetype i = 0; i < string.size(); ++i) {
char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)};
for(int j=0; j < 2; ++j) {
if (part[j] == '(' || part[j] == ')' || part[j] == '\\')

View File

@ -321,7 +321,7 @@ private:
void writePage();
int addXrefEntry(int object, bool printostr = true);
void printString(const QString &string);
void printString(QStringView string);
void xprintf(const char* fmt, ...);
inline void write(const QByteArray &data) {
stream->writeRawData(data.constData(), data.size());