Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7246

Incorrect documentation for QByteArray::append( const char * str, int len )

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 4.7.1
    • 4.6.0
    • Documentation
    • 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"

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            gbk Martin Smith (Qt)
            dragonroot Konstantin Isakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes