From d8545347899512ec0f57707d15545c561ff57eff Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 31 Jan 2022 13:57:37 +0100 Subject: [PATCH] Correct character semantics documentation in QByteArray(View) QByteArray's list of case-implicating functions included three that don't implicate case and omitted one that does. QByteArrayView lacked any mention of the liminal nature of these and other methods that presume any particular semantics to character data. Pick-to: 6.2 6.3 Change-Id: I928ef2274704584f8a137c0a4a7aa3c3da57718e Reviewed-by: Thiago Macieira --- src/corelib/text/qbytearray.cpp | 4 ++-- src/corelib/text/qbytearrayview.qdoc | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index b047d6b2d7e..1f634fef075 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -929,8 +929,8 @@ QByteArray qUncompress(const uchar* data, qsizetype nbytes) comparison is limited to ASCII. Non-ASCII characters are treated as caseless, since their case depends on encoding. This affects functions that support a case insensitive option or that change the case of their - arguments. Functions that this affects include contains(), indexOf(), - lastIndexOf(), isLower(), isUpper(), toLower() and toUpper(). + arguments. Functions that this affects include compare(), isLower(), + isUpper(), toLower() and toUpper(). This issue does not apply to \l{QString}s since they represent characters using Unicode. diff --git a/src/corelib/text/qbytearrayview.qdoc b/src/corelib/text/qbytearrayview.qdoc index 96bb1ccb568..76e04f9aaa4 100644 --- a/src/corelib/text/qbytearrayview.qdoc +++ b/src/corelib/text/qbytearrayview.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2021 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -80,6 +80,12 @@ If in doubt, obtain a strong reference to the data by calling toByteArray() to convert the QByteArrayView into a QByteArray. + The methods supported by QByteArrayView reflect those of \l QByteArray. In + particular, to the limited degree that it ascribes semantics (such as + character case, spacing, digits of numbers) to the character data viewed, it + uses the C locale and ASCII encoding. See \l {C locale and ASCII functions} + for details and the limitations on these methods. + \section1 Compatible Byte Types QByteArrayView can be constructed on any container of bytes, where the byte type