KIso: Fixed file offsets of the underlying IO device

Authored by nmel on Jun 20 2018, 5:07 AM.

Description

KIso: Fixed file offsets of the underlying IO device

The patch is proposed by Theo <alpha0x89@yahoo.de>.

kio_iso uses KArchive's KCompressionDevice to access the ISO file.
The device is created in KIso::prepareDevice and KCompressionDevice's
constructor creates a QIODevice and a QFileDevice. The corresponding
*Private devices have separate sets of member variables 'pos' and
'devicePos' that get out of sync when the QFileDevice is closed at the end
of KIso::openArchive. The QFileDevice is reset to offset zero while
QIODevice keeps the offset positions it has after reading the ISO file
system. When the ISO file is opened for reading the file data,
QFileDevice's offset positions are treated as if they haven't been reset
and subsequent seeks fall short of the requested offset.

The workaround is suggested by Qt documentation [1]
"When subclassing QIODevice, you must call QIODevice::seek() at the start
of your function to ensure integrity with QIODevice's built-in buffer."

For more details see the discussion in the bug.

FIXED: [ 372023 ] ISO files listing/extracting broken
BUG: 372023

Differential Revision: https://phabricator.kde.org/D13626

[1] http://doc.qt.io/qt-5/qiodevice.html#seek

Details

Committed
nmelJun 22 2018, 7:44 AM
Differential Revision
D13626: KIso: Fixed file offsets of the underlying IO device
Parents
R167:481c0f083442: Remove the unused KMountMan::convertSize()
Branches
Unknown
Tags
Unknown