Windows: ignore errors from FlushFileBuffers()

Appereantly the function does not work as advertised on Windows 7.
Do call it, but ignore errors.
Hopefully any real write errors, will be detected when reading
back image instead.
This commit is contained in:
Floris Bos 2020-03-10 16:40:31 +01:00
parent 560759fe0c
commit b269d0b522

View file

@ -30,7 +30,7 @@ bool WinFile::open(QIODevice::OpenMode)
for (int attempt = 0; attempt < 20; attempt++)
{
_h = CreateFileA(n.data(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
_h = CreateFileA(n.data(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (_h != INVALID_HANDLE_VALUE)
break;
@ -143,8 +143,9 @@ bool WinFile::flush()
{
if (!FlushFileBuffers(_h))
{
_lasterror = qt_error_string();
return false;
// Windows 7 does not support flush properly, so ignore errors
//_lasterror = qt_error_string();
//return false;
}
return true;