diff options
author | Shane Kearns <ext-shane.2.kearns@nokia.com> | 2012-03-08 11:45:05 +0000 |
---|---|---|
committer | Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com> | 2012-03-19 11:40:24 +0100 |
commit | ea2bf09534884d52b2c5b40bc214b80cfb5526e5 (patch) | |
tree | 2dc9aa27864e444579d5ef2cc0dbc657602418b5 /src/corelib/io/qfile.cpp | |
parent | 7be97ebddb27d570c6bcbe8ad881d890ea6a5d2d (diff) | |
download | qt4-tools-ea2bf09534884d52b2c5b40bc214b80cfb5526e5.tar.gz |
Optimise QFile::seek that doesn't move the file pointer
If the seek position matches the current file position, then
avoid doing an implicit flush that could be expensive.
Change-Id: I019858ffb36fe832b9aee8da0a7803cafc8f7f75
Reviewed-by: Jaakko Helanti <ext-jaakko.helanti@nokia.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
(cherry picked from commit a3a2ff59284840f1980197e3f6d06d99fcc0f512)
Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
Diffstat (limited to 'src/corelib/io/qfile.cpp')
-rw-r--r-- | src/corelib/io/qfile.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 09d0c589f9..f993580e87 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1692,6 +1692,9 @@ bool QFile::seek(qint64 off) return false; } + if (off == d->pos && off == d->devicePos) + return true; //avoid expensive flush for NOP seek to current position + if (!d->ensureFlushed()) return false; |