1. Add more warnings for the gst core only. Various trival fixes to quiet the warnings.
authorJoshua N. Pritikin <vishnu@pobox.com>
Fri, 14 Sep 2001 22:16:47 +0000 (22:16 +0000)
committerJoshua N. Pritikin <vishnu@pobox.com>
Fri, 14 Sep 2001 22:16:47 +0000 (22:16 +0000)
Original commit message from CVS:
1. Add more warnings for the gst core only.  Various trival fixes
to quiet the warnings.

2. Fix GstBufferCopyFunc prototype.

3. Re-apply the reverted type!=0 assertion in gst_elementfactory_new.

25 files changed:
gst/Makefile.am
gst/cothreads.h
gst/gstautoplug.c
gst/gstbin.c
gst/gstbuffer.c
gst/gstbuffer.h
gst/gstbufferpool.c
gst/gstelement.c
gst/gstelementfactory.c
gst/gstextratypes.c
gst/gstobject.c
gst/gstpad.c
gst/gstpad.h
gst/gstparse.c
gst/gstpipeline.c
gst/gstplugin.c
gst/gstpluginfeature.c
gst/gstqueue.c
gst/gstscheduler.c
gst/gstthread.c
gst/gsttype.c
gst/gsttypefind.c
gst/gstutils.c
gst/gstxml.c
plugins/elements/gstqueue.c

index 4eedfa2..be1307e 100644 (file)
@@ -201,7 +201,13 @@ CFLAGS = \
        $(LIBGST_CFLAGS) \
        -D_GNU_SOURCE \
        -DG_LOG_DOMAIN=g_log_domain_gstreamer \
-       -DGST_CONFIG_DIR=\""$(GST_CONFIG_DIR)"\"
+       -DGST_CONFIG_DIR=\""$(GST_CONFIG_DIR)"\" \
+       \
+       -W -Wpointer-arith -Wbad-function-cast \
+       -Wcast-align -Wsign-compare \
+       -Wmissing-prototypes -Wmissing-declarations \
+       -Wnested-externs \
+       -Winline -Wno-unused
 
 LIBS = $(LIBGST_LIBS)
 LDFLAGS = ""
index d33a45f..013ecd6 100644 (file)
@@ -66,7 +66,7 @@ struct _cothread_state {
 };
 
 
-cothread_context*              cothread_init();
+cothread_context*              cothread_init           (void);
 cothread_state*                        cothread_create         (cothread_context *ctx);
 void                           cothread_setfunc        (cothread_state *thread, cothread_func func,
                                                         int argc, char **argv);
index 3904845..af6a29f 100644 (file)
@@ -58,6 +58,7 @@ GType gst_autoplug_get_type(void)
       sizeof(GstAutoplug),
       4,
       (GInstanceInitFunc)gst_autoplug_init,
+      NULL
     };
     autoplug_type = g_type_register_static (GST_TYPE_OBJECT, "GstAutoplug", &autoplug_info, G_TYPE_FLAG_ABSTRACT);
   }
@@ -189,6 +190,7 @@ gst_autoplugfactory_get_type (void)
       sizeof(GstAutoplugFactory),
       0,
       (GInstanceInitFunc) gst_autoplugfactory_init,
+      NULL
     };
     autoplugfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE, 
                                                  "GstAutoplugFactory", &autoplugfactory_info, 0);
index de2cf71..ae13d09 100644 (file)
@@ -87,6 +87,7 @@ gst_bin_get_type (void)
       sizeof(GstBin),
       8,
       (GInstanceInitFunc)gst_bin_init,
+      NULL
     };
     bin_type = g_type_register_static (GST_TYPE_ELEMENT, "GstBin", &bin_info, 0);
   }
@@ -170,7 +171,7 @@ gst_bin_reset_element_sched (GstElement *element, GstSchedule *sched)
 //    GST_SCHEDULE_ADD_ELEMENT (sched, element);
 }
 
-void
+static void
 gst_bin_set_element_sched (GstElement *element,GstSchedule *sched)
 {
   GList *children;
@@ -211,7 +212,7 @@ gst_bin_set_element_sched (GstElement *element,GstSchedule *sched)
 }
 
 
-void
+static void
 gst_bin_unset_element_sched (GstElement *element)
 {
   GList *children;
index 3970c60..8645ead 100644 (file)
@@ -357,7 +357,7 @@ gst_buffer_copy (GstBuffer *buffer)
 
   // if a copy function exists, use it, else copy the bytes
   if (buffer->copy != NULL) {
-    (buffer->copy)(buffer,newbuf);
+    newbuf = (buffer->copy)(buffer);
   } else {
     // copy the absolute size
     newbuf->size = buffer->size;
index 7e27e3a..269bf3e 100644 (file)
@@ -86,8 +86,8 @@ typedef enum {
 typedef struct _GstBuffer GstBuffer;
 
 
-typedef void   (*GstBufferFreeFunc)    (GstBuffer *buf);
-typedef void   (*GstBufferCopyFunc)    (GstBuffer *srcbuf,GstBuffer *dstbuf);
+typedef void       (*GstBufferFreeFunc)        (GstBuffer *buf);
+typedef GstBuffer *(*GstBufferCopyFunc)        (GstBuffer *srcbuf);
 
 
 #include <gst/gstbufferpool.h>
index b3910f1..c742be0 100644 (file)
@@ -194,7 +194,8 @@ gst_buffer_pool_set_buffer_free_function (GstBufferPool *pool,
  * @destroy: the copy function
  *
  * Sets the function that will be called when a buffer is copied.
- * You can use the default GstBuffer implementation (gst_buffer_copy) if you like.
+ *
+ * You may use the default GstBuffer implementation (gst_buffer_copy).
  */
 void 
 gst_buffer_pool_set_buffer_copy_function (GstBufferPool *pool, 
index 7ea5d11..673def6 100644 (file)
@@ -83,6 +83,7 @@ GType gst_element_get_type(void) {
       sizeof(GstElement),
       0,
       (GInstanceInitFunc)gst_element_init,
+      NULL
     };
     element_type = g_type_register_static(GST_TYPE_OBJECT, "GstElement", &element_info, G_TYPE_FLAG_ABSTRACT);
   }
index 7e92d14..4ff1aee 100644 (file)
@@ -57,6 +57,7 @@ gst_elementfactory_get_type (void)
       sizeof(GstElementFactory),
       0,
       (GInstanceInitFunc) gst_elementfactory_init,
+      NULL
     };
     elementfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE, 
                                                  "GstElementFactory", &elementfactory_info, 0);
@@ -176,6 +177,7 @@ gst_elementfactory_new (const gchar *name, GType type,
   GstElementFactory *factory;
 
   g_return_val_if_fail(name != NULL, NULL);
+  g_return_val_if_fail (type, NULL);
   g_return_val_if_fail (details, NULL);
 
   factory = gst_elementfactory_find (name);
index 162bdb5..032f9ef 100644 (file)
@@ -41,6 +41,7 @@ gst_extra_get_filename_type (void)
       0, //sizeof(GstElement),
       0,
       NULL,
+      NULL
     };
     filename_type = g_type_register_static (G_TYPE_STRING, "GstFilename", &filename_info, 0);
   }
index b7df0fc..0d2fb5d 100644 (file)
@@ -78,6 +78,7 @@ gst_object_get_type (void)
       sizeof (GstObject),
       32,
       (GInstanceInitFunc) gst_object_init,
+      NULL
     };
     object_type = g_type_register_static (G_TYPE_OBJECT, "GstObject", &object_info, G_TYPE_FLAG_ABSTRACT);
   }
@@ -608,6 +609,7 @@ gst_signal_object_get_type (void)
       sizeof(GstSignalObject),
       16,
       (GInstanceInitFunc)gst_signal_object_init,
+      NULL
     };
     signal_object_type = g_type_register_static(G_TYPE_OBJECT, "GstSignalObject", &signal_object_info, 0);
   }
index fc5edb9..8221253 100644 (file)
@@ -55,6 +55,7 @@ gst_pad_get_type(void) {
       sizeof(GstPad),
       32,
       (GInstanceInitFunc)gst_pad_init,
+      NULL
     };
     pad_type = g_type_register_static(GST_TYPE_OBJECT, "GstPad", &pad_info, 0);
   }
@@ -124,6 +125,7 @@ gst_real_pad_get_type(void) {
       sizeof(GstRealPad),
       32,
       (GInstanceInitFunc)gst_real_pad_init,
+      NULL
     };
     pad_type = g_type_register_static(GST_TYPE_PAD, "GstRealPad", &pad_info, 0);
   }
@@ -1442,7 +1444,9 @@ gst_pad_push (GstPad *pad, GstBuffer *buf)
           GST_DEBUG_FUNCPTR_NAME (peer->chainhandler), GST_DEBUG_PAD_NAME (((GstPad*)peer)));
     (peer->chainhandler) (((GstPad*)peer), buf);
   } else
-    GST_DEBUG (GST_CAT_DATAFLOW, "no chainhandler\n");
+    {
+      GST_DEBUG (GST_CAT_DATAFLOW, "no chainhandler\n");
+    }
 }
 #endif
 
@@ -1633,6 +1637,7 @@ gst_padtemplate_get_type (void)
       sizeof(GstPadTemplate),
       32,
       (GInstanceInitFunc)gst_padtemplate_init,
+      NULL
     };
     padtemplate_type = g_type_register_static(GST_TYPE_OBJECT, "GstPadTemplate", &padtemplate_info, 0);
   }
@@ -1882,6 +1887,7 @@ gst_ghost_pad_get_type(void) {
       sizeof(GstGhostPad),
       8,
       (GInstanceInitFunc)gst_ghost_pad_init,
+      NULL
     };
     pad_type = g_type_register_static(GST_TYPE_PAD, "GstGhostPad", &pad_info, 0);
   }
index a108191..cda8b22 100644 (file)
@@ -400,6 +400,9 @@ GstCaps*            gst_padtemplate_get_caps_by_name        (GstPadTemplate *templ, const gchar *
 xmlNodePtr             gst_padtemplate_save_thyself    (GstPadTemplate *templ, xmlNodePtr parent);
 GstPadTemplate*                gst_padtemplate_load_thyself    (xmlNodePtr parent);
 
+xmlNodePtr              gst_pad_ghost_save_thyself   (GstPad *pad,
+                                                     GstElement *bin,
+                                                     xmlNodePtr parent);
 
 #ifdef __cplusplus
 }
index 8e2fbf8..9db99ba 100644 (file)
@@ -88,9 +88,11 @@ dynamic_connect (GstElement *element, GstPad *newpad, gpointer data)
 static gchar *
 gst_parse_unique_name(gchar *type,gst_parse_priv *priv)
 {
+  gpointer tmp;
   gint count;
 
-  count = GPOINTER_TO_INT(g_hash_table_lookup(priv->elementcounts,type));
+  tmp = g_hash_table_lookup (priv->elementcounts,type);
+  count = GPOINTER_TO_INT (tmp);
   count++;
   g_hash_table_insert(priv->elementcounts,type,GINT_TO_POINTER(count));
 
@@ -467,9 +469,10 @@ GST_DEBUG_PAD_NAME(temppad),GST_ELEMENT_NAME (parent),GST_PAD_NAME(temppad));
 
   if (retval) return retval;
 
-  if (closingchar != '\0')
-    DEBUG("returning IN THE WRONG PLACE\n");
-  else DEBUG("ending pipeline\n");
+  DEBUG (closingchar != '\0'?
+        "returning IN THE WRONG PLACE\n" : 
+        "ending pipeline\n");
+
   return i+1;
 }
 
index 85a67da..18c73fc 100644 (file)
@@ -75,6 +75,7 @@ gst_pipeline_get_type (void) {
       sizeof(GstPipeline),
       0,
       (GInstanceInitFunc)gst_pipeline_init,
+      NULL
     };
     pipeline_type = g_type_register_static (GST_TYPE_BIN, "GstPipeline", &pipeline_info, 0);
   }
index 128ae2a..a540a77 100644 (file)
@@ -674,7 +674,7 @@ gst_plugin_find_feature_func (GstPlugin *plugin, const gchar *name, GType type)
   return NULL;
 }
 
-GstPluginFeature*
+static GstPluginFeature*
 gst_plugin_find_feature (const gchar *name, GType type)
 {
   GList *plugins;
index 7e81444..11021ef 100644 (file)
@@ -51,6 +51,7 @@ gst_plugin_feature_get_type (void)
       sizeof (GstObject),
       32,
       (GInstanceInitFunc) gst_plugin_feature_init,
+      NULL
     };
     plugin_feature_type = g_type_register_static (GST_TYPE_OBJECT, "GstPluginFeature", 
                                                  &plugin_feature_info, G_TYPE_FLAG_ABSTRACT);
index fdf8bfe..08cc5f8 100644 (file)
@@ -121,6 +121,7 @@ gst_queue_get_type(void)
       sizeof(GstQueue),
       4,
       (GInstanceInitFunc)gst_queue_init,
+      NULL
     };
     queue_type = g_type_register_static (GST_TYPE_ELEMENT, "GstQueue", &queue_info, 0);
   }
index 77f01d0..b24012d 100644 (file)
@@ -842,6 +842,7 @@ GType gst_schedule_get_type(void) {
       sizeof(GstSchedule),
       0,
       (GInstanceInitFunc)gst_schedule_init,
+      NULL
     };
     schedule_type = g_type_register_static(GST_TYPE_OBJECT, "GstSchedule", &schedule_info, 0);
   }
@@ -910,7 +911,7 @@ GstElement *gst_schedule_check_pad (GstSchedule *sched, GstPad *pad) {
 }
 */
 
-GstScheduleChain *
+static GstScheduleChain *
 gst_schedule_chain_new (GstSchedule *sched)
 {
   GstScheduleChain *chain = g_new (GstScheduleChain, 1);
@@ -934,7 +935,7 @@ gst_schedule_chain_new (GstSchedule *sched)
   return chain;
 }
 
-void
+static void
 gst_schedule_chain_destroy (GstScheduleChain *chain)
 {
   GstSchedule *sched = chain->sched;
@@ -951,7 +952,7 @@ gst_schedule_chain_destroy (GstScheduleChain *chain)
   GST_INFO (GST_CAT_SCHEDULING, "destroyed chain %p, now are %d chains in sched %p",chain,sched->num_chains,sched);
 }
 
-void
+static void
 gst_schedule_chain_add_element (GstScheduleChain *chain, GstElement *element)
 {
   GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to chain %p", GST_ELEMENT_NAME (element),chain);
@@ -964,7 +965,7 @@ gst_schedule_chain_add_element (GstScheduleChain *chain, GstElement *element)
   chain->num_elements++;
 }
 
-void
+static void
 gst_schedule_chain_enable_element (GstScheduleChain *chain, GstElement *element)
 {
   GST_INFO (GST_CAT_SCHEDULING, "enabling element \"%s\" in chain %p", GST_ELEMENT_NAME (element),chain);
@@ -979,7 +980,7 @@ gst_schedule_chain_enable_element (GstScheduleChain *chain, GstElement *element)
   gst_schedule_cothreaded_chain(GST_BIN(chain->sched->parent),chain);
 }
 
-void
+static void
 gst_schedule_chain_disable_element (GstScheduleChain *chain, GstElement *element)
 {
   GST_INFO (GST_CAT_SCHEDULING, "disabling element \"%s\" in chain %p", GST_ELEMENT_NAME (element),chain);
@@ -995,7 +996,7 @@ gst_schedule_chain_disable_element (GstScheduleChain *chain, GstElement *element
 //  gst_schedule_cothreaded_chain(GST_BIN(chain->sched->parent),chain);
 }
 
-void
+static void
 gst_schedule_chain_remove_element (GstScheduleChain *chain, GstElement *element)
 {
   GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from chain %p", GST_ELEMENT_NAME (element),chain);
@@ -1017,7 +1018,7 @@ gst_schedule_chain_remove_element (GstScheduleChain *chain, GstElement *element)
   element->sched = NULL;
 }
 
-void
+static void
 gst_schedule_chain_elements (GstSchedule *sched, GstElement *element1, GstElement *element2)
 {
   GList *chains;
@@ -1103,7 +1104,7 @@ GST_ELEMENT_SCHED(srcelement),GST_ELEMENT_SCHED(sinkelement));
 }
 
 // find the chain within the schedule that holds the element, if any
-GstScheduleChain *
+static GstScheduleChain *
 gst_schedule_find_chain (GstSchedule *sched, GstElement *element)
 {
   GList *chains;
@@ -1125,7 +1126,7 @@ gst_schedule_find_chain (GstSchedule *sched, GstElement *element)
   return NULL;
 }
 
-void
+static void
 gst_schedule_chain_recursive_add (GstScheduleChain *chain, GstElement *element)
 {
   GList *pads;
index 23a91c1..06a1c7c 100644 (file)
@@ -95,6 +95,7 @@ gst_thread_get_type(void) {
       sizeof(GstThread),
       4,
       (GInstanceInitFunc)gst_thread_init,
+      NULL
     };
     thread_type = g_type_register_static(GST_TYPE_BIN, "GstThread", &thread_info, 0);
   }
index 99bee4c..feeac26 100644 (file)
@@ -69,6 +69,7 @@ gst_typefactory_get_type (void)
       sizeof(GstTypeFactory),
       0,
       (GInstanceInitFunc) gst_typefactory_init,
+      NULL
     };
     typefactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
                                                "GstTypeFactory", &typefactory_info, 0);
index 09894e0..44a557e 100644 (file)
@@ -81,6 +81,7 @@ gst_typefind_get_type (void)
       sizeof(GstTypeFind),
       0,
       (GInstanceInitFunc)gst_typefind_init,
+      NULL
     };
     typefind_type = g_type_register_static (GST_TYPE_ELEMENT, "GstTypeFind", &typefind_info, 0);
   }
index 7681ad3..ccd9446 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "gstextratypes.h"
 
+#define ZERO(mem) memset(&mem, 0, sizeof(mem))
+
 /**
  * gst_util_get_int_arg:
  * @object: the object to query
@@ -40,8 +42,9 @@
 gint
 gst_util_get_int_arg (GObject *object, const gchar *argname) 
 {
-  GValue value = {0, };
+  GValue value;
 
+  ZERO (value);
   g_value_init (&value, G_TYPE_INT);
   g_object_get_property(G_OBJECT(object),argname,&value);
 
@@ -60,8 +63,9 @@ gst_util_get_int_arg (GObject *object, const gchar *argname)
 gint
 gst_util_get_bool_arg (GObject *object, const gchar *argname) 
 {
-  GValue value = {0, };
+  GValue value;
 
+  ZERO (value);
   g_value_init (&value, G_TYPE_BOOLEAN);
   g_object_get_property(G_OBJECT(object),argname,&value);
 
@@ -80,8 +84,9 @@ gst_util_get_bool_arg (GObject *object, const gchar *argname)
 glong
 gst_util_get_long_arg (GObject *object, const gchar *argname) 
 {
-  GValue value = {0, };
+  GValue value;
 
+  ZERO (value);
   g_value_init (&value, G_TYPE_LONG);
   g_object_get_property(G_OBJECT(object),argname,&value);
 
@@ -100,8 +105,9 @@ gst_util_get_long_arg (GObject *object, const gchar *argname)
 gfloat
 gst_util_get_float_arg (GObject *object, const gchar *argname) 
 {
-  GValue value = {0, };
+  GValue value;
 
+  ZERO (value);
   g_value_init (&value, G_TYPE_FLOAT);
   g_object_get_property(G_OBJECT(object),argname,&value);
 
@@ -120,8 +126,9 @@ gst_util_get_float_arg (GObject *object, const gchar *argname)
 gdouble 
 gst_util_get_double_arg (GObject *object, const gchar *argname) 
 {
-  GValue value = {0, };
+  GValue value;
 
+  ZERO (value);
   g_value_init (&value, G_TYPE_DOUBLE);
   g_object_get_property(G_OBJECT(object),argname,&value);
 
@@ -140,12 +147,13 @@ gst_util_get_double_arg (GObject *object, const gchar *argname)
  const gchar*
 gst_util_get_string_arg (GObject *object, const gchar *argname) 
 {
-  GValue value = {0, };
+  GValue value;
 
+  ZERO (value);
   g_value_init (&value, G_TYPE_STRING);
   g_object_get_property(G_OBJECT(object),argname,&value);
 
-  return g_value_get_string(&value);
+  return g_value_get_string(&value);  // memleak?
 }
 
 /**
@@ -160,8 +168,9 @@ gst_util_get_string_arg (GObject *object, const gchar *argname)
 gpointer
 gst_util_get_pointer_arg (GObject *object, const gchar *argname) 
 {
-  GValue value = {0, };
+  GValue value;
 
+  ZERO (value);
   g_value_init (&value, G_TYPE_POINTER);
   g_object_get_property(G_OBJECT(object),argname,&value);
 
index 54d311c..5d29e21 100644 (file)
@@ -54,6 +54,7 @@ gst_xml_get_type(void)
       sizeof(GstXML),
       0,
       (GInstanceInitFunc)gst_xml_init,
+      NULL
     };
     xml_type = g_type_register_static (GST_TYPE_OBJECT, "GstXml", &xml_info, 0);
   }
index fdf8bfe..08cc5f8 100644 (file)
@@ -121,6 +121,7 @@ gst_queue_get_type(void)
       sizeof(GstQueue),
       4,
       (GInstanceInitFunc)gst_queue_init,
+      NULL
     };
     queue_type = g_type_register_static (GST_TYPE_ELEMENT, "GstQueue", &queue_info, 0);
   }