[FFmpeg-devel] [PATCH] Fix printf format warnings

Reinhard Tartler siretart
Wed Jun 9 11:01:02 CEST 2010


On Wed, Jun 09, 2010 at 10:32:09 (CEST), M?ns Rullg?rd wrote:

> Eli Friedman <eli.friedman at gmail.com> writes:
>
>> 2010/6/8 M?ns Rullg?rd <mans at mansr.com>:
>>> Eli Friedman <eli.friedman at gmail.com> writes:
>>>
>>>> Attached are fixes for printf format warnings in
>>>> libavformat/rtpdec_xiph.c and libavformat/oggdec.c. ?The pointer
>>>> differences in libavformat/rtpdec_xiph.c have type ptrdiff_t, and
>>>> page_pos in oggdec.c is an int64_t.
>>>>
>>>> -Eli Friedman
>>>>
>>>> Index: libavformat/rtpdec_xiph.c
>>>> ===================================================================
>>>> --- libavformat/rtpdec_xiph.c (revision 23520)
>>>> +++ libavformat/rtpdec_xiph.c (working copy)
>>>> @@ -237,7 +237,7 @@
>>>> ? ? ?if (packed_headers_end - packed_headers < 9) {
>>>> ? ? ? ? ?av_log(codec, AV_LOG_ERROR,
>>>> ? ? ? ? ? ? ? ? "Invalid %d byte packed header.",
>>>> - ? ? ? ? ? ? ? packed_headers_end - packed_headers);
>>>> + ? ? ? ? ? ? ? (int)(packed_headers_end - packed_headers));
>>>
>>> %zd
>>>
>>>> ? ? ? ? ?return AVERROR_INVALIDDATA;
>>>> ? ? ?}
>>>>
>>>> @@ -259,7 +259,7 @@
>>>> ? ? ? ? ?length1 > length || length2 > length - length1) {
>>>> ? ? ? ? ?av_log(codec, AV_LOG_ERROR,
>>>> ? ? ? ? ? ? ? ? "Bad packed header lengths (%d,%d,%d,%d)\n", length1,
>>>> - ? ? ? ? ? ? ? length2, packed_headers_end - packed_headers, length);
>>>> + ? ? ? ? ? ? ? length2, (int)(packed_headers_end - packed_headers), length);
>>>
>>> %zd
>>
>> Oh, I wasn't sure if ffmpeg expects a C99-compliant printf.  Changed
>> to %td (which is technically more correct here).
>>
>>>> ? ? ? ? ?return AVERROR_INVALIDDATA;
>>>> ? ? ?}
>>>>
>>>>
>>>> Index: libavformat/oggdec.c
>>>> ===================================================================
>>>> --- libavformat/oggdec.c ? ? ?(revision 23520)
>>>> +++ libavformat/oggdec.c ? ? ?(working copy)
>>>> @@ -363,7 +363,8 @@
>>>> ?#endif
>>>>
>>>> ? ? ?if (os->granule == -1)
>>>> - ? ? ? ?av_log(s, AV_LOG_WARNING, "Page at %lld is missing granule\n", os->page_pos);
>>>> + ? ? ? ?av_log(s, AV_LOG_WARNING, "Page at %lld is missing granule\n",
>>>> + ? ? ? ? ? ? ? (long long)os->page_pos);
>>>
>>> PRId64
>>
>> Changed.
>>
>> New versions attached.
>>
>> -Eli Friedman
>>
>> Index: libavformat/rtpdec_xiph.c
>> ===================================================================
>> --- libavformat/rtpdec_xiph.c	(revision 23520)
>> +++ libavformat/rtpdec_xiph.c	(working copy)
>> @@ -236,7 +236,7 @@
>>
>>      if (packed_headers_end - packed_headers < 9) {
>>          av_log(codec, AV_LOG_ERROR,
>> -               "Invalid %d byte packed header.",
>> +               "Invalid %td byte packed header.",
>>                 packed_headers_end - packed_headers);
>>          return AVERROR_INVALIDDATA;
>>      }
>> @@ -258,7 +258,7 @@
>>      if (packed_headers_end - packed_headers != length ||
>>          length1 > length || length2 > length - length1) {
>>          av_log(codec, AV_LOG_ERROR,
>> -               "Bad packed header lengths (%d,%d,%d,%d)\n", length1,
>> +               "Bad packed header lengths (%d,%d,%td,%d)\n", length1,
>>                 length2, packed_headers_end - packed_headers, length);
>>          return AVERROR_INVALIDDATA;
>>      }
>>
>> Index: libavformat/oggdec.c
>> ===================================================================
>> --- libavformat/oggdec.c	(revision 23520)
>> +++ libavformat/oggdec.c	(working copy)
>> @@ -363,7 +363,7 @@
>>  #endif
>>
>>      if (os->granule == -1)
>> -        av_log(s, AV_LOG_WARNING, "Page at %lld is missing granule\n", os->page_pos);
>> +        av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->page_pos);
>>
>>      ogg->curidx = idx;
>>      os->incomplete = 0;
>
> Looks OK.

patch applied.

-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4




More information about the ffmpeg-devel mailing list