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

QIODevice::read() always returns 0 for open random-access devices

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Affects Version/s: 5.15.0 RC2
    • Fix Version/s: None
    • Component/s: Core: I/O
    • Labels:
      None

      Description

      From https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/io/qiodevice.cpp:

      /*!
          For open random-access devices, this function returns the size of the
          device. For open sequential devices, bytesAvailable() is returned.
      
          If the device is closed, the size returned will not reflect the actual
          size of the device.
      
          \sa isSequential(), pos()
      */
      qint64 QIODevice::size() const
      {
          return d_func()->isSequential() ? bytesAvailable() : qint64(0);
      }
      

      size() should return the size of the device for open random-access devicesĀ  (NOT an open sequential device, i.e. the second part of the ternary expression). But, it returns 0.

        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:
            notdav David Tran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes