diff --git a/ChangeLog b/ChangeLog index 0e6973dc25..fbaf6a22c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2004-11-02 Kjartan Maraas + + reviewed by: Wim Taymans, Ronald Bultje. + + * gst/cothreads.c: (cothread_create): + * gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func), + (gst_bin_child_state_change_func): + * gst/gstbuffer.c: (gst_buffer_span): + * gst/gstelement.c: (gst_element_get_index), + (gst_element_get_event_masks), (gst_element_get_query_types), + (gst_element_get_formats): + * gst/gsterror.c: (_gst_core_errors_init), + (_gst_library_errors_init), (_gst_resource_errors_init), + (_gst_stream_errors_init): + * gst/gstobject.c: (gst_object_default_deep_notify): + * gst/gstpad.c: (gst_pad_get_event_masks), + (gst_pad_get_internal_links_default): + * gst/gstplugin.c: (gst_plugin_register_func), + (gst_plugin_get_module): + * gst/gststructure.c: (gst_structure_get_string), + (gst_structure_get_abbrs), (gst_structure_from_abbr), + (gst_structure_to_abbr): + * gst/gstutils.c: (gst_print_element_args): + * gst/schedulers/gstoptimalscheduler.c: (add_to_group), + (setup_group_scheduler), (gst_opt_scheduler_iterate): + Aplied part of patch #157127: Cleanup of issues reported by + sparse. + Also do not try to use cothreads when there is no cothread + context yet. + 2004-11-02 Sebastien Cote * gst/schedulers/gstoptimalscheduler.c: (add_to_group), diff --git a/gst/cothreads.c b/gst/cothreads.c index edc71e6798..625e02a3c2 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -224,7 +224,7 @@ cothread_state * cothread_create (cothread_context * ctx) { cothread_state *cothread; - void *mmaped = 0; + void *mmaped = NULL; gint slot = 0; unsigned long page_size; diff --git a/gst/gstbin.c b/gst/gstbin.c index c6078ad2ef..30d476fa5f 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -485,7 +485,7 @@ gst_bin_add_func (GstBin * bin, GstElement * element) /* bump our internal state counter */ state = GST_STATE (element); - while (state >>= 1) + while ((state >>= 1) != 0) state_idx++; bin->child_states[state_idx]++; @@ -558,7 +558,7 @@ gst_bin_remove_func (GstBin * bin, GstElement * element) /* bump our internal state counter */ state = GST_STATE (element); - while (state >>= 1) + while ((state >>= 1) != 0) state_idx++; bin->child_states[state_idx]--; @@ -691,9 +691,9 @@ gst_bin_child_state_change_func (GstBin * bin, GstElementState oldstate, old = oldstate; new = newstate; - while (old >>= 1) + while ((old >>= 1) != 0) old_idx++; - while (new >>= 1) + while ((new >>= 1) != 0) new_idx++; GST_LOCK (bin); diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 80ca7e162e..79015398f4 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -435,7 +435,7 @@ gst_buffer_span (GstBuffer * buf1, guint32 offset, GstBuffer * buf2, { GstBuffer *newbuf; - g_return_val_if_fail (buf1 != NULL && buf2 != NULL, FALSE); + g_return_val_if_fail (buf1 != NULL && buf2 != NULL, NULL); g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buf1) > 0, NULL); g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buf2) > 0, NULL); g_return_val_if_fail (len > 0, NULL); diff --git a/gst/gstelement.c b/gst/gstelement.c index 6bc8df9498..a1b7aaa0ff 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -1058,7 +1058,7 @@ gst_element_get_index (GstElement * element) { GstElementClass *oclass; - g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); + g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); oclass = GST_ELEMENT_GET_CLASS (element); @@ -2255,7 +2255,7 @@ gst_element_get_event_masks (GstElement * element) { GstElementClass *oclass; - g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); + g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); oclass = GST_ELEMENT_GET_CLASS (element); @@ -2268,7 +2268,7 @@ gst_element_get_event_masks (GstElement * element) return gst_pad_get_event_masks (GST_PAD_PEER (pad)); } - return FALSE; + return NULL; } /** @@ -2341,7 +2341,7 @@ gst_element_get_query_types (GstElement * element) { GstElementClass *oclass; - g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); + g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); oclass = GST_ELEMENT_GET_CLASS (element); @@ -2354,7 +2354,7 @@ gst_element_get_query_types (GstElement * element) return gst_pad_get_query_types (GST_PAD_PEER (pad)); } - return FALSE; + return NULL; } /** @@ -2414,7 +2414,7 @@ gst_element_get_formats (GstElement * element) { GstElementClass *oclass; - g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); + g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); oclass = GST_ELEMENT_GET_CLASS (element); @@ -2427,7 +2427,7 @@ gst_element_get_formats (GstElement * element) return gst_pad_get_formats (GST_PAD_PEER (pad)); } - return FALSE; + return NULL; } /** diff --git a/gst/gsterror.c b/gst/gsterror.c index 2b4b2361ca..a8acb6b154 100644 --- a/gst/gsterror.c +++ b/gst/gsterror.c @@ -46,7 +46,7 @@ gst_g_error_get_type (void) /* initialize the dynamic table of translated core errors */ static gchar ** -_gst_core_errors_init () +_gst_core_errors_init (void) { gchar **t = NULL; @@ -83,7 +83,7 @@ _gst_core_errors_init () /* initialize the dynamic table of translated library errors */ static gchar ** -_gst_library_errors_init () +_gst_library_errors_init (void) { gchar **t = NULL; @@ -103,7 +103,7 @@ _gst_library_errors_init () /* initialize the dynamic table of translated resource errors */ static gchar ** -_gst_resource_errors_init () +_gst_resource_errors_init (void) { gchar **t = NULL; @@ -133,7 +133,7 @@ _gst_resource_errors_init () /* initialize the dynamic table of translated stream errors */ static gchar ** -_gst_stream_errors_init () +_gst_stream_errors_init (void) { gchar **t = NULL; diff --git a/gst/gstobject.c b/gst/gstobject.c index a12d876aa8..536c6f4c4b 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -395,7 +395,7 @@ gst_object_default_deep_notify (GObject * object, GstObject * orig, GParamSpec * pspec, gchar ** excluded_props) { GValue value = { 0, }; /* the important thing is that value.type = 0 */ - gchar *str = 0; + gchar *str = NULL; gchar *name = NULL; if (pspec->flags & G_PARAM_READABLE) { diff --git a/gst/gstpad.c b/gst/gstpad.c index f801cbc31e..d60c9d3835 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -626,7 +626,7 @@ gst_pad_get_event_masks (GstPad * pad) rpad = GST_PAD_REALIZE (pad); - g_return_val_if_fail (rpad, FALSE); + g_return_val_if_fail (rpad, NULL); if (GST_RPAD_EVENTMASKFUNC (rpad)) return GST_RPAD_EVENTMASKFUNC (rpad) (GST_PAD (pad)); @@ -3897,7 +3897,7 @@ gst_pad_get_internal_links_default (GstPad * pad) GstPadDirection direction; GstRealPad *rpad; - g_return_val_if_fail (GST_IS_PAD (pad), FALSE); + g_return_val_if_fail (GST_IS_PAD (pad), NULL); rpad = GST_PAD_REALIZE (pad); direction = rpad->direction; diff --git a/gst/gstplugin.c b/gst/gstplugin.c index a3b38fc609..429853c724 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -50,10 +50,10 @@ static GList *_gst_plugin_static = NULL; /* static variables for segfault handling of plugin loading */ static char *_gst_plugin_fault_handler_filename = NULL; -extern gboolean *_gst_disable_segtrap; /* see gst.c */ +extern gboolean _gst_disable_segtrap; /* see gst.c */ #ifndef HAVE_WIN32 -static gboolean *_gst_plugin_fault_handler_is_setup = FALSE; +static gboolean _gst_plugin_fault_handler_is_setup = FALSE; #endif /* list of valid licenses. @@ -187,21 +187,21 @@ gst_plugin_register_func (GstPlugin * plugin, GModule * module, if (GST_CAT_DEFAULT) GST_INFO ("plugin \"%s\" has incompatible version, not loading", plugin->filename); - return FALSE; + return NULL; } if (!desc->license || !desc->description || !desc->package || !desc->origin) { if (GST_CAT_DEFAULT) GST_INFO ("plugin \"%s\" has incorrect GstPluginDesc, not loading", plugin->filename); - return FALSE; + return NULL; } if (!gst_plugin_check_license (desc->license)) { if (GST_CAT_DEFAULT) GST_INFO ("plugin \"%s\" has invalid license \"%s\", not loading", plugin->filename, desc->license); - return FALSE; + return NULL; } if (GST_CAT_DEFAULT) @@ -214,7 +214,7 @@ gst_plugin_register_func (GstPlugin * plugin, GModule * module, if (GST_CAT_DEFAULT) GST_INFO ("plugin \"%s\" failed to initialise", plugin->filename); plugin->module = NULL; - return FALSE; + return NULL; } if (GST_CAT_DEFAULT) @@ -639,7 +639,7 @@ gst_plugin_get_origin (GstPlugin * plugin) GModule * gst_plugin_get_module (GstPlugin * plugin) { - g_return_val_if_fail (plugin != NULL, FALSE); + g_return_val_if_fail (plugin != NULL, NULL); return plugin->module; } diff --git a/gst/gststructure.c b/gst/gststructure.c index 3cf6a4ee57..b456c56c61 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -973,9 +973,9 @@ gst_structure_get_string (const GstStructure * structure, field = gst_structure_get_field (structure, fieldname); if (field == NULL) - return FALSE; + return NULL; if (!G_VALUE_HOLDS_STRING (&field->value)) - return FALSE; + return NULL; return g_value_get_string (&field->value); } diff --git a/gst/gstutils.c b/gst/gstutils.c index 4df7e623c4..e00e23e612 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -332,7 +332,7 @@ gst_print_element_args (GString * buf, gint indent, GstElement * element) { guint width; GValue value = { 0, }; /* the important thing is that value.type = 0 */ - gchar *str = 0; + gchar *str = NULL; GParamSpec *spec, **specs, **walk; specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element), NULL); diff --git a/gst/schedulers/gstoptimalscheduler.c b/gst/schedulers/gstoptimalscheduler.c index da699b957c..398e47dd9e 100644 --- a/gst/schedulers/gstoptimalscheduler.c +++ b/gst/schedulers/gstoptimalscheduler.c @@ -1017,12 +1017,16 @@ setup_group_scheduler (GstOptScheduler * osched, GstOptSchedulerGroup * group) wrapper = loop_group_schedule_function; #ifdef USE_COTHREADS - if (!(group->flags & GST_OPT_SCHEDULER_GROUP_SCHEDULABLE)) { - do_cothread_create (group->cothread, osched->context, - (cothread_func) wrapper, 0, (char **) group); - } else { - do_cothread_setfunc (group->cothread, osched->context, - (cothread_func) wrapper, 0, (char **) group); + /* we can only initialize the cothread stuff when we have + * a cothread context */ + if (osched->context) { + if (!(group->flags & GST_OPT_SCHEDULER_GROUP_SCHEDULABLE)) { + do_cothread_create (group->cothread, osched->context, + (cothread_func) wrapper, 0, (char **) group); + } else { + do_cothread_setfunc (group->cothread, osched->context, + (cothread_func) wrapper, 0, (char **) group); + } } #else group->schedulefunc = wrapper;