[prev in list] [next in list] [prev in thread] [next in thread]
List: konq-e
Subject: Re: Solution to problem with garbage lines at the bottom of the html
From: Simon Hausmann <hausmann () kde ! org>
Date: 2001-02-01 10:42:12
[Download RAW message or body]
On Wed, Jan 31, 2001 at 12:25:31PM -0800, Kevin Le wrote:
>
> We have a problem with the html page displays a bunch of garbage lines at
> the bottom when
> calling the KHTMLPart::openURL() with the 'file' protocol. We traced the
Ahh, yes, I experienced it from time to time, too.
> problem down
> to File::get() in dropin/kio/kio_file.cpp. Here's the source code:
>
> ...
> #define MAX_IPC_SIZE (1024*32)
> ...
> QByteArray buffer( MAX_IPC_SIZE );
> ...
> int n = file.readBlock( buffer.data(), buffer.size() );
> ...
>
> The problem is that QFile::readBlock() method doesn't truncate the buffer
> properly, thus the
> garbage stuffs in buffer. There's a warning bug for this method, and even
> though it doesn't
> look like it's related to this problem, I still don't trust this. One can
> argues that the bug is
> in readBlock() for not truncating the buffer appropriately or it's the
> caller's responsibility to
> truncate the buffer as it should be. I'm taking the easy way out by
> truncating the buffer.
> So, here's my code: (I added the below line right after the call to
> readBlock())
>
> int n = file.readBlock( buffer.data(), buffer.size() );
> buffer.truncate( n );
>
> Comments anyone?
That looks like an excellent solution for the bug. I'll commit that
right away into the CVS :-)
Thanks a lot!
Bye,
Simon
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic