JPEG Thumbnailer

Michael Pyne mpyne at purinchu.net
Sat Aug 16 20:13:04 BST 2008


On Thursday 14 August 2008, Andre Gem√ľnd wrote:
> Carsten Pfeiffer schrieb:
> > > +    FILE *fd_in;
> > > +    if ((fd_in = fopen(path.toLatin1().data(), "rb")) ==
> >
> > Can you use the QFile API instead of fopen()? If not, then please use
> > QFile::encodeName() instead of latin1() to preserve the filename
> > encoding.
>
> In theory you can. I'd have to write a custom source manager for that
> then, because we can't use the stdio one of jpeglib in that case. I
> think it would add a lot of code though, is it really needed?

Actually it's easier than that:

On an opened QFile you can use QFile::handle() to return the file descriptor 
(i.e. what is passed to write(2)).  Using the file descriptior you can use the 
C stdio fdopen() function to return a FILE* tied to that file descriptor.

This way you can still use stdio functions on a file managed by QFile.

All that this would really buy you is guaranteeing that the file gets closed, 
which may not be worth the overhead however if you're simply going to be 
passing the FILE* to libjpeg.

Regards,
 - Michael Pyne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080816/3eeb069b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080816/3eeb069b/attachment.sig>


More information about the kde-core-devel mailing list