Should KFilterDev::readData() and writeData() be protected access?

Richard Dale rdale at foton.es
Thu May 31 12:18:46 BST 2007


On Thursday 31 May 2007, Thiago Macieira wrote:
> Richard Dale said:
> > In QIODevice the readData() and writeData() pure virtual methods have
> > protected access:
> >
> > protected:
> > #ifdef QT_NO_QOBJECT
> >     QIODevice(QIODevicePrivate &dd);
> > #else
> >     QIODevice(QIODevicePrivate &dd, QObject *parent = 0);
> > #endif
> >     virtual qint64 readData(char *data, qint64 maxlen) = 0;
> >     virtual qint64 readLineData(char *data, qint64 maxlen);
> >     virtual qint64 writeData(const char *data, qint64 len) = 0;
> >
> > KFilterDev subclasses QIODevice, and implements these methods with access
> > public, but shouldn't they be protected?
>
> Yes. My guess is someone ported the old readBlock, readLine and writeBlock
> public virtual methods from Qt3's QIODevice, renamed them and forgot to
> make them protected.
>
> The *Data versions must not be called directly in a QIODevice because they
> skip the QIODevice's buffering system and may lead to inconsistent
> reading.
OK, is it ok to fix them today, and make them protected or should I wait for 
next Monday or whatever?

-- Richard







More information about the kde-core-devel mailing list