summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdebug.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2025-07-17 08:31:43 +0200
committerMarc Mutz <marc.mutz@qt.io>2025-07-19 07:54:24 +0200
commita9f252cc44127d1dfcd71ea851b0a4095873b7f9 (patch)
tree8a10efa852d9bf82f96ad5421a7ddbf50d046f01 /src/corelib/io/qdebug.cpp
parent5fca6c51ce91c98ebe4da14838a1651e40a7d904 (diff)
Prefer QTextStreamPrivate::write(QStringView) over (ptr, n) [2/2]: rest
Replace the remaining calls to write(const QChar *, qsizetype) with calls that use QStringView. Requires adapting a QChar[2] (not null-terminate, and QStringView constructor scan for one). Chose to make it a char16_t literal instead, and make it constexpr as a drive-by. This removes the last caller of the write(p, n) overload, so remove it. Task-number: QTBUG-138520 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Iddfadc7cd7837a541e5840247f8812398807bcfe Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
-rw-r--r--src/corelib/io/qdebug.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 4065853d658..501b6e7a946 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -199,7 +199,8 @@ static inline bool isPrintable(uchar c)
template <typename Char>
static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, size_t length, bool isUnicode = true)
{
- QChar quote(u'"');
+ constexpr char16_t quotes[] = uR"("")";
+ constexpr char16_t quote = quotes[0];
d->write(quote);
bool lastWasHexEscape = false;
@@ -209,8 +210,7 @@ static inline void putEscapedString(QTextStreamPrivate *d, const Char *begin, si
if (Q_UNLIKELY(lastWasHexEscape)) {
if (fromHex(*p) != -1) {
// yes, insert it
- QChar quotes[] = { quote, quote };
- d->write(quotes, 2);
+ d->write(quotes);
}
lastWasHexEscape = false;
}