gst/: Aplied part of patch #157127: Cleanup of issues reported by sparse.

Original commit message from CVS:
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.
This commit is contained in:
Wim Taymans 2004-11-02 15:02:12 +00:00
parent 6a110e062f
commit 6d42edd550
12 changed files with 70 additions and 36 deletions

View file

@ -1,3 +1,33 @@
2004-11-02 Kjartan Maraas <as at gnome.org>
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 <sc5 at hermes.usherb.ca> 2004-11-02 Sebastien Cote <sc5 at hermes.usherb.ca>
* gst/schedulers/gstoptimalscheduler.c: (add_to_group), * gst/schedulers/gstoptimalscheduler.c: (add_to_group),

View file

@ -224,7 +224,7 @@ cothread_state *
cothread_create (cothread_context * ctx) cothread_create (cothread_context * ctx)
{ {
cothread_state *cothread; cothread_state *cothread;
void *mmaped = 0; void *mmaped = NULL;
gint slot = 0; gint slot = 0;
unsigned long page_size; unsigned long page_size;

View file

@ -485,7 +485,7 @@ gst_bin_add_func (GstBin * bin, GstElement * element)
/* bump our internal state counter */ /* bump our internal state counter */
state = GST_STATE (element); state = GST_STATE (element);
while (state >>= 1) while ((state >>= 1) != 0)
state_idx++; state_idx++;
bin->child_states[state_idx]++; bin->child_states[state_idx]++;
@ -558,7 +558,7 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
/* bump our internal state counter */ /* bump our internal state counter */
state = GST_STATE (element); state = GST_STATE (element);
while (state >>= 1) while ((state >>= 1) != 0)
state_idx++; state_idx++;
bin->child_states[state_idx]--; bin->child_states[state_idx]--;
@ -691,9 +691,9 @@ gst_bin_child_state_change_func (GstBin * bin, GstElementState oldstate,
old = oldstate; old = oldstate;
new = newstate; new = newstate;
while (old >>= 1) while ((old >>= 1) != 0)
old_idx++; old_idx++;
while (new >>= 1) while ((new >>= 1) != 0)
new_idx++; new_idx++;
GST_LOCK (bin); GST_LOCK (bin);

View file

@ -435,7 +435,7 @@ gst_buffer_span (GstBuffer * buf1, guint32 offset, GstBuffer * buf2,
{ {
GstBuffer *newbuf; 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 (buf1) > 0, NULL);
g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buf2) > 0, NULL); g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buf2) > 0, NULL);
g_return_val_if_fail (len > 0, NULL); g_return_val_if_fail (len > 0, NULL);

View file

@ -1058,7 +1058,7 @@ gst_element_get_index (GstElement * element)
{ {
GstElementClass *oclass; 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); oclass = GST_ELEMENT_GET_CLASS (element);
@ -2255,7 +2255,7 @@ gst_element_get_event_masks (GstElement * element)
{ {
GstElementClass *oclass; 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); 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 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; 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); 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 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; 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); 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 gst_pad_get_formats (GST_PAD_PEER (pad));
} }
return FALSE; return NULL;
} }
/** /**

View file

@ -46,7 +46,7 @@ gst_g_error_get_type (void)
/* initialize the dynamic table of translated core errors */ /* initialize the dynamic table of translated core errors */
static gchar ** static gchar **
_gst_core_errors_init () _gst_core_errors_init (void)
{ {
gchar **t = NULL; gchar **t = NULL;
@ -83,7 +83,7 @@ _gst_core_errors_init ()
/* initialize the dynamic table of translated library errors */ /* initialize the dynamic table of translated library errors */
static gchar ** static gchar **
_gst_library_errors_init () _gst_library_errors_init (void)
{ {
gchar **t = NULL; gchar **t = NULL;
@ -103,7 +103,7 @@ _gst_library_errors_init ()
/* initialize the dynamic table of translated resource errors */ /* initialize the dynamic table of translated resource errors */
static gchar ** static gchar **
_gst_resource_errors_init () _gst_resource_errors_init (void)
{ {
gchar **t = NULL; gchar **t = NULL;
@ -133,7 +133,7 @@ _gst_resource_errors_init ()
/* initialize the dynamic table of translated stream errors */ /* initialize the dynamic table of translated stream errors */
static gchar ** static gchar **
_gst_stream_errors_init () _gst_stream_errors_init (void)
{ {
gchar **t = NULL; gchar **t = NULL;

View file

@ -395,7 +395,7 @@ gst_object_default_deep_notify (GObject * object, GstObject * orig,
GParamSpec * pspec, gchar ** excluded_props) GParamSpec * pspec, gchar ** excluded_props)
{ {
GValue value = { 0, }; /* the important thing is that value.type = 0 */ GValue value = { 0, }; /* the important thing is that value.type = 0 */
gchar *str = 0; gchar *str = NULL;
gchar *name = NULL; gchar *name = NULL;
if (pspec->flags & G_PARAM_READABLE) { if (pspec->flags & G_PARAM_READABLE) {

View file

@ -626,7 +626,7 @@ gst_pad_get_event_masks (GstPad * pad)
rpad = GST_PAD_REALIZE (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)) if (GST_RPAD_EVENTMASKFUNC (rpad))
return GST_RPAD_EVENTMASKFUNC (rpad) (GST_PAD (pad)); return GST_RPAD_EVENTMASKFUNC (rpad) (GST_PAD (pad));
@ -3897,7 +3897,7 @@ gst_pad_get_internal_links_default (GstPad * pad)
GstPadDirection direction; GstPadDirection direction;
GstRealPad *rpad; 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); rpad = GST_PAD_REALIZE (pad);
direction = rpad->direction; direction = rpad->direction;

View file

@ -50,10 +50,10 @@ static GList *_gst_plugin_static = NULL;
/* static variables for segfault handling of plugin loading */ /* static variables for segfault handling of plugin loading */
static char *_gst_plugin_fault_handler_filename = NULL; 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 #ifndef HAVE_WIN32
static gboolean *_gst_plugin_fault_handler_is_setup = FALSE; static gboolean _gst_plugin_fault_handler_is_setup = FALSE;
#endif #endif
/* list of valid licenses. /* list of valid licenses.
@ -187,21 +187,21 @@ gst_plugin_register_func (GstPlugin * plugin, GModule * module,
if (GST_CAT_DEFAULT) if (GST_CAT_DEFAULT)
GST_INFO ("plugin \"%s\" has incompatible version, not loading", GST_INFO ("plugin \"%s\" has incompatible version, not loading",
plugin->filename); plugin->filename);
return FALSE; return NULL;
} }
if (!desc->license || !desc->description || !desc->package || !desc->origin) { if (!desc->license || !desc->description || !desc->package || !desc->origin) {
if (GST_CAT_DEFAULT) if (GST_CAT_DEFAULT)
GST_INFO ("plugin \"%s\" has incorrect GstPluginDesc, not loading", GST_INFO ("plugin \"%s\" has incorrect GstPluginDesc, not loading",
plugin->filename); plugin->filename);
return FALSE; return NULL;
} }
if (!gst_plugin_check_license (desc->license)) { if (!gst_plugin_check_license (desc->license)) {
if (GST_CAT_DEFAULT) if (GST_CAT_DEFAULT)
GST_INFO ("plugin \"%s\" has invalid license \"%s\", not loading", GST_INFO ("plugin \"%s\" has invalid license \"%s\", not loading",
plugin->filename, desc->license); plugin->filename, desc->license);
return FALSE; return NULL;
} }
if (GST_CAT_DEFAULT) if (GST_CAT_DEFAULT)
@ -214,7 +214,7 @@ gst_plugin_register_func (GstPlugin * plugin, GModule * module,
if (GST_CAT_DEFAULT) if (GST_CAT_DEFAULT)
GST_INFO ("plugin \"%s\" failed to initialise", plugin->filename); GST_INFO ("plugin \"%s\" failed to initialise", plugin->filename);
plugin->module = NULL; plugin->module = NULL;
return FALSE; return NULL;
} }
if (GST_CAT_DEFAULT) if (GST_CAT_DEFAULT)
@ -639,7 +639,7 @@ gst_plugin_get_origin (GstPlugin * plugin)
GModule * GModule *
gst_plugin_get_module (GstPlugin * plugin) 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; return plugin->module;
} }

View file

@ -973,9 +973,9 @@ gst_structure_get_string (const GstStructure * structure,
field = gst_structure_get_field (structure, fieldname); field = gst_structure_get_field (structure, fieldname);
if (field == NULL) if (field == NULL)
return FALSE; return NULL;
if (!G_VALUE_HOLDS_STRING (&field->value)) if (!G_VALUE_HOLDS_STRING (&field->value))
return FALSE; return NULL;
return g_value_get_string (&field->value); return g_value_get_string (&field->value);
} }

View file

@ -332,7 +332,7 @@ gst_print_element_args (GString * buf, gint indent, GstElement * element)
{ {
guint width; guint width;
GValue value = { 0, }; /* the important thing is that value.type = 0 */ GValue value = { 0, }; /* the important thing is that value.type = 0 */
gchar *str = 0; gchar *str = NULL;
GParamSpec *spec, **specs, **walk; GParamSpec *spec, **specs, **walk;
specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element), NULL); specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element), NULL);

View file

@ -1017,6 +1017,9 @@ setup_group_scheduler (GstOptScheduler * osched, GstOptSchedulerGroup * group)
wrapper = loop_group_schedule_function; wrapper = loop_group_schedule_function;
#ifdef USE_COTHREADS #ifdef USE_COTHREADS
/* we can only initialize the cothread stuff when we have
* a cothread context */
if (osched->context) {
if (!(group->flags & GST_OPT_SCHEDULER_GROUP_SCHEDULABLE)) { if (!(group->flags & GST_OPT_SCHEDULER_GROUP_SCHEDULABLE)) {
do_cothread_create (group->cothread, osched->context, do_cothread_create (group->cothread, osched->context,
(cothread_func) wrapper, 0, (char **) group); (cothread_func) wrapper, 0, (char **) group);
@ -1024,6 +1027,7 @@ setup_group_scheduler (GstOptScheduler * osched, GstOptSchedulerGroup * group)
do_cothread_setfunc (group->cothread, osched->context, do_cothread_setfunc (group->cothread, osched->context,
(cothread_func) wrapper, 0, (char **) group); (cothread_func) wrapper, 0, (char **) group);
} }
}
#else #else
group->schedulefunc = wrapper; group->schedulefunc = wrapper;
group->argc = 0; group->argc = 0;