From 25823cdeb4acbbd86cb8e1c97a0b4f51ffa07c10 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 29 May 2020 13:39:16 +0200 Subject: Fix a typo and an odd phrasing One initializes data "byte by byte" not "byte per byte", at least in any dialect I'm familiar with. A byte array can be "created from raw data" but if it was "from a" thing it'd have to be a datum of some sort. Change-Id: Id9706b191f08f03418b9ea6f481797d93a278dff Reviewed-by: Paul Wicking --- src/corelib/text/qbytearray.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 4eb9b5f592..bb12af681a 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -812,12 +812,11 @@ QByteArray qUncompress(const uchar* data, int nbytes) performance reasons you don't want to take a deep copy of the character data, use QByteArray::fromRawData() instead.) - Another approach is to set the size of the array using resize() - and to initialize the data byte per byte. QByteArray uses 0-based - indexes, just like C++ arrays. To access the byte at a particular - index position, you can use operator[](). On non-const byte - arrays, operator[]() returns a reference to a byte that can be - used on the left side of an assignment. For example: + Another approach is to set the size of the array using resize() and to + initialize the data byte by byte. QByteArray uses 0-based indexes, just like + C++ arrays. To access the byte at a particular index position, you can use + operator[](). On non-const byte arrays, operator[]() returns a reference to + a byte that can be used on the left side of an assignment. For example: \snippet code/src_corelib_tools_qbytearray.cpp 1 @@ -848,7 +847,7 @@ QByteArray qUncompress(const uchar* data, int nbytes) constData(). These functions return a pointer to the beginning of the data. The pointer is guaranteed to remain valid until a non-const function is called on the QByteArray. It is also guaranteed that the data ends with a - '\\0' byte unless the QByteArray was created from a \l{fromRawData()}{raw + '\\0' byte unless the QByteArray was created from \l{fromRawData()}{raw data}. This '\\0' byte is automatically provided by QByteArray and is not counted in size(). -- cgit v1.2.3