Re: GConverter commited
- From: Shaun McCance <shaunm gnome org>
- To: Behdad Esfahbod <behdad redhat com>
- Cc: gtk-devel-list gnome org, Alexander Larsson <alexl redhat com>
- Subject: Re: GConverter commited
- Date: Tue, 24 Nov 2009 17:58:08 -0600
On Tue, 2009-11-24 at 17:20 -0500, Behdad Esfahbod wrote:
> On 11/24/2009 11:09 AM, Shaun McCance wrote:
>
> > So with my implementation, by the time you get to the
> > magic, you've already set up a GConverterInputStream
> > with the magic decompressor. If the stream turns out
> > to be uncompressed, you'd have to do a null conversion.
> > I suppose the magic decompressor could just have the
> > null conversion built in.
>
> Isn't it like a matter of memcpy() in convert(), and nothing in reset()? Not
> that I oppose a cat-converter.
Oh duh. I was thinking it was slightly less trivial, that
you'd have to maintain a buffer in case outbuf is smaller
than inbuf. But I just realized that convert doesn't have
to consume all of inbuf. That's what bytes_read is for.
So I updated my magic decompressor in my git repository so
that, if it doesn't detect any compression, it just passes
the data through. It's like six lines of code.
--
Shaun
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]