[FFmpeg-cvslog] r18856 - trunk/libavformat/oma.c

Måns Rullgård mans
Sat May 16 18:43:27 CEST 2009


Uoti Urpala <uoti.urpala at pp1.inet.fi> writes:

> On Sat, 2009-05-16 at 17:09 +0200, mru wrote:
>> Author: mru
>> Date: Sat May 16 17:09:30 2009
>> New Revision: 18856
>> 
>> Log:
>> oma: fix build if memcmp() is a macro
>> 
>> Any C library function may be a macro, so compound literals
>> passed to memcmp() must be surrounded by parens to avoid being
>> split on commas.
>
>> -    if (memcmp(buf, (const uint8_t[]){'E', 'A', '3'},3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
>> +    if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
>
> Is there any reason not to use the much simpler 'memcmp(buf, "EA3", 3)'?

I doubt it.

> The terminating 0 of string constants makes no difference here, and the
> code doesn't look like it'd work anyway if the representations of char
> and uint8_t would differ.

Or if the encodings of those characters differs from the expected.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-cvslog mailing list