[FFmpeg-devel] [PATCH] avio: add avio_get_str as a replacement for get_strz
Måns Rullgård
mans
Wed Mar 2 13:46:45 CET 2011
Michael Niedermayer <michaelni at gmx.at> writes:
> 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
How will you report an error with the return value defined like that?
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list