Problems with KFilterDev::deviceForFile method in a KF5 based application

Arnold Dumas contact at arnolddumas.fr
Sun Aug 10 18:35:42 UTC 2014


Le 10/08/2014 19:46, David Faure a écrit :
> On Saturday 09 August 2014 20:13:40 Arnold Dumas wrote:
>> Le 09/08/2014 10:47, David Faure a écrit :
>> > On Sunday 27 July 2014 20:22:14 Arnold Dumas wrote:
>> >> I've tried to replace this by:
>> >> QScopedPointer<QIODevice> device(new KFilterDev(file));
>> >>
>> >> but it still only load gziped files and not plain-text ones.
>> >
>> > This is surprising because this case is unittested and works.
>> >
>> > KFilterTest::test_block_read ends with
>> > test_block_read(pathnone);
>> > which calls
>> > KFilterDev dev(fileName);
>> > on a plain-text file, and reads from it.
>> >
>> > Did you debug it a little further? What happens when trying to load a
>> > plain-
>> > text file? Wrong size? Garbage data? ... ?
>> >
>> > I added a new unittest for a larger read in one go (readAll), in case
>> > it's an
>> > issue that only occurs with larger data (like we found in 9d04e4186f13,
>> > in the case of writing without compression), but that test passes
>> > too...
>> 
>> First thanks for your input David. Well I know the problem is really
>> awkward.
>> 
>> When I load a plain-text file, the parser begins its job correctly, 
>> but
>> then a line isn't properly retrieved from the file.
>> So the parser ends in a "Error" state. I've also noticed that the 
>> faulty
>> line is always the last. In fact, the parser tries to load a line that
>> doesn't exist.
>> 
>> Could this be related to EOF encoding or something related?
> 
> That helped. I added a test for atEnd() and it failed -> fixed now.

I've just installed karchive master and massif-visualizer now works as 
expected. Thanks for all David.

-- 
Arnold Dumas
http://arnolddumas.fr


More information about the Kde-frameworks-devel mailing list