mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
check/Makefile.am: add two more tests for valgrinding
Original commit message from CVS: * check/Makefile.am: add two more tests for valgrinding * check/gst/gstvalue.c: (GST_START_TEST): test refcount of deserialized buffer, found a leak * docs/gst/gstreamer-docs.sgml: * docs/gst/gstreamer-sections.txt: * docs/gst/gstreamer.types: * docs/gst/tmpl/gstminiobject.sgml: add miniobject to docs * gst/gstminiobject.c: add some docs * gst/gstvalue.c: (gst_value_deserialize_buffer), (gst_string_unwrap): fix a hard-to-find invalid write for one of the tests fix a leak for deserialized buffers
This commit is contained in:
parent
02df189e5c
commit
0794b693d9
15 changed files with 324 additions and 27 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2005-07-11 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* check/Makefile.am:
|
||||
add two more tests for valgrinding
|
||||
* check/gst/gstvalue.c: (GST_START_TEST):
|
||||
test refcount of deserialized buffer, found a leak
|
||||
* docs/gst/gstreamer-docs.sgml:
|
||||
* docs/gst/gstreamer-sections.txt:
|
||||
* docs/gst/gstreamer.types:
|
||||
* docs/gst/tmpl/gstminiobject.sgml:
|
||||
add miniobject to docs
|
||||
* gst/gstminiobject.c:
|
||||
add some docs
|
||||
* gst/gstvalue.c: (gst_value_deserialize_buffer),
|
||||
(gst_string_unwrap):
|
||||
fix a hard-to-find invalid write for one of the tests
|
||||
fix a leak for deserialized buffers
|
||||
|
||||
2005-07-11 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* docs/pwg/advanced-events.xml:
|
||||
|
|
|
@ -70,12 +70,10 @@ gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
|
|||
TESTS_TO_FIX = \
|
||||
gst/gstghostpad \
|
||||
gst/gstiterator \
|
||||
gst/gstmessage \
|
||||
gst/gstpad \
|
||||
gst/gstsystemclock \
|
||||
gst/gststructure \
|
||||
gst/gsttag \
|
||||
gst/gstvalue \
|
||||
elements/gstfakesrc \
|
||||
pipelines/cleanup \
|
||||
pipelines/simple_launch_lines \
|
||||
|
|
2
check/gst/.gitignore
vendored
2
check/gst/.gitignore
vendored
|
@ -5,9 +5,11 @@ gstbuffer
|
|||
gstbus
|
||||
gstcaps
|
||||
gstdata
|
||||
gstelement
|
||||
gstghostpad
|
||||
gstiterator
|
||||
gstmessage
|
||||
gstminiobject
|
||||
gstobject
|
||||
gstpad
|
||||
gststructure
|
||||
|
|
|
@ -27,9 +27,16 @@
|
|||
GST_START_TEST (test_deserialize_buffer)
|
||||
{
|
||||
GValue value = { 0 };
|
||||
GstBuffer *buf;
|
||||
|
||||
g_value_init (&value, GST_TYPE_BUFFER);
|
||||
fail_unless (gst_value_deserialize (&value, "1234567890abcdef"));
|
||||
buf = GST_BUFFER (gst_value_get_mini_object (&value));
|
||||
|
||||
ASSERT_MINI_OBJECT_REFCOUNT (buf, "buffer", 1);
|
||||
|
||||
/* cleanup */
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -262,9 +269,9 @@ GST_START_TEST (test_deserialize_string)
|
|||
gchar *to;
|
||||
} tests[] = {
|
||||
{
|
||||
"", ""}, {
|
||||
"\"\"", ""},
|
||||
/* FAILURES */
|
||||
"", ""}, /* empty strings */
|
||||
{
|
||||
"\"\"", ""}, /* FAILURES */
|
||||
{
|
||||
"\"", NULL}, /* missing second quote */
|
||||
{
|
||||
|
|
|
@ -168,6 +168,9 @@ G_STMT_START { \
|
|||
} G_STMT_END
|
||||
|
||||
#define ASSERT_CAPS_REFCOUNT(caps, name, value) \
|
||||
ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value)
|
||||
|
||||
#define ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value) \
|
||||
G_STMT_START { \
|
||||
int rc; \
|
||||
rc = GST_MINI_OBJECT_REFCOUNT_VALUE (caps); \
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<!ENTITY GstIterator SYSTEM "xml/gstiterator.xml">
|
||||
<!ENTITY GstMacros SYSTEM "xml/gstmacros.xml">
|
||||
<!ENTITY GstMemChunk SYSTEM "xml/gstmemchunk.xml">
|
||||
<!ENTITY GstMiniObject SYSTEM "xml/gstminiobject.xml">
|
||||
<!ENTITY GstObject SYSTEM "xml/gstobject.xml">
|
||||
<!ENTITY GstPad SYSTEM "xml/gstpad.xml">
|
||||
<!ENTITY GstPadTemplate SYSTEM "xml/gstpadtemplate.xml">
|
||||
|
@ -115,6 +116,7 @@
|
|||
&GstIndexFactory;
|
||||
&GstInfo;
|
||||
&GstIterator;
|
||||
&GstMiniObject;
|
||||
&GstObject;
|
||||
&GstPad;
|
||||
&GstPadTemplate;
|
||||
|
|
|
@ -757,6 +757,44 @@ gst_mem_chunk_alloc0
|
|||
gst_mem_chunk_free
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstminiobject</FILE>
|
||||
<TITLE>GstMiniObject</TITLE>
|
||||
GstMiniObject
|
||||
GstMiniObjectFlags
|
||||
GST_MINI_OBJECT_FLAGS
|
||||
GST_MINI_OBJECT_FLAG_IS_SET
|
||||
GST_MINI_OBJECT_FLAG_SET
|
||||
GST_MINI_OBJECT_FLAG_UNSET
|
||||
|
||||
gst_mini_object_new
|
||||
gst_mini_object_copy
|
||||
gst_mini_object_is_writable
|
||||
gst_mini_object_make_writable
|
||||
|
||||
gst_mini_object_ref
|
||||
gst_mini_object_unref
|
||||
gst_mini_object_replace
|
||||
|
||||
gst_param_spec_mini_object
|
||||
gst_value_set_mini_object
|
||||
gst_value_take_mini_object
|
||||
gst_value_get_mini_object
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GstMiniObjectClass
|
||||
GST_MINI_OBJECT
|
||||
GST_IS_MINI_OBJECT
|
||||
GST_MINI_OBJECT_CLASS
|
||||
GST_IS_MINI_OBJECT_CLASS
|
||||
GST_MINI_OBJECT_GET_CLASS
|
||||
GST_TYPE_MINI_OBJECT
|
||||
GST_TYPE_MINI_OBJECT_FLAGS
|
||||
<SUBSECTION Private>
|
||||
gst_mini_object_get_type
|
||||
gst_mini_object_flags_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstobject</FILE>
|
||||
<TITLE>GstObject</TITLE>
|
||||
|
|
|
@ -17,6 +17,10 @@ gst_ghost_pad_get_type
|
|||
gst_implements_interface_get_type
|
||||
gst_index_factory_get_type
|
||||
gst_index_get_type
|
||||
|
||||
% GstMiniObject is not a GObject !
|
||||
% gst_mini_object_get_type
|
||||
|
||||
gst_object_get_type
|
||||
gst_pad_get_type
|
||||
gst_pad_template_get_type
|
||||
|
|
174
docs/gst/tmpl/gstminiobject.sgml
Normal file
174
docs/gst/tmpl/gstminiobject.sgml
Normal file
|
@ -0,0 +1,174 @@
|
|||
<!-- ##### SECTION Title ##### -->
|
||||
GstMiniObject
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### STRUCT GstMiniObject ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@instance:
|
||||
@refcount:
|
||||
@flags:
|
||||
@_gst_reserved:
|
||||
|
||||
<!-- ##### ENUM GstMiniObjectFlags ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GST_MINI_OBJECT_FLAG_READONLY:
|
||||
@GST_MINI_OBJECT_FLAG_STATIC:
|
||||
@GST_MINI_OBJECT_FLAG_LAST:
|
||||
|
||||
<!-- ##### MACRO GST_MINI_OBJECT_FLAGS ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_MINI_OBJECT_FLAG_IS_SET ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
@flag:
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_MINI_OBJECT_FLAG_SET ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
@flag:
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_MINI_OBJECT_FLAG_UNSET ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
@flag:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_mini_object_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@type:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_mini_object_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@mini_object:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_mini_object_is_writable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@mini_object:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_mini_object_make_writable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@mini_object:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_mini_object_ref ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@mini_object:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_mini_object_unref ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@mini_object:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_mini_object_replace ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@olddata:
|
||||
@newdata:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_param_spec_mini_object ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@nick:
|
||||
@blurb:
|
||||
@object_type:
|
||||
@flags:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_value_set_mini_object ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@mini_object:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_value_take_mini_object ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@mini_object:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_value_get_mini_object ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@Returns:
|
||||
|
||||
|
|
@ -311,6 +311,15 @@ gst_value_mini_object_lcopy (const GValue * value, guint n_collect_values,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_value_set_mini_object:
|
||||
* @value: a valid #GValue of %GST_TYPE_MINI_OBJECT derived type
|
||||
* @mini_object: mini object value to set
|
||||
*
|
||||
* Set the contents of a %GST_TYPE_MINI_OBJECT derived #GValue to
|
||||
* @mini_object.
|
||||
* The caller retains ownership of the reference.
|
||||
*/
|
||||
void
|
||||
gst_value_set_mini_object (GValue * value, GstMiniObject * mini_object)
|
||||
{
|
||||
|
@ -321,6 +330,16 @@ gst_value_set_mini_object (GValue * value, GstMiniObject * mini_object)
|
|||
mini_object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_value_take_mini_object:
|
||||
* @value: a valid #GValue of %GST_TYPE_MINI_OBJECT derived type
|
||||
* @mini_object: mini object value to take
|
||||
*
|
||||
* Set the contents of a %GST_TYPE_MINI_OBJECT derived #GValue to
|
||||
* @mini_object.
|
||||
* Takes over the ownership of the caller's reference to @mini_object;
|
||||
* the caller doesn't have to unref it any more.
|
||||
*/
|
||||
void
|
||||
gst_value_take_mini_object (GValue * value, GstMiniObject * mini_object)
|
||||
{
|
||||
|
@ -332,6 +351,15 @@ gst_value_take_mini_object (GValue * value, GstMiniObject * mini_object)
|
|||
gst_mini_object_unref (mini_object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_value_get_mini_object:
|
||||
* @value: a valid #GValue of %GST_TYPE_MINI_OBJECT derived type
|
||||
*
|
||||
* Get the contents of a %GST_TYPE_MINI_OBJECT derived #GValue.
|
||||
* Does not increase the refcount of the returned object.
|
||||
*
|
||||
* @Returns: mini object contents of @value
|
||||
*/
|
||||
GstMiniObject *
|
||||
gst_value_get_mini_object (const GValue * value)
|
||||
{
|
||||
|
|
|
@ -930,7 +930,7 @@ gst_value_deserialize_buffer (GValue * dest, const char *s)
|
|||
}
|
||||
|
||||
if (ret) {
|
||||
gst_value_set_mini_object (dest, GST_MINI_OBJECT (buffer));
|
||||
gst_value_take_mini_object (dest, GST_MINI_OBJECT (buffer));
|
||||
return TRUE;
|
||||
} else {
|
||||
gst_buffer_unref (buffer);
|
||||
|
@ -1323,17 +1323,25 @@ gst_string_wrap (const char *s)
|
|||
return d;
|
||||
}
|
||||
|
||||
/* FIXME: wouldn't it be nice if this function
|
||||
* were documented ? Alphabet spaghetti is easier to digest.
|
||||
*/
|
||||
static char *
|
||||
gst_string_unwrap (const gchar * s)
|
||||
{
|
||||
/* FIXME: do better memory management? */
|
||||
gchar *ret = g_strdup (s);
|
||||
gchar *read = ret, *write = ret;
|
||||
gchar *ret;
|
||||
gchar *read, *write;
|
||||
|
||||
if (*read++ != '"') {
|
||||
g_free (ret);
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = g_strdup (s);
|
||||
read = ret;
|
||||
write = ret;
|
||||
|
||||
if (*read++ != '"')
|
||||
goto beach;
|
||||
|
||||
while (*read) {
|
||||
if (GST_ASCII_IS_STRING (*read)) {
|
||||
*write++ = *read++;
|
||||
|
@ -1342,27 +1350,32 @@ gst_string_unwrap (const gchar * s)
|
|||
} else if (*read == '\\') {
|
||||
read++;
|
||||
if (*read >= '0' && *read <= '7') {
|
||||
if (read[1] < '0' || read[1] > '7' || read[2] < '0' || read[2] > '7') {
|
||||
g_free (ret);
|
||||
return NULL;
|
||||
}
|
||||
if (read[1] < '0' || read[1] > '7' || read[2] < '0' || read[2] > '7')
|
||||
goto beach;
|
||||
|
||||
*write++ = ((read[0] - '0') << 6) +
|
||||
((read[1] - '0') << 3) + (read[2] - '0');
|
||||
read += 3;
|
||||
} else {
|
||||
/* if we run into a \0 here, we definately won't get a quote later */
|
||||
if (*read == 0)
|
||||
goto beach;
|
||||
|
||||
*write++ = *read++;
|
||||
}
|
||||
} else {
|
||||
g_free (ret);
|
||||
return NULL;
|
||||
goto beach;
|
||||
}
|
||||
}
|
||||
if (*read != '"' || read[1] != '\0') {
|
||||
g_free (ret);
|
||||
return NULL;
|
||||
}
|
||||
if (*read != '"' || read[1] != '\0')
|
||||
goto beach;
|
||||
|
||||
*write++ = '\0';
|
||||
return ret;
|
||||
|
||||
beach:
|
||||
g_free (ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
|
|
|
@ -70,12 +70,10 @@ gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
|
|||
TESTS_TO_FIX = \
|
||||
gst/gstghostpad \
|
||||
gst/gstiterator \
|
||||
gst/gstmessage \
|
||||
gst/gstpad \
|
||||
gst/gstsystemclock \
|
||||
gst/gststructure \
|
||||
gst/gsttag \
|
||||
gst/gstvalue \
|
||||
elements/gstfakesrc \
|
||||
pipelines/cleanup \
|
||||
pipelines/simple_launch_lines \
|
||||
|
|
2
tests/check/gst/.gitignore
vendored
2
tests/check/gst/.gitignore
vendored
|
@ -5,9 +5,11 @@ gstbuffer
|
|||
gstbus
|
||||
gstcaps
|
||||
gstdata
|
||||
gstelement
|
||||
gstghostpad
|
||||
gstiterator
|
||||
gstmessage
|
||||
gstminiobject
|
||||
gstobject
|
||||
gstpad
|
||||
gststructure
|
||||
|
|
|
@ -27,9 +27,16 @@
|
|||
GST_START_TEST (test_deserialize_buffer)
|
||||
{
|
||||
GValue value = { 0 };
|
||||
GstBuffer *buf;
|
||||
|
||||
g_value_init (&value, GST_TYPE_BUFFER);
|
||||
fail_unless (gst_value_deserialize (&value, "1234567890abcdef"));
|
||||
buf = GST_BUFFER (gst_value_get_mini_object (&value));
|
||||
|
||||
ASSERT_MINI_OBJECT_REFCOUNT (buf, "buffer", 1);
|
||||
|
||||
/* cleanup */
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -262,9 +269,9 @@ GST_START_TEST (test_deserialize_string)
|
|||
gchar *to;
|
||||
} tests[] = {
|
||||
{
|
||||
"", ""}, {
|
||||
"\"\"", ""},
|
||||
/* FAILURES */
|
||||
"", ""}, /* empty strings */
|
||||
{
|
||||
"\"\"", ""}, /* FAILURES */
|
||||
{
|
||||
"\"", NULL}, /* missing second quote */
|
||||
{
|
||||
|
|
|
@ -168,6 +168,9 @@ G_STMT_START { \
|
|||
} G_STMT_END
|
||||
|
||||
#define ASSERT_CAPS_REFCOUNT(caps, name, value) \
|
||||
ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value)
|
||||
|
||||
#define ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value) \
|
||||
G_STMT_START { \
|
||||
int rc; \
|
||||
rc = GST_MINI_OBJECT_REFCOUNT_VALUE (caps); \
|
||||
|
|
Loading…
Reference in a new issue