diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-11-16 18:21:56 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-11-16 18:36:06 (GMT) |
commit | f50098de5af1886f69214285345ef7ef4ebdc1fd (patch) | |
tree | 84eaad6cce46bc4941e63b3c2f6858a3c7934c18 | |
parent | 43aa80fe8c1064d88b104a8f8f1b97bbaeaf1cec (diff) | |
download | Qt-f50098de5af1886f69214285345ef7ef4ebdc1fd.zip Qt-f50098de5af1886f69214285345ef7ef4ebdc1fd.tar.gz Qt-f50098de5af1886f69214285345ef7ef4ebdc1fd.tar.bz2 |
Fix QFile::resize on windows for files opened from a FILE*
Reviewed-By: joao
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index cf83c07..97d1330 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -865,12 +865,16 @@ bool QFSFileEngine::setSize(qint64 size) { Q_D(QFSFileEngine); - if (d->fileHandle != INVALID_HANDLE_VALUE || d->fd != -1) { + if (d->fileHandle != INVALID_HANDLE_VALUE || d->fd != -1 || d->fh) { // resize open file HANDLE fh = d->fileHandle; #if !defined(Q_OS_WINCE) - if (fh == INVALID_HANDLE_VALUE) - fh = (HANDLE)_get_osfhandle(d->fd); + if (fh == INVALID_HANDLE_VALUE) { + if (d->fh) + fh = (HANDLE)_get_osfhandle(QT_FILENO(d->fh)); + else + fh = (HANDLE)_get_osfhandle(d->fd); + } #endif if (fh == INVALID_HANDLE_VALUE) return false; |