gst/gstcaps.c: Fix useless assert, a uint is always positive.

Original commit message from CVS:
* gst/gstcaps.c: (gst_static_caps_get), (gst_caps_get_structure):
Fix useless assert, a uint is always positive.
* gst/gststructure.c: (gst_structure_nth_field_name),
(gst_structure_foreach), (gst_structure_map_in_place):
Check input arguments for public functions to avoid obvious crashes.
* plugins/elements/gstfakesink.c: (gst_fake_sink_render):
* plugins/elements/gstfakesink.h:
Do less useless typechecking.
This commit is contained in:
Wim Taymans 2006-07-27 11:00:21 +00:00
parent 55a6159205
commit c7853c7629
5 changed files with 21 additions and 2 deletions

View file

@ -1,3 +1,16 @@
2006-07-27 Wim Taymans <wim@fluendo.com>
* gst/gstcaps.c: (gst_static_caps_get), (gst_caps_get_structure):
Fix useless assert, a uint is always positive.
* gst/gststructure.c: (gst_structure_nth_field_name),
(gst_structure_foreach), (gst_structure_map_in_place):
Check input arguments for public functions to avoid obvious crashes.
* plugins/elements/gstfakesink.c: (gst_fake_sink_render):
* plugins/elements/gstfakesink.h:
Do less useless typechecking.
2006-07-27 Tim-Philipp Müller <tim at centricular dot net>
* plugins/elements/gstfilesrc.c: (gst_file_src_class_init):

View file

@ -604,7 +604,6 @@ GstStructure *
gst_caps_get_structure (const GstCaps * caps, guint index)
{
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
g_return_val_if_fail (index >= 0, NULL);
g_return_val_if_fail (index < caps->structs->len, NULL);
return g_ptr_array_index (caps->structs, index);

View file

@ -834,7 +834,11 @@ gst_structure_nth_field_name (const GstStructure * structure, guint index)
{
GstStructureField *field;
g_return_val_if_fail (structure != NULL, NULL);
g_return_val_if_fail (index < structure->fields->len, NULL);
field = GST_STRUCTURE_FIELD (structure, index);
return g_quark_to_string (field->name);
}
@ -859,6 +863,7 @@ gst_structure_foreach (const GstStructure * structure,
gboolean ret;
g_return_val_if_fail (structure != NULL, FALSE);
g_return_val_if_fail (func != NULL, FALSE);
for (i = 0; i < structure->fields->len; i++) {
field = GST_STRUCTURE_FIELD (structure, i);
@ -894,6 +899,7 @@ gst_structure_map_in_place (GstStructure * structure,
g_return_val_if_fail (structure != NULL, FALSE);
g_return_val_if_fail (IS_MUTABLE (structure), FALSE);
g_return_val_if_fail (func != NULL, FALSE);
for (i = 0; i < structure->fields->len; i++) {
field = GST_STRUCTURE_FIELD (structure, i);

View file

@ -361,7 +361,7 @@ gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
static GstFlowReturn
gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
{
GstFakeSink *sink = GST_FAKE_SINK (bsink);
GstFakeSink *sink = GST_FAKE_SINK_CAST (bsink);
if (!sink->silent) {
gchar ts_str[64], dur_str[64];

View file

@ -40,6 +40,7 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FAKE_SINK))
#define GST_IS_FAKE_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKE_SINK))
#define GST_FAKE_SINK_CAST(obj) ((GstFakeSink *)obj)
/**
* GstFakeSinkStateError: