Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
4.6.0
-
None
-
8e2c575f6383a69e9c1d4f069e3c8e3b219197b5
Description
The documentation states the following for this function:
"If len is zero or the length of the string is zero, nothing will be appended to the byte array."
This is incorrect – the amount of bytes appended is always equal to len, irrespective of the string's actual length. This behavior is correct, since QByteArray may legitimately contain zero bytes. However, the documentation describing it is wrong and misleading. It should be changed to just: "If len is zero, nothing will be appended to the byte array."
Test case:
QByteArray ba;
char zeroes[ 2 ] =
{ 0, 0 };
ba.append( zeroes, 2 );
printf( "size is %d\n", ba.size() ); // Prints "size is 2"