Re: GConverter commited

On Tue, 2009-11-24 at 10:09 -0600, Shaun McCance wrote:
> On Tue, 2009-11-24 at 09:36 +0100, Alexander Larsson wrote:
> > I'm not sure why you'd need this, you just don't add a
> > GConverterInputStream in that case.
> Well, the way I did the magic was with a GConverter that
> inspects its data the first time convert is called, and
> then constructs another GConverter to pass everything
> off to.  (This assumes the first call to convert has at
> least some number of bytes, by the way.)

If there is not enough bytes for what you want just return
G_IO_ERROR_PARTIAL_INPUT and you'll be called with more data.

> 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.

Yeah, seems easiest to do this in the magic converter then.

> > Its not a lot of code either, nor is it very complicated, so maybe cut
> > and paste is not such a horrible idea.
> I don't disagree.  Is there a place to plop this code
> for people to pick it up?  I'll be putting at least the
> bz2 and lzma converters into Yelp soon (or possibly an
> xv converter instead of the lzmadec-based one).  I'm
> still undecided on the magic converter.

Well, there is libegg. But its meant for things that have a final
destination in some other library, so its not an ideal match.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]