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

Documentation for QIODevice::seek is off-by-not

    XMLWordPrintable

Details

    • Ie3a96d3a6f60995b8ba7823153778869d0c2dc58

    Description

      The documentation claims that QIODevice::seek returns false for sequential devices. Actually it returns true.

      #include <QDebug>
      
      class MyDevice : public QIODevice
      {
      public:
        MyDevice(QObject *parent = 0) : QIODevice(parent) {}
      
        bool isSequential() const { return true; }
      
      protected:
        virtual qint64 readData(char*, qint64) { return 0; }
        virtual qint64 writeData(const char*, qint64) { return 0; }
      };
      
      int main(int argc, char **argv)
      {
        MyDevice d;
        qDebug() << d.open(QIODevice::ReadOnly);
        qDebug() << d.isSequential();
        qDebug() << d.seek(0);
      }
      
      
      $ ./iodevsequential 
      true 
      true 
      true 
      
      

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            steveire Stephen Kelly (Personal)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes