[Swfdec] [PATCH] Fix compiler warnings that prevent compilation

Pavel Roskin proski at gnu.org
Thu Oct 11 00:29:05 PDT 2007


Counteract incorrect use of the "deprecated" attribute in ffmpeg
headers.  In particular, struct AVPaletteControl is deprecated, but it's
used in a non-deprecated struct AVCodecContext (as found in Fedora's
ffmpeg-devel-0.4.9-0.8.20070530.fc7.x86_64).  Define
attribute_deprecated to an empty string until broken version of ffmpeg
are too obsolete to support.

Use appropriate modifiers for size_t sized arguments in printf-style
format to avoid warnings on 64-bit systems.

Avoid casting to (gpointer *) in SWFDEC_AS_CHECK definition.  Casting to
(gpointer) is sufficient and avoids warnings about strict aliasing.

Signed-off-by: Pavel Roskin <proski at gnu.org>
---

 configure.ac                          |    2 +-
 libswfdec/swfdec_as_context.c         |    4 ++--
 libswfdec/swfdec_as_native_function.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/configure.ac b/configure.ac
index 3aa5e4c..9749087 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ dnl if we support them, we set them unconditionally
 AS_COMPILER_FLAG(-Wall, GLOBAL_CFLAGS="-Wall", GLOBAL_CFLAGS="")
 dnl I want this but stupid headers don't let me
 dnl AS_COMPILER_FLAG(-Wshadow, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wshadow")
-AS_COMPILER_FLAG(-Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security")
+AS_COMPILER_FLAG(-Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security -Dattribute_deprecated=")
 dnl if we're in nano >= 1, add -Werror if supported
 if test x$SWFDEC_CVS = xyes ; then
   AS_COMPILER_FLAG(-Werror, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Werror")
diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index 61de9b5..8e47260 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -197,7 +197,7 @@ swfdec_as_context_use_mem (SwfdecAsContext *context, gsize bytes)
   
   context->memory += bytes;
   context->memory_since_gc += bytes;
-  SWFDEC_LOG ("+%4u bytes, total %7u (%7u since GC)", bytes,
+  SWFDEC_LOG ("+%4zu bytes, total %7zu (%7zu since GC)", bytes,
       context->memory, context->memory_since_gc);
   /* FIXME: Don't foget to abort on OOM */
   return TRUE;
@@ -219,7 +219,7 @@ swfdec_as_context_unuse_mem (SwfdecAsContext *context, gsize bytes)
   g_return_if_fail (context->memory >= bytes);
 
   context->memory -= bytes;
-  SWFDEC_LOG ("-%4u bytes, total %7u (%7u since GC)", bytes,
+  SWFDEC_LOG ("-%4zu bytes, total %7zu (%7zu since GC)", bytes,
       context->memory, context->memory_since_gc);
 }
 
diff --git a/libswfdec/swfdec_as_native_function.h b/libswfdec/swfdec_as_native_function.h
index bbdce1d..88c172d 100644
--- a/libswfdec/swfdec_as_native_function.h
+++ b/libswfdec/swfdec_as_native_function.h
@@ -86,7 +86,7 @@ gboolean	swfdec_as_native_function_checkv(SwfdecAsContext *	cx,
 						 const char *	      	args,
 						 va_list		varargs);
 #define SWFDEC_AS_CHECK(type,result,...) G_STMT_START {\
-  if (!swfdec_as_native_function_check (cx, object, type, (gpointer *) result, argc, argv, __VA_ARGS__)) \
+  if (!swfdec_as_native_function_check (cx, object, type, (gpointer) result, argc, argv, __VA_ARGS__)) \
     return; \
 }G_STMT_END
 


More information about the Swfdec mailing list