Review Request 125974: Make KTar KCompressionDevice-friendly

David Faure faure at kde.org
Sat Nov 21 21:59:39 UTC 2015



> On Nov. 6, 2015, 7:52 a.m., David Faure wrote:
> > src/karchive.cpp, line 652
> > <https://git.reviewboard.kde.org/r/125974/diff/1/?file=415544#file415544line652>
> >
> >     This is not equivalent to seek(d->pos).
> >     seek(d->pos) goes to the absolute position d->pos, counting from the beginning of the device.
> >     
> >     read(d->pos) goes to the absolute position (current position + d->pos).
> >     
> >     If this is seeking forward, you could emulate it with a dummy read, but what if this is seeking backward? That's not possible on a sequential device, so my advice is, forget using a sequential device here, download to a temp file.
> 
> Romário Rios wrote:
>     Actually, this is irrelevant to the issue. I reverted this code back to the original and the fix still works.
>     
>     You're right about the situation in this case, but, inside KTar::openArchive, it works because it originally only seeks the device forward.
> 
> David Faure wrote:
>     Maybe but if you call KArchiveFile::data() on the last file in the archive, and then on the first file in the archive, seeking back is obviously needed.
> 
> Romário Rios wrote:
>     When would that happen? KArchiveFile::data() isn't ever called from inside KTar::openArchive().

Not inside openArchive, but afterwards. The app can call KArchiveFile::data on any file it wants, in any order.


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125974/#review88078
-----------------------------------------------------------


On Nov. 6, 2015, 2:52 a.m., Romário Rios wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/125974/
> -----------------------------------------------------------
> 
> (Updated Nov. 6, 2015, 2:52 a.m.)
> 
> 
> Review request for KDE Frameworks and Aleix Pol Gonzalez.
> 
> 
> Repository: karchive
> 
> 
> Description
> -------
> 
> Up until now, since at least 5.12, decompressing some data coming directly from a QIODevice by using KCompressionDevice because this is a sequential device, and KTar and KArchive used to use QIODevice::seek and pos and some places, which made the decompression fail. This patch makes KTar sequential-friendly by replacing the calls to seek and pos with read and a simple counter, respectively.
> 
> 
> Diffs
> -----
> 
>   src/karchive.cpp 0ece37c 
>   src/ktar.cpp 824395e 
> 
> Diff: https://git.reviewboard.kde.org/r/125974/diff/
> 
> 
> Testing
> -------
> 
> Makes the tests from review #125941 pass
> 
> 
> Thanks,
> 
> Romário Rios
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20151121/987f0239/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list