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

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

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes