From 5a15545ee274a9caa33014755a3fdb7022c7ea8c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 8 Jun 2016 10:01:51 +0200 Subject: QDebug: fix streaming of QChars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 9ef3ff30 introduced a new function, putUcs4(), to output QChar, char16_t, char32_t as a, possibly escaped, character literal, but got the order of stream modifiers wrong. Instead of applying the field width to the 'ucs' streaming, it applied it to the prefix '\u'. The same problem exists for the pad char, leading to the result '00\ue4' for a QChar containing ä (LATIN SMALL LETTER A WITH DIAERESIS) Fix by reordering the elements streamed so that the prefixes come last. Added a test. Change-Id: I6eaa0586501b9e780aaa3bb5dcec0e5c2f86a219 Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 81af96b96b..a1d7d9806d 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -160,16 +160,15 @@ void QDebug::putUcs4(uint ucs4) { maybeQuote('\''); if (ucs4 < 0x20) { - stream->ts << hex << "\\x" << ucs4 << reset; + stream->ts << "\\x" << hex << ucs4 << reset; } else if (ucs4 < 0x80) { stream->ts << char(ucs4); } else { - stream->ts << hex << qSetPadChar(QLatin1Char('0')); if (ucs4 < 0x10000) - stream->ts << qSetFieldWidth(4) << "\\u"; + stream->ts << "\\u" << qSetFieldWidth(4); else - stream->ts << qSetFieldWidth(8) << "\\U"; - stream->ts << ucs4 << reset; + stream->ts << "\\U" << qSetFieldWidth(8); + stream->ts << hex << qSetPadChar(QLatin1Char('0')) << ucs4 << reset; } maybeQuote('\''); } -- cgit v1.2.3 From ea86f736404bab170ebfd75af6ee0f594e10f0f7 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 8 Jun 2016 16:14:04 +0200 Subject: Mention extension in QFileInfo's suffix-related documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it easier for users to find out how to get a file's extension when browsing docs. Change-Id: I08a1b620dea5432462133324824fae85754b9a09 Task-number: QTBUG-53380 Reviewed-by: Topi Reiniö --- src/corelib/io/qfileinfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index dd194594c9..cb1ce6fd65 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -814,7 +814,7 @@ QString QFileInfo::completeBaseName() const } /*! - Returns the complete suffix of the file. + Returns the complete suffix (extension) of the file. The complete suffix consists of all characters in the file after (but not including) the first '.'. @@ -833,7 +833,7 @@ QString QFileInfo::completeSuffix() const } /*! - Returns the suffix of the file. + Returns the suffix (extension) of the file. The suffix consists of all characters in the file after (but not including) the last '.'. -- cgit v1.2.3