[FFmpeg-devel] [PATCH] avio: add avio_get_str as a replacement for get_strz
Michael Niedermayer
michaelni
Wed Mar 2 13:42:42 CET 2011
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
@return buffer size - bytes read, this is negative if the string was truncated
and easy to find the number of bytes read from it in the rare case where we
might want it
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- 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/9b5886e3/attachment.pgp>
More information about the ffmpeg-devel
mailing list