Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...

Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
This commit is contained in:
Sebastian Dröge 2008-02-29 12:41:33 +00:00
parent c483eb5489
commit b997b0545a
25 changed files with 107 additions and 64 deletions

View file

@ -1,3 +1,44 @@
2008-02-29 Sebastian Dröge <slomo@circular-chaos.org>
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 Sebastian Dröge <slomo@circular-chaos.org>
* plugins/elements/gstfdsink.c: (gst_fd_sink_update_fd):

View file

@ -70,7 +70,7 @@
/***** default padding of structures *****/
#define GST_PADDING 4
#define GST_PADDING_INIT {0}
#define GST_PADDING_INIT { NULL }
/***** padding for very extensible base classes *****/
#define GST_PADDING_LARGE 20

View file

@ -865,9 +865,9 @@ gst_collect_pads_read_buffer (GstCollectPads * pads, GstCollectData * data,
guint readsize;
GstBuffer *buffer;
g_return_val_if_fail (pads != NULL, 0);
g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), 0);
g_return_val_if_fail (data != NULL, 0);
g_return_val_if_fail (pads != NULL, NULL);
g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), NULL);
g_return_val_if_fail (data != NULL, NULL);
/* no buffer, must be EOS */
if ((buffer = data->buffer) == NULL)

View file

@ -48,12 +48,13 @@ GList *buffers = NULL;
GMutex *check_mutex = NULL;
GCond *check_cond = NULL;
/* FIXME 0.11: shouldn't _gst_check_debug be static? Not used anywhere */
gboolean _gst_check_debug = FALSE;
gboolean _gst_check_raised_critical = FALSE;
gboolean _gst_check_raised_warning = FALSE;
gboolean _gst_check_expecting_log = FALSE;
void gst_check_log_message_func
static void gst_check_log_message_func
(const gchar * log_domain, GLogLevelFlags log_level,
const gchar * message, gpointer user_data)
{
@ -62,7 +63,7 @@ void gst_check_log_message_func
}
}
void gst_check_log_critical_func
static void gst_check_log_critical_func
(const gchar * log_domain, GLogLevelFlags log_level,
const gchar * message, gpointer user_data)
{
@ -280,7 +281,7 @@ gst_check_teardown_sink_pad (GstElement * element)
* Since: 0.10.18
*/
void
gst_check_drop_buffers ()
gst_check_drop_buffers (void)
{
GstBuffer *temp_buffer;
@ -342,6 +343,7 @@ gst_check_element_push_buffer_list (const gchar * element_name,
GstPad *pad_peer;
GstPad *sink_pad = NULL;
GstPad *src_pad;
GstBuffer *buffer;
/* check that there are no buffers waiting */
gst_check_drop_buffers ();
@ -350,7 +352,7 @@ gst_check_element_push_buffer_list (const gchar * element_name,
fail_if (element == NULL, "failed to create the element '%s'", element_name);
fail_unless (GST_IS_ELEMENT (element), "the element is no element");
/* create the src pad */
GstBuffer *buffer = GST_BUFFER (buffer_in->data);
buffer = GST_BUFFER (buffer_in->data);
fail_unless (GST_IS_BUFFER (buffer), "There should be a buffer in buffer_in");
src_caps = GST_BUFFER_CAPS (buffer);
@ -366,11 +368,13 @@ gst_check_element_push_buffer_list (const gchar * element_name,
GST_DEBUG ("src pad activated");
/* don't create the sink_pad if there is no buffer_out list */
if (buffer_out != NULL) {
gchar *temp;
GST_DEBUG ("buffer out detected, creating the sink pad");
/* get the sink caps */
sink_caps = GST_BUFFER_CAPS (GST_BUFFER (buffer_out->data));
fail_unless (GST_IS_CAPS (sink_caps), "buffer out don't have caps");
gchar *temp = gst_caps_to_string (sink_caps);
temp = gst_caps_to_string (sink_caps);
GST_DEBUG ("sink caps requested by buffer out: '%s'", temp);
g_free (temp);

View file

@ -604,7 +604,7 @@ gst_controller_get (GstController * self, gchar * property_name,
res = gst_control_source_get_value (prop->csource, timestamp, val);
if (!res) {
g_free (val);
val = FALSE;
val = NULL;
}
} else {
g_object_get_property (self->object, prop->name, val);
@ -924,7 +924,7 @@ _gst_controller_class_init (GstControllerClass * klass)
}
GType
gst_controller_get_type ()
gst_controller_get_type (void)
{
static GType type = 0;

View file

@ -64,7 +64,7 @@ gst_object_control_properties (GObject * object, ...)
GstController *ctrl;
va_list var_args;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
va_start (var_args, object);
ctrl = gst_controller_new_valist (object, var_args);
@ -115,7 +115,7 @@ gst_object_uncontrol_properties (GObject * object, ...)
GstController *
gst_object_get_controller (GObject * object)
{
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
return (g_object_get_qdata (object, priv_gst_controller_key));
}
@ -238,12 +238,12 @@ gst_object_get_control_source (GObject * object, gchar * property_name)
{
GstController *ctrl = NULL;
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
if ((ctrl = g_object_get_qdata (object, priv_gst_controller_key))) {
return gst_controller_get_control_source (ctrl, property_name);
}
return FALSE;
return NULL;
}
/**

View file

@ -110,7 +110,7 @@ gst_interpolation_control_source_reset (GstInterpolationControlSource * self)
* Returns: a new, unbound #GstInterpolationControlSource.
*/
GstInterpolationControlSource *
gst_interpolation_control_source_new ()
gst_interpolation_control_source_new (void)
{
return g_object_new (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, NULL);
}

View file

@ -564,7 +564,7 @@ gst_lfo_control_source_reset (GstLFOControlSource * self)
* Returns: a new, unbound #GstLFOControlSource.
*/
GstLFOControlSource *
gst_lfo_control_source_new ()
gst_lfo_control_source_new (void)
{
return g_object_new (GST_TYPE_LFO_CONTROL_SOURCE, NULL);
}

View file

@ -654,7 +654,7 @@ gst_dp_event_from_packet_0_2 (guint header_length, const guint8 * header,
switch (type) {
case GST_EVENT_UNKNOWN:
GST_WARNING ("Unknown event, ignoring");
return FALSE;
return NULL;
case GST_EVENT_EOS:
case GST_EVENT_FLUSH_START:
case GST_EVENT_FLUSH_STOP:
@ -690,10 +690,10 @@ gst_dp_event_from_packet_0_2 (guint header_length, const guint8 * header,
case GST_EVENT_NAVIGATION:
case GST_EVENT_TAG:
GST_WARNING ("Unhandled event type %d, ignoring", type);
return FALSE;
return NULL;
default:
GST_WARNING ("Unknown event type %d, ignoring", type);
return FALSE;
return NULL;
}
return event;

View file

@ -411,7 +411,7 @@ read_error:
}
}
gboolean
static gboolean
gst_fd_src_is_seekable (GstBaseSrc * bsrc)
{
GstFdSrc *src = GST_FD_SRC (bsrc);
@ -419,7 +419,7 @@ gst_fd_src_is_seekable (GstBaseSrc * bsrc)
return src->seekable_fd;
}
gboolean
static gboolean
gst_fd_src_get_size (GstBaseSrc * bsrc, guint64 * size)
{
GstFdSrc *src = GST_FD_SRC (bsrc);
@ -445,7 +445,7 @@ could_not_stat:
}
}
gboolean
static gboolean
gst_fd_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
{
gint res;

View file

@ -438,7 +438,7 @@ gst_multi_queue_get_property (GObject * object, guint prop_id,
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
}
GList *
static GList *
gst_multi_queue_get_internal_links (GstPad * pad)
{
GList *res = NULL;

View file

@ -81,7 +81,7 @@ enum
PROP_PULL_MODE,
};
GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
static GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
GST_STATIC_CAPS_ANY);

View file

@ -64,13 +64,13 @@ GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
#define GST_CAT_DEFAULT gst_type_find_element_debug
/* generic templates */
GstStaticPadTemplate type_find_element_sink_template =
static GstStaticPadTemplate type_find_element_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
GstStaticPadTemplate type_find_element_src_template =
static GstStaticPadTemplate type_find_element_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,

View file

@ -144,7 +144,7 @@ static GstIndexEntry *gst_file_index_get_assoc_entry (GstIndex * index, gint id,
static GstIndex *parent_class = NULL;
GType
static GType
gst_file_index_get_type (void)
{
static GType file_index_type = 0;
@ -261,7 +261,7 @@ struct fi_find_writer_context
GstFileIndexId *ii;
};
void
static void
_fi_find_writer (gpointer key, gpointer val, gpointer data)
{
struct fi_find_writer_context *cx = data;
@ -495,7 +495,7 @@ static void
_file_index_id_save_xml (gpointer _key, GstFileIndexId * ii, xmlNodePtr writers)
{
const gint bufsize = 16;
gchar buf[bufsize];
gchar buf[16];
xmlNodePtr writer;
xmlNodePtr formats;
gint xx;
@ -807,7 +807,7 @@ gst_file_index_add_association (GstIndex * index, GstIndexEntry * entry)
}
{
gchar row_data[ARRAY_ROW_SIZE (id_index)];
gchar *row_data = (gchar *) g_malloc (ARRAY_ROW_SIZE (id_index));
gint fx;
gint32 flags_host = GST_INDEX_ASSOC_FLAGS (entry);
@ -821,6 +821,8 @@ gst_file_index_add_association (GstIndex * index, GstIndexEntry * entry)
}
g_array_insert_vals (id_index->array, mx, row_data, 1);
g_free (row_data);
}
}

View file

@ -120,7 +120,7 @@ static GstIndex *parent_class = NULL;
/*static guint gst_mem_index_signals[LAST_SIGNAL] = { 0 }; */
GType
static GType
gst_mem_index_get_type (void)
{
static GType mem_index_type = 0;

View file

@ -29,7 +29,7 @@ static GTimer *timer;
#define MAX_THREADS 100
static void
mess_some_more ()
mess_some_more (void)
{
GList *walk;
gint random;
@ -107,7 +107,7 @@ mess_some_more ()
g_mutex_unlock (fdlock);
}
void *
static void *
run_test (void *threadid)
{
gint id = GPOINTER_TO_INT (threadid);

View file

@ -25,13 +25,13 @@
#include <gst/check/gstcheck.h>
GList *buffers = NULL;
gint overrun_count = 0;
gint underrun_count = 0;
static gint overrun_count = 0;
static gint underrun_count = 0;
/* For ease of programming we use globals to keep refs for our floating
* src and sink pads we create; otherwise we always have to do get_pad,
* get_peer, and then remove references in every test function */
GstPad *mysrcpad, *mysinkpad;
static GstPad *mysrcpad, *mysinkpad;
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@ -59,8 +59,8 @@ queue_underrun (GstElement * queue, gpointer user_data)
g_mutex_unlock (check_mutex);
}
GstElement *
setup_queue ()
static GstElement *
setup_queue (void)
{
GstElement *queue;
@ -76,7 +76,7 @@ setup_queue ()
return queue;
}
void
static void
cleanup_queue (GstElement * queue)
{
GST_DEBUG ("cleanup_queue");
@ -431,7 +431,7 @@ GST_START_TEST (test_time_level)
GST_END_TEST;
Suite *
static Suite *
queue_suite (void)
{
Suite *s = suite_create ("queue");

View file

@ -127,9 +127,9 @@ GST_START_TEST (test_get_bus)
GST_END_TEST;
GMainLoop *loop = NULL;
static GMainLoop *loop = NULL;
gboolean
static gboolean
message_received (GstBus * bus, GstMessage * message, gpointer data)
{
GstElement *pipeline = GST_ELEMENT (data);
@ -487,7 +487,7 @@ GST_START_TEST (test_base_time)
GST_END_TEST;
Suite *
static Suite *
gst_pipeline_suite (void)
{
Suite *s = suite_create ("GstPipeline");

View file

@ -62,8 +62,8 @@ static GstPad *srcpad1, *srcpad2;
static GstPad *sinkpad1, *sinkpad2;
static TestData *data1, *data2;
GMutex *lock;
GCond *cond;
static GMutex *lock;
static GCond *cond;
static GstFlowReturn
collected_cb (GstCollectPads * pads, gpointer user_data)
@ -98,7 +98,7 @@ push_event (gpointer user_data)
}
static void
setup ()
setup (void)
{
collect = gst_collect_pads_new ();
gst_collect_pads_set_function (collect, collected_cb, NULL);
@ -118,7 +118,7 @@ setup ()
}
static void
teardown ()
teardown (void)
{
gst_object_unref (sinkpad1);
gst_object_unref (sinkpad2);
@ -328,7 +328,7 @@ GST_START_TEST (test_collect_twice)
GST_END_TEST;
static Suite *
gst_collect_pads_suite ()
gst_collect_pads_suite (void)
{
Suite *suite;
TCase *general;

View file

@ -17,7 +17,7 @@ struct TestParams
* them out in 'read size' sized pieces, using take and then take_buffer,
* and prints the timings */
struct TestParams param_sets[] = {
static struct TestParams param_sets[] = {
/* These values put ~256MB in 1MB chunks in an adapter, then reads them out
* in 250kb blocks */
{256000000, 250000, 1000000},
@ -28,9 +28,9 @@ struct TestParams param_sets[] = {
* in 1000 byte blocks */
{25600000, 1000, 200}
};
const gint n_tests = sizeof (param_sets) / sizeof (struct TestParams);
static const gint n_tests = sizeof (param_sets) / sizeof (struct TestParams);
gint ticks_per_sec;
static gint ticks_per_sec;
static void
run_test_take (struct TestParams *params)
@ -88,7 +88,7 @@ run_test_take_buffer (struct TestParams *params)
g_object_unref (adapter);
}
void
static void
run_tests (struct TestParams *params)
{
struct tms time_data;

View file

@ -32,9 +32,9 @@
#include <locale.h>
#include <gst/gst.h>
char *filename = NULL;
GstElement *pipeline = NULL;
GstElement *source = NULL;
static char *filename = NULL;
static GstElement *pipeline = NULL;
static GstElement *source = NULL;
#define NEW_PIPE_PER_FILE
@ -82,7 +82,7 @@ message_loop (GstElement * element, GstTagList ** tags)
}
static void
make_pipeline ()
make_pipeline (void)
{
GstElement *decodebin;

View file

@ -1,8 +1,6 @@
#include <stdlib.h>
#include <gst/gst.h>
gboolean playing;
static void
object_saved (GstObject * object, xmlNodePtr parent, gpointer data)
{

View file

@ -2,8 +2,6 @@
#include <stdlib.h>
#include <gst/gst.h>
gboolean playing;
G_GNUC_UNUSED static void
xml_loaded (GstXML * xml, GstObject * object, xmlNodePtr self, gpointer data)
{

View file

@ -38,7 +38,7 @@ static char *_name = NULL;
static int print_element_info (GstElementFactory * factory,
gboolean print_names);
void
static void
n_print (const char *format, ...)
{
va_list args;

View file

@ -147,7 +147,7 @@ unmangle_libtool (gchar ** dir, gchar ** base)
*
* The returned string is newly allocated.
*/
gchar *
static gchar *
get_dir_of_binary (const gchar * binary)
{
gchar *base, *dir;
@ -192,7 +192,7 @@ get_dir_of_binary (const gchar * binary)
/* Search the given directory for candidate binaries matching the base binary.
* Return a GHashTable of major/minor -> directory pairs
*/
GHashTable *
static GHashTable *
get_candidates (const gchar * dir, const gchar * base)
{
GDir *gdir;