gst/gst.c: Fix empty declaration and type mismatch.
authorJosep Torre Valles <josep@fluendo.com>
Fri, 6 Oct 2006 14:46:04 +0000 (14:46 +0000)
committerZaheer Abbas Merali <zaheerabbas@merali.org>
Fri, 6 Oct 2006 14:46:04 +0000 (14:46 +0000)
Original commit message from CVS:
2006-10-06  Zaheer Abbas Merali  <zaheerabbas at merali dot org>

Patch by: Josep Torre Valles <josep@fluendo.com>

* gst/gst.c: (gst_init_get_option_group):
Fix empty declaration and type mismatch.
* gst/gstbin.c: (gst_bin_change_state_func):
Fix type mismatch.
* gst/gstelement.c: (gst_element_continue_state),
(gst_element_set_state_func), (gst_element_change_state),
(gst_element_change_state_func):
Fix type mismatches.
* gst/gstinfo.c: (gst_debug_compare_log_function_by_func),
(gst_debug_remove_log_function), (_gst_debug_nameof_funcptr):
Cast as appropriate.
* gst/gstobject.c: (gst_class_signal_connect):
Cast as appropriate.  The function pointer parameter really
has the wrong type but would break API if we change it.
* gst/gstquery.c:
Fix redefinition of _FILE_OFFSET_BITS caused on Solaris wrt
order of including string.h.
* gst/gstutils.c: (gst_element_state_get_name):
Remove unreachable line.
* gst/gstxml.c: (gst_xml_parse_doc):
Fix type mismatch.
All these caught by Forte.

ChangeLog
gst/gst.c
gst/gstbin.c
gst/gstelement.c
gst/gstinfo.c
gst/gstobject.c
gst/gstquery.c
gst/gstutils.c
gst/gstxml.c

index 47be3f8..bcc84dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,33 @@
 
        Patch by: Josep Torre Valles <josep@fluendo.com>
 
+       * gst/gst.c: (gst_init_get_option_group):
+       Fix empty declaration and type mismatch.
+       * gst/gstbin.c: (gst_bin_change_state_func):
+       Fix type mismatch.
+       * gst/gstelement.c: (gst_element_continue_state),
+       (gst_element_set_state_func), (gst_element_change_state),
+       (gst_element_change_state_func):
+       Fix type mismatches.
+       * gst/gstinfo.c: (gst_debug_compare_log_function_by_func),
+       (gst_debug_remove_log_function), (_gst_debug_nameof_funcptr):
+       Cast as appropriate.
+       * gst/gstobject.c: (gst_class_signal_connect):
+       Cast as appropriate.  The function pointer parameter really
+       has the wrong type but would break API if we change it.
+       * gst/gstquery.c:
+       Fix redefinition of _FILE_OFFSET_BITS caused on Solaris wrt
+       order of including string.h.
+       * gst/gstutils.c: (gst_element_state_get_name):
+       Remove unreachable line.
+       * gst/gstxml.c: (gst_xml_parse_doc):
+       Fix type mismatch.
+       All these caught by Forte.
+
+2006-10-06  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
+
+       Patch by: Josep Torre Valles <josep@fluendo.com>
+
        * common/m4/gst-error.m4:
        Fixed bug #360151.
        We need to disable warnings on Forte for empty declarations
index d1b6e9b..9e92bf0 100644 (file)
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -129,9 +129,9 @@ extern gint _gst_trace_on;
 
 /* defaults */
 #ifdef HAVE_FORK
-#define DEFAULT_FORK TRUE;
+#define DEFAULT_FORK TRUE
 #else
-#define DEFAULT_FORK FALSE;
+#define DEFAULT_FORK FALSE
 #endif /* HAVE_FORK */
 
 /* set to TRUE when segfaults need to be left as is, FIXME, this variable is
@@ -284,43 +284,49 @@ gst_init_get_option_group (void)
   GOptionGroup *group;
   const static GOptionEntry gst_args[] = {
     {"gst-version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-        parse_goption_arg, N_("Print the GStreamer version"), NULL},
+        (gpointer) parse_goption_arg, N_("Print the GStreamer version"), NULL},
     {"gst-fatal-warnings", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-        parse_goption_arg, N_("Make all warnings fatal"), NULL},
+        (gpointer) parse_goption_arg, N_("Make all warnings fatal"), NULL},
 #ifndef GST_DISABLE_GST_DEBUG
     {"gst-debug-help", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-          parse_goption_arg, N_("Print available debug categories and exit"),
+          (gpointer) parse_goption_arg,
+          N_("Print available debug categories and exit"),
         NULL},
-    {"gst-debug-level", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
+    {"gst-debug-level", 0, 0, G_OPTION_ARG_CALLBACK,
+          (gpointer) parse_goption_arg,
           N_("Default debug level from 1 (only error) to 5 (anything) or "
               "0 for no output"),
         N_("LEVEL")},
-    {"gst-debug", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
+    {"gst-debug", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) parse_goption_arg,
           N_("Comma-separated list of category_name:level pairs to set "
               "specific levels for the individual categories. Example: "
               "GST_AUTOPLUG:5,GST_ELEMENT_*:3"),
         N_("LIST")},
     {"gst-debug-no-color", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-        parse_goption_arg, N_("Disable colored debugging output"), NULL},
+        (gpointer) parse_goption_arg, N_("Disable colored debugging output"),
+          NULL},
     {"gst-debug-disable", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-        parse_goption_arg, N_("Disable debugging"), NULL},
+        (gpointer) parse_goption_arg, N_("Disable debugging"), NULL},
 #endif
     {"gst-plugin-spew", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-          parse_goption_arg, N_("Enable verbose plugin loading diagnostics"),
+          (gpointer) parse_goption_arg,
+          N_("Enable verbose plugin loading diagnostics"),
         NULL},
-    {"gst-plugin-path", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
+    {"gst-plugin-path", 0, 0, G_OPTION_ARG_CALLBACK,
+          (gpointer) parse_goption_arg,
         N_("Colon-separated paths containing plugins"), N_("PATHS")},
-    {"gst-plugin-load", 0, 0, G_OPTION_ARG_CALLBACK, parse_goption_arg,
+    {"gst-plugin-load", 0, 0, G_OPTION_ARG_CALLBACK,
+          (gpointer) parse_goption_arg,
           N_("Comma-separated list of plugins to preload in addition to the "
               "list stored in environment variable GST_PLUGIN_PATH"),
         N_("PLUGINS")},
     {"gst-disable-segtrap", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
-          parse_goption_arg,
+          (gpointer) parse_goption_arg,
           N_("Disable trapping of segmentation faults during plugin loading"),
         NULL},
     {"gst-disable-registry-fork", 0, G_OPTION_FLAG_NO_ARG,
           G_OPTION_ARG_CALLBACK,
-          parse_goption_arg,
+          (gpointer) parse_goption_arg,
           N_("Disable the use of fork() while scanning the registry"),
         NULL},
     {NULL}
index 8575958..f41557a 100644 (file)
@@ -1856,8 +1856,8 @@ gst_bin_change_state_func (GstElement * element, GstStateChange transition)
   gboolean done;
 
   /* we don't need to take the STATE_LOCK, it is already taken */
-  current = GST_STATE_TRANSITION_CURRENT (transition);
-  next = GST_STATE_TRANSITION_NEXT (transition);
+  current = (GstState) GST_STATE_TRANSITION_CURRENT (transition);
+  next = (GstState) GST_STATE_TRANSITION_NEXT (transition);
 
   GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
       "changing state of children from %s to %s",
index 83de7fc..a8afcfa 100644 (file)
@@ -1935,7 +1935,7 @@ gst_element_continue_state (GstElement * element, GstStateChangeReturn ret)
   GstStateChange transition;
 
   GST_OBJECT_LOCK (element);
-  old_ret = GST_STATE_RETURN (element);
+  old_ret = (GstState) GST_STATE_RETURN (element);
   GST_STATE_RETURN (element) = ret;
   pending = GST_STATE_PENDING (element);
 
@@ -1954,7 +1954,7 @@ gst_element_continue_state (GstElement * element, GstStateChangeReturn ret)
     goto complete;
 
   next = GST_STATE_GET_NEXT (current, pending);
-  transition = GST_STATE_TRANSITION (current, next);
+  transition = (GstStateChange) GST_STATE_TRANSITION (current, next);
 
   GST_STATE_NEXT (element) = next;
   /* mark busy */
@@ -2178,7 +2178,7 @@ gst_element_set_state_func (GstElement * element, GstState state)
   if (current != next)
     GST_STATE_RETURN (element) = GST_STATE_CHANGE_ASYNC;
 
-  transition = GST_STATE_TRANSITION (current, next);
+  transition = (GstStateChange) GST_STATE_TRANSITION (current, next);
 
   GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
       "%s: setting state from %s to %s",
@@ -2223,7 +2223,7 @@ gst_element_change_state (GstElement * element, GstStateChange transition)
   oclass = GST_ELEMENT_GET_CLASS (element);
 
   /* start with the current state. */
-  current = GST_STATE_TRANSITION_CURRENT (transition);
+  current = (GstState) GST_STATE_TRANSITION_CURRENT (transition);
   next = GST_STATE_TRANSITION_NEXT (transition);
 
   /* call the state change function so it can set the state */
@@ -2431,7 +2431,7 @@ gst_element_change_state_func (GstElement * element, GstStateChange transition)
 
   g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_CHANGE_FAILURE);
 
-  state = GST_STATE_TRANSITION_CURRENT (transition);
+  state = (GstState) GST_STATE_TRANSITION_CURRENT (transition);
   next = GST_STATE_TRANSITION_NEXT (transition);
 
   /* if the element already is in the given state, we just return success */
index 066e44c..bc0dffe 100644 (file)
@@ -755,7 +755,7 @@ gst_debug_add_log_function (GstLogFunction func, gpointer data)
 static gint
 gst_debug_compare_log_function_by_func (gconstpointer entry, gconstpointer func)
 {
-  gpointer entryfunc = ((LogFuncEntry *) entry)->func;
+  gpointer entryfunc = (gpointer) (((LogFuncEntry *) entry)->func);
 
   return (entryfunc < func) ? -1 : (entryfunc > func) ? 1 : 0;
 }
@@ -810,7 +810,7 @@ gst_debug_remove_log_function (GstLogFunction func)
 
   removals =
       gst_debug_remove_with_compare_func
-      (gst_debug_compare_log_function_by_func, func);
+      (gst_debug_compare_log_function_by_func, (gpointer) func);
   GST_DEBUG ("removed log function %p %d times from log function list", func,
       removals);
 
@@ -1212,7 +1212,6 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr ptr)
 /* This function MUST NOT return NULL */
      const gchar *_gst_debug_nameof_funcptr (GstDebugFuncPtr func)
 {
-  gpointer ptr = (gpointer) func;
   gchar *ptrname;
 
 #ifdef HAVE_DLADDR
@@ -1224,7 +1223,7 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr ptr)
 
   g_static_mutex_lock (&__dbg_functions_mutex);
   if (G_LIKELY (__gst_function_pointers)) {
-    ptrname = g_hash_table_lookup (__gst_function_pointers, ptr);
+    ptrname = g_hash_table_lookup (__gst_function_pointers, (gpointer) func);
     g_static_mutex_unlock (&__dbg_functions_mutex);
     if (G_LIKELY (ptrname))
       return ptrname;
@@ -1234,17 +1233,17 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr ptr)
   /* we need to create an entry in the hash table for this one so we don't leak
    * the name */
 #ifdef HAVE_DLADDR
-  if (dladdr (ptr, &dlinfo) && dlinfo.dli_sname) {
+  if (dladdr ((gpointer) func, &dlinfo) && dlinfo.dli_sname) {
     gchar *name = g_strdup (dlinfo.dli_sname);
 
-    _gst_debug_register_funcptr (ptr, name);
+    _gst_debug_register_funcptr (func, name);
     return name;
   } else
 #endif
   {
-    gchar *name = g_strdup_printf ("%p", ptr);
+    gchar *name = g_strdup_printf ("%p", (gpointer) func);
 
-    _gst_debug_register_funcptr (ptr, name);
+    _gst_debug_register_funcptr (func, name);
     return name;
   }
 }
index 9611c71..8ee95d5 100644 (file)
@@ -1201,7 +1201,10 @@ guint
 gst_class_signal_connect (GstObjectClass * klass,
     const gchar * name, gpointer func, gpointer func_data)
 {
-  return g_signal_connect (klass->signal_object, name, func, func_data);
+  /* [0.11] func parameter needs to be changed to a GCallback *
+   * doing so now would be an API break. */
+  return g_signal_connect (klass->signal_object, name, G_CALLBACK (func),
+      func_data);
 }
 
 #ifndef GST_DISABLE_LOADSAVE_REGISTRY
index f03a9e5..2d9750e 100644 (file)
@@ -59,8 +59,6 @@
  * Last reviewed on 2006-02-14 (0.10.4)
  */
 
-#include <string.h>
-
 #include "gst_private.h"
 #include "gstinfo.h"
 #include "gstquery.h"
index 92d87fd..b84c39c 100644 (file)
@@ -1031,7 +1031,6 @@ gst_element_state_get_name (GstState state)
       return g_strdup_printf ("UNKNOWN!(%d)", state);
 #endif
   }
-  return "";
 }
 
 /**
index a790aee..216bddd 100644 (file)
@@ -271,7 +271,7 @@ gst_xml_parse_doc (GstXML * xml, xmlDocPtr doc, const guchar * root)
   }
 
   gst_class_signal_connect (GST_OBJECT_CLASS (G_OBJECT_GET_CLASS (xml)),
-      "object_loaded", gst_xml_object_loaded, xml);
+      "object_loaded", (gpointer) gst_xml_object_loaded, xml);
 
   xml->ns = ns;