[FFmpeg-devel] compile issues under mingw-cross-env
Måns Rullgård
mans
Sun Jul 11 00:00:20 CEST 2010
Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> On Sat, Jul 10, 2010 at 10:22:01PM +0100, M?ns Rullg?rd wrote:
>> Ramiro Polla <ramiro.polla at gmail.com> writes:
>>
>> > On Sat, Jul 10, 2010 at 6:14 PM, Reimar D?ffinger
>> > <Reimar.Doeffinger at gmx.de> wrote:
>> >> However, I am quite convinced that all uses (except in ffsever) of
>> >> strcasecmp in FFmpeg are just plain _wrong_ and will break things
>> >> if a calling application uses setlocale.
>> >> For example, with TR_tr locale,
>> >> if (!strcasecmp(m->elems[j].key, "provider_name"))
>> >> will not match provIder_name.
>> >> I seriously doubt this can be considered correct behaviour,
>> >
>> > So are we going to have av_strcasecmp()? =)
>>
>> http://git.mansr.com/?p=ffmpeg.mru;a=commitdiff;h=0dc41ad1923
>
> That is quite funny in this context, by using tolower it still
> has exactly the same issues.
Indeed. I just happened to have the patch sitting around.
> av_strcasecmp_ascii
> with
> while (1) {
> int delta = *s - *d;
> if (!*s || (delta &&
> (delta != 'a' - 'A' || *s < 'a' || *s > 'z') &&
> (delta != 'A' - 'a' || *s < 'A' || *s > 'Z')))
> return delta;
> s++; d++;
> }
> should avoid it and would be faster.
This looks simpler:
#define ascii_tolower(c) ((c) | ((unsigned)((c)-'A') < 'Z'-'A')<<5)
All assuming ascii is what we care about of course.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list