kdelibs/kimgio
Michael Ritzert
kde at ritzert.de
Sun Jan 5 10:48:54 GMT 2003
Hi Stephan,
Am Montag, 16. Dezember 2002 14:38 schrieb Stephan Kulow:
> Am Montag, 16. Dezember 2002 14:09 schrieb Michael Ritzert:
> > would be better? The optimal solution I see would be to get a file
> > descriptor from io->ioDevice() and have JasPer read the data in
chunks. I
> > believe, this isn't possible, is it?
>
> Well, what can it be? from QFile, a QSocket and QSocketDevice you
> can get socket()/handle() .
This idea has one problem: I can't figure out which type of device I have.
- QIODevice is not a Q_OBJECT so I don't have inherits(). It doesn't have
virtual_hook, either.
- using dynamic_cast<> AFAIK has problems with shared libs. This may be the
reason why I fail to find an appropriate conversion for the io->ioDevice()
I get for images in HTML pages. I try to convert to QFile, QSocket,
QSocketDevice, KAsyncIO, KBufferedIO and KLimitedIODevice.
For a local file I get a match for QFile, so the code should be Ok...
Given this my current idea is:
- if it's a QFile (found out by dynamic_cast<>), use the file descriptor
and be happy.
- otherwise set a threshold size up to which the compressed data is always
read to the memory completely. If the size is above that threshold, create
a local temporary file, save the data there and give JasPer a
filedescriptor for that file.
So the question is whether it's Ok to use dynamic_cast<>.
Michael
More information about the kde-core-devel
mailing list