[FFmpeg-devel] [PATCH] avio: add avio_get_str as a replacement for get_strz

Anton Khirnov anton
Wed Mar 2 16:09:48 CET 2011


On Wed, Mar 02, 2011 at 01:42:42PM +0100, Michael Niedermayer wrote:
> On Tue, Mar 01, 2011 at 06:33:56PM +0100, Anton Khirnov wrote:
> > It's more flexible and compatible with avio_get_str16.
> > ---
> >  libavformat/avio.h    |   15 ++++++++++++++-
> >  libavformat/aviobuf.c |   29 +++++++++++++++++++----------
> >  libavformat/cafdec.c  |    4 ++--
> >  libavformat/ffmdec.c  |    3 ++-
> >  libavformat/mov.c     |    2 +-
> >  5 files changed, 38 insertions(+), 15 deletions(-)
> > 
> > diff --git a/libavformat/avio.h b/libavformat/avio.h
> > index cc46ad7..7e0dca0 100644
> > --- a/libavformat/avio.h
> > +++ b/libavformat/avio.h
> > @@ -526,6 +526,14 @@ unsigned int avio_rl32(AVIOContext *s);
> >  uint64_t     avio_rl64(AVIOContext *s);
> >  
> >  /**
> > + * Read a UTF-8 string from pb. The reading will terminate when either
> > + * a NULL character was encountered or maxlen bytes have been read.
> 
> This doesnt match the code, it does not mention zero termination behavior
> for the truncated case
> 
> 
> > + *
> > + * @return number of bytes read (is always <= maxlen).
> > + */
> 
> This is not very convenient
> We rarely care about the length, but we often care about having truncated data
> 

It's funny you say that, since the return value as it is now is used in
this very patch (cafdec.c). I'm also using it in id3v2 parser (patch soon).

-- 
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110302/97d499da/attachment.pgp>



More information about the ffmpeg-devel mailing list