[FFmpeg-devel] [PATCH] Fix warnings in ff_metadata_mux_compat (in libavformat/metadata_compat.c)

Eli Friedman eli.friedman
Sun Jun 27 22:55:16 CEST 2010


Patch attached.  The warning in question is "warning: the address of
?number? will always evaluate as ?true?", which comes from
FILL_METADATA_INT.  This patch fixes it by pushing the check out of
FILL_METADATA and into FILL_METADATA_STR.

-Eli
-------------- next part --------------
Index: libavformat/metadata_compat.c
===================================================================
--- libavformat/metadata_compat.c	(revision 23832)
+++ libavformat/metadata_compat.c	(working copy)
@@ -108,10 +108,12 @@
 
 
 #define FILL_METADATA(s, key, value) {                                        \
-    if (value && *value && !av_metadata_get(s->metadata, #key, NULL, 0))      \
+    if (!av_metadata_get(s->metadata, #key, NULL, 0))                         \
         av_metadata_set2(&s->metadata, #key, value, 0);                       \
     }
-#define FILL_METADATA_STR(s, key)  FILL_METADATA(s, key, s->key)
+#define FILL_METADATA_STR(s, key) {                                           \
+    if (s->key && *s->key)                                                    \
+      FILL_METADATA(s, key, s->key) }
 #define FILL_METADATA_INT(s, key) {                                           \
     char number[10];                                                          \
     snprintf(number, sizeof(number), "%d", s->key);                           \



More information about the ffmpeg-devel mailing list