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

Extend QByteArray to handle unsigned chars better

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Affects Version/s: 5.10
    • Fix Version/s: None
    • Labels:
      None

      Description

      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.

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes