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

QTextStream buffers too eagerly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.14.1
    • Core: I/O
    • None

    Description

      QTextStream fills its internal buffer by reading bytes from the underlying QIODevice before that data is actually requested. There is no way to get the buffered data back. On the writing side, buffered data will be flushed to the device when QTextStream is closed, which makes it possible to use multiple QTextStream instances for the same device. Or use a QTextStream first and then write some binary data after it (think of the HTTP protocol, for example). On the reading side that is not possible, making the functionality asymmetric.

      The expected behavior is that the underlying QIODevice is positioned after the last byte that was actually read through QTextStream, but an arbitrary amount of data after it is lost instead. Alternatively, the buffered data could perhaps be moved to QIODevice's buffer.

      A simple demonstration of the problem is attached.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            t-om Topi Mäenpää
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes