gst/gststructure.c: Set type field correctly.

Original commit message from CVS:
* gst/gststructure.c: (gst_structure_id_empty_new),
(gst_structure_empty_new):  Set type field correctly.
* gst/gststructure.h: Check type field correctly.
* testsuite/caps/Makefile.am:
* testsuite/caps/structure.c: (test1), (main): Add a very small
test for structures.
This commit is contained in:
David Schleef 2004-07-23 00:12:57 +00:00
parent 23d19ce876
commit 4fa4267105
7 changed files with 67 additions and 4 deletions

View file

@ -1,3 +1,12 @@
2004-07-22 David Schleef <ds@schleef.org>
* gst/gststructure.c: (gst_structure_id_empty_new),
(gst_structure_empty_new): Set type field correctly.
* gst/gststructure.h: Check type field correctly.
* testsuite/caps/Makefile.am:
* testsuite/caps/structure.c: (test1), (main): Add a very small
test for structures.
2004-07-22 David Schleef <ds@schleef.org>
* docs/random/ds/0.9-suggested-changes: more comments

View file

@ -87,6 +87,7 @@ gst_structure_id_empty_new (GQuark quark)
g_return_val_if_fail (quark != 0, NULL);
structure = g_new0 (GstStructure, 1);
structure->type = gst_structure_get_type ();
structure->name = quark;
structure->fields = g_array_new (FALSE, TRUE, sizeof (GstStructureField));
@ -109,6 +110,7 @@ gst_structure_empty_new (const gchar * name)
g_return_val_if_fail (name != NULL, NULL);
structure = g_new0 (GstStructure, 1);
structure->type = gst_structure_get_type ();
structure->name = g_quark_from_string (name);
structure->fields = g_array_new (FALSE, TRUE, sizeof (GstStructureField));

View file

@ -27,8 +27,8 @@
G_BEGIN_DECLS
#define GST_TYPE_STRUCTURE (gst_structure_get_type ())
#define GST_STRUCTURE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GST_TYPE_STRUCTURE, GstStructure))
#define GST_IS_STRUCTURE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GST_TYPE_STRUCTURE))
#define GST_STRUCTURE(object) ((GstStructure *)(object))
#define GST_IS_STRUCTURE(object) ((object) && (GST_STRUCTURE(object)->type == GST_TYPE_STRUCTURE))
typedef struct _GstStructure GstStructure;

View file

@ -23,7 +23,8 @@ tests_pass = \
subtract \
sets \
simplify \
random
random \
structure
EXTRA_DIST = caps_strings

View file

@ -0,0 +1,25 @@
#include <gst/gst.h>
void
test1 (void)
{
GstStructure *structure;
g_print ("type is %d\n", (int) gst_structure_get_type ());
structure = gst_structure_empty_new ("moo");
g_assert (structure != NULL);
g_assert (GST_IS_STRUCTURE (structure));
}
int
main (int argc, char *argv[])
{
gst_init (&argc, &argv);
test1 ();
return 0;
}

View file

@ -23,7 +23,8 @@ tests_pass = \
subtract \
sets \
simplify \
random
random \
structure
EXTRA_DIST = caps_strings

View file

@ -0,0 +1,25 @@
#include <gst/gst.h>
void
test1 (void)
{
GstStructure *structure;
g_print ("type is %d\n", (int) gst_structure_get_type ());
structure = gst_structure_empty_new ("moo");
g_assert (structure != NULL);
g_assert (GST_IS_STRUCTURE (structure));
}
int
main (int argc, char *argv[])
{
gst_init (&argc, &argv);
test1 ();
return 0;
}