diff options
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
| -rw-r--r-- | src/corelib/io/qdebug.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 645f27798c4..70a688e40ff 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -332,9 +332,14 @@ void QDebug::putByteArray(const char *begin, size_t length, Latin1Content conten if (stream->noQuotes) { // no quotes, write the string directly too (no pretty-printing) // this respects the QTextStream state, though - QString string = content == ContainsLatin1 ? QString::fromLatin1(begin, qsizetype(length)) - : QString::fromUtf8(begin, qsizetype(length)); - stream->ts.d_ptr->putString(string); + switch (content) { + case Latin1Content::ContainsLatin1: + stream->ts.d_ptr->putString(QLatin1StringView{begin, qsizetype(length)}); + break; + case Latin1Content::ContainsBinary: + stream->ts.d_ptr->putString(QUtf8StringView{begin, qsizetype(length)}); + break; + } } else { // we'll reset the QTextStream formatting mechanisms, so save the state QDebugStateSaver saver(*this); |
