mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 11:22:58 +00:00
get rid of QFilePrivate::cachedSize member
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
0b78fe4624
commit
f4c40ada89
2 changed files with 2 additions and 22 deletions
|
@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
|
|||
//************* QFilePrivate
|
||||
QFilePrivate::QFilePrivate()
|
||||
: fileEngine(0), lastWasWrite(false),
|
||||
error(QFile::NoError), cachedSize(0)
|
||||
error(QFile::NoError)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1067,10 +1067,8 @@ bool QFile::resize(qint64 sz)
|
|||
seek(sz);
|
||||
if(d->fileEngine->setSize(sz)) {
|
||||
unsetError();
|
||||
d->cachedSize = sz;
|
||||
return true;
|
||||
}
|
||||
d->cachedSize = 0;
|
||||
d->setError(QFile::ResizeError, d->fileEngine->errorString());
|
||||
return false;
|
||||
}
|
||||
|
@ -1225,8 +1223,7 @@ qint64 QFile::size() const
|
|||
Q_D(const QFile);
|
||||
if (!d->ensureFlushed())
|
||||
return 0;
|
||||
d->cachedSize = fileEngine()->size();
|
||||
return d->cachedSize;
|
||||
return fileEngine()->size();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1260,11 +1257,6 @@ bool QFile::atEnd() const
|
|||
return d->fileEngine->atEnd();
|
||||
}
|
||||
|
||||
// if it looks like we are at the end, or if size is not cached,
|
||||
// fall through to bytesAvailable() to make sure.
|
||||
if (pos() < d->cachedSize)
|
||||
return false;
|
||||
|
||||
// Fall back to checking how much is available (will stat files).
|
||||
return bytesAvailable() == 0;
|
||||
}
|
||||
|
@ -1328,11 +1320,6 @@ qint64 QFile::readLineData(char *data, qint64 maxlen)
|
|||
read = QIODevice::readLineData(data, maxlen);
|
||||
}
|
||||
|
||||
if (read < maxlen) {
|
||||
// failed to read all requested, may be at the end of file, stop caching size so that it's rechecked
|
||||
d->cachedSize = 0;
|
||||
}
|
||||
|
||||
return read;
|
||||
}
|
||||
|
||||
|
@ -1354,11 +1341,6 @@ qint64 QFile::readData(char *data, qint64 len)
|
|||
d->setError(err, d->fileEngine->errorString());
|
||||
}
|
||||
|
||||
if (read < len) {
|
||||
// failed to read all requested, may be at the end of file, stop caching size so that it's rechecked
|
||||
d->cachedSize = 0;
|
||||
}
|
||||
|
||||
return read;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,6 @@ protected:
|
|||
QFile::FileError error;
|
||||
void setError(QFile::FileError err);
|
||||
void setError(QFile::FileError err, const QString &errorString);
|
||||
|
||||
mutable qint64 cachedSize;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
Loading…
Add table
Reference in a new issue