kdelibs/kimgio
Simon Hausmann
hausmann at kde.org
Sun Jan 5 10:55:15 GMT 2003
On Sun, Jan 05, 2003 at 11:48:54AM +0100, Michael Ritzert wrote:
> 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<>.
Yes, it's ok to use d-cast here as the type information comes out of
the shared libqt, which is pretty much at the bottom of the
dependency tree.
Simon
More information about the kde-core-devel
mailing list