diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-05-29 13:39:16 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-05-29 16:58:43 +0200 |
commit | 25823cdeb4acbbd86cb8e1c97a0b4f51ffa07c10 (patch) | |
tree | c5172a11d9b386be3b5d819e72cb8fa05c22ba0a /src/corelib | |
parent | 73158a9cb0942c2cdb3c6a98bcfd5763eed65c85 (diff) |
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 <paul.wicking@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
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(). |