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

Add QIDevice::peak|read|readAll(QByteArray &) overloads to reuse QByteArray's capacity

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: Not Evaluated Not Evaluated
    • None
    • None
    • Core: I/O
    • None

      qint64 QIODevice::read(char *, qint64) and friends require the user to make sure that the buffer is large enough or valid, hence they are rather unsafe. Their overloads returning QByteArray cause a new buffer (within QByteArray) to be allocated.

      If QIODevice had the following overloads it would be possible to reuse the capacity of an already available QByteArray instance safely:

      qint64 QIODevice::read(QByteArrray *);
      qint64 QIODevice::readAll(QByteArrray *);
      qint64 QIODevice::readLine(QByteArrray *);
      qint64 QIODevice::peek(QByteArrray *);
      

      These overloads would make all sorts of data processing applications perform better.

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

            cnn Qt Core & Network
            ckakman Kayra Akman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes