[FFmpeg-devel] [FFmpeg-cvslog] lavf: more correct printf format specifiers

Clément Bœsch u at pkh.me
Tue Mar 11 21:43:15 CET 2014


On Tue, Mar 11, 2014 at 09:12:06PM +0100, Diego Biurrun wrote:
> ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Mon Mar 10 15:35:59 2014 +0100| [d92024f18fa3d69937cb2575f3a8bf973df02430] | committer: Diego Biurrun
> 
> lavf: more correct printf format specifiers
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d92024f18fa3d69937cb2575f3a8bf973df02430
> ---
> 
>  libavformat/apetag.c         |    6 ++++--
>  libavformat/asfdec.c         |    8 +++++---
>  libavformat/avidec.c         |    4 ++--
>  libavformat/bink.c           |   10 +++++++---
>  libavformat/cafdec.c         |    5 ++++-
>  libavformat/crcenc.c         |    4 +++-
>  libavformat/dfa.c            |    7 +++++--
>  libavformat/dxa.c            |    5 ++++-
>  libavformat/electronicarts.c |    8 +++++---
>  libavformat/framecrcenc.c    |    4 +++-
>  libavformat/gxf.c            |    6 +++++-
>  libavformat/hnm.c            |   11 +++++++----
>  libavformat/iff.c            |    4 +++-
>  libavformat/lxfdec.c         |    9 ++++++---
>  libavformat/matroskadec.c    |    3 ++-
>  libavformat/mov.c            |    7 ++++---
>  libavformat/mvi.c            |    5 ++++-
>  libavformat/mxfdec.c         |   13 ++++++++-----
>  libavformat/omadec.c         |    8 +++++---
>  libavformat/rmdec.c          |    4 +++-
>  libavformat/rpl.c            |    4 ++--
>  libavformat/smacker.c        |    8 ++++++--
>  libavformat/smjpegdec.c      |    8 +++++---
>  libavformat/spdifenc.c       |    8 +++++---
>  libavformat/wtv.c            |    6 ++++--
>  libavformat/xmv.c            |    6 +++---
>  26 files changed, 114 insertions(+), 57 deletions(-)
> 
[...]
> diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
> index 28a403a..85e800d 100644
> --- a/libavformat/asfdec.c
> +++ b/libavformat/asfdec.c
> @@ -19,6 +19,8 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   */
>  
> +#include <inttypes.h>
> +
>  #include "libavutil/attributes.h"
>  #include "libavutil/avassert.h"
>  #include "libavutil/avstring.h"
> @@ -921,13 +923,13 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
>      // the following checks prevent overflows and infinite loops
>      if (!packet_length || packet_length >= (1U << 29)) {
>          av_log(s, AV_LOG_ERROR,
> -               "invalid packet_length %d at:%"PRId64"\n",
> +               "invalid packet_length %"PRIu32" at:%"PRId64"\n",
>                 packet_length, avio_tell(pb));
>          return -1;
>      }
>      if (padsize >= packet_length) {
>          av_log(s, AV_LOG_ERROR,
> -               "invalid padsize %d at:%"PRId64"\n", padsize, avio_tell(pb));
> +               "invalid padsize %"PRIu32" at:%"PRId64"\n", padsize, avio_tell(pb));
>          return -1;
>      }
>  
> @@ -946,7 +948,7 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
>      if (rsize > packet_length - padsize) {
>          asf->packet_size_left = 0;
>          av_log(s, AV_LOG_ERROR,
> -               "invalid packet header length %d for pktlen %d-%d at %"PRId64"\n",
> +               "invalid packet header length %d for pktlen %"PRIu32"-%"PRIu32" at %"PRId64"\n",

rsize is signed

[...]
> diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
> index 6950eb2..7966225 100644
> --- a/libavformat/cafdec.c
> +++ b/libavformat/cafdec.c
> @@ -25,6 +25,8 @@
>   * Core Audio Format demuxer
>   */
>  
> +#include <inttypes.h>
> +
>  #include "avformat.h"
>  #include "internal.h"
>  #include "isom.h"
> @@ -289,7 +291,8 @@ static int read_header(AVFormatContext *s)
>  
>          default:
>  #define _(x) ((x) >= ' ' ? (x) : ' ')
> -            av_log(s, AV_LOG_WARNING, "skipping CAF chunk: %08X (%c%c%c%c)\n",
> +            av_log(s, AV_LOG_WARNING,
> +                   "skipping CAF chunk: %08"PRIX32" (%"PRIu8"%"PRIu8"%"PRIu8"%"PRIu8")\n",

This is really insane.

[...]
> diff --git a/libavformat/wtv.c b/libavformat/wtv.c
> index 0c24fd7..c85f374 100644
> --- a/libavformat/wtv.c
> +++ b/libavformat/wtv.c
> @@ -25,6 +25,8 @@
>   * @author Peter Ross <pross at xvid.org>
>   */
>  
> +#include <inttypes.h>
> +
>  #include "libavutil/channel_layout.h"
>  #include "libavutil/intreadwrite.h"
>  #include "libavutil/intfloat.h"
> @@ -37,7 +39,7 @@
>  
>  /* Macros for formating GUIDs */
>  #define PRI_PRETTY_GUID \
> -    "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x"
> +    "%08"PRIx32"-%04"PRIx16"-%04"PRIx16"-%02x%02x%02x%02x%02x%02x%02x%02x"
>  #define ARG_PRETTY_GUID(g) \
>      AV_RL32(g),AV_RL16(g+4),AV_RL16(g+6),g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]
>  #define LEN_PRETTY_GUID 34
> @@ -501,7 +503,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty
>          return;
>  
>      if (type == 0 && length == 4) {

> -        snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb));
> +        snprintf(buf, buf_size, "%u", avio_rl32(pb));

??

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140311/5671f8b4/attachment.asc>


More information about the ffmpeg-devel mailing list