QFSFileEngine: fix logic
Inside the do-while loop the if body is executed if `eof` is true, which means the continue statement is redundant because the while loop condition contains `!eof`, so the do-while body doesn't get executed again after that. Change-Id: If0685eb482f29b88e9c8660886392483a3bd75ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
3fbcf53828
commit
1849489315
@ -621,17 +621,15 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len)
|
||||
// Buffered stdlib mode.
|
||||
|
||||
size_t result;
|
||||
bool retry = true;
|
||||
do {
|
||||
result = fread(data + readBytes, 1, size_t(len - readBytes), fh);
|
||||
eof = feof(fh);
|
||||
if (retry && eof && result == 0) {
|
||||
if (eof && result == 0) {
|
||||
// On OS X, this is needed, e.g., if a file was written to
|
||||
// through another stream since our last read. See test
|
||||
// tst_QFile::appendAndRead
|
||||
QT_FSEEK(fh, QT_FTELL(fh), SEEK_SET); // re-sync stream.
|
||||
retry = false;
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
readBytes += result;
|
||||
} while (!eof && (result == 0 ? errno == EINTR : readBytes < len));
|
||||
|
Loading…
x
Reference in New Issue
Block a user