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

Reimar Döffinger Reimar.Doeffinger
Wed Mar 2 19:21:01 CET 2011


On Wed, Mar 02, 2011 at 12:12:58PM -0500, Ronald S. Bultje wrote:
> On Tue, Mar 1, 2011 at 3:38 PM, Reimar D?ffinger
> <Reimar.Doeffinger at gmx.de> wrote:
> > On Tue, Mar 01, 2011 at 06:33:56PM +0100, Anton Khirnov wrote:
> >> ?/**
> >> + * Read a UTF-8 string from pb. The reading will terminate when either
> >> + * a NULL character was encountered or maxlen bytes have been read.
> >> + *
> >> + * @return number of bytes read (is always <= maxlen).
> >> + */
> >> +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
> >
> > 1) If you already say UTF-8 string you should definitely use uint8_t as type.
> 
> Why? libc uses char* for UTF8.

Because it needlessly risks issues due to undefined signedness.
And which libc functions are explicitly UTF-8 functions? I am not aware of any.

> Looks a little nicer indeed. Can anyone (maybe Anton) send a
> git-formatted patch that does something like this? Also, Reimar, if
> you don't mind, I can commit this with Anton as author and then your
> patch (hopefully you'll send one git-formatted) right on top, so that
> authorship is properly attributed.

I very much mind wasting my time with that kind of crap, particularly
since the reason for writing the code here is that I don't want
to implement and test it.
I'd _very_ much rather have someone else as author than this.
Not to mention that I consider it rather questionable to commit something
suboptimal just for this purpose, that is cluttering the history for politics
(IMHO, sorry).



More information about the ffmpeg-devel mailing list