diff options
| author | Marc Mutz <marc.mutz@kdab.com> | 2017-03-31 12:49:12 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@kdab.com> | 2017-04-06 12:06:26 +0000 |
| commit | 6f4160042226be86276fa9264663c2942413fc8d (patch) | |
| tree | ba55396301a88cb4897a8e50a4bb356cc339e9c2 /src/corelib/xml/qxmlstream.cpp | |
| parent | e1e6506c8dec6d0fc0fdbb15cfde43e7c0277403 (diff) | |
Port internal class QXmlUtils to QStringView
... and adapt callers.
In one case, port a use of QString::toLatin1() to QStringRef::
toLatin1() so together with this change and the addition of
QString::arg(QStringView) we can drop one more QStringRef::toString().
Change-Id: Iba898af8cc2a9e1a811e271789359395f595ad32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/xml/qxmlstream.cpp')
| -rw-r--r-- | src/corelib/xml/qxmlstream.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index ecca5569f8a..3d600c23806 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -1798,18 +1798,17 @@ void QXmlStreamReaderPrivate::startDocument() QStringRef value(symString(attrib.value)); if (prefix.isEmpty() && key == QLatin1String("encoding")) { - const QString name(value.toString()); documentEncoding = value; if(hasStandalone) err = QXmlStream::tr("The standalone pseudo attribute must appear after the encoding."); - if(!QXmlUtils::isEncName(name)) + if (!QXmlUtils::isEncName(value)) err = QXmlStream::tr("%1 is an invalid encoding name.").arg(value); else { #ifdef QT_NO_TEXTCODEC readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread); #else - QTextCodec *const newCodec = QTextCodec::codecForName(name.toLatin1()); + QTextCodec *const newCodec = QTextCodec::codecForName(value.toLatin1()); if (!newCodec) err = QXmlStream::tr("Encoding %1 is unsupported").arg(value); else if (newCodec != codec && !lockEncoding) { |
