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

Extend QByteArray to handle unsigned chars better

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.10
    • None

      QByteArray is often used to store binary data instead strings, e.g. in QtSerialBus.

      When working with the data, the signed char leads to surprising effects, e.g. when combining two chars to a short:

      quint16 word = payload.at(0) << 8 + payload.at(1);

      At the moment, this can only be solved by using reinterpret_cast<> at a lot of places.

      It would be nice to have possibilities to get unsigned char values in and out of a QByteArray.

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

            thiago Thiago Macieira
            aha_1980 André Hartmann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes