From: Andy Wingo Date: Sat, 19 Nov 2005 17:08:23 +0000 (+0000) Subject: check/gst/gstvalue.c (test_string): Add test for bug #165650. X-Git-Tag: RELEASE-0_9_6~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77d95482f66670ba26466706c8f28f9aba4482fd;p=platform%2Fupstream%2Fgstreamer.git check/gst/gstvalue.c (test_string): Add test for bug #165650. Original commit message from CVS: 2005-11-19 Andy Wingo * check/gst/gstvalue.c (test_string): Add test for bug #165650. * gst/gstvalue.c (gst_string_wrap): Trying to serialize a NULL string should produce an error, given the lack of a way to represent NULL strings. Fixes #165650. --- diff --git a/ChangeLog b/ChangeLog index 878c065..28251fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2005-11-19 Andy Wingo + * check/gst/gstvalue.c (test_string): Add test for bug #165650. + + * gst/gstvalue.c (gst_string_wrap): Trying to serialize a NULL + string should produce an error, given the lack of a way to + represent NULL strings. Fixes #165650. + * gst/gstvalue.h: * gst/gstvalue.c (gst_value_array_append_value) (gst_value_array_prepend_value, gst_value_array_get_size) diff --git a/check/gst/gstvalue.c b/check/gst/gstvalue.c index 9e109e8..6683a42 100644 --- a/check/gst/gstvalue.c +++ b/check/gst/gstvalue.c @@ -256,6 +256,9 @@ GST_START_TEST (test_string) "\nserialized : %s\ndeserialized: %s", try[i], g_value_get_string (&v)); } + /* NULL strings should not be serializable */ + g_value_set_string (&v, NULL); + fail_unless (gst_value_serialize (&v) == NULL); g_value_unset (&v); } diff --git a/gst/gstvalue.c b/gst/gstvalue.c index 74361b7..1e5e6b9 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -1381,7 +1381,7 @@ gst_string_wrap (const char *s) len = 0; t = s; if (!s) - return g_strdup (""); + return NULL; while (*t) { if (GST_ASCII_IS_STRING (*t)) { len++; diff --git a/tests/check/gst/gstvalue.c b/tests/check/gst/gstvalue.c index 9e109e8..6683a42 100644 --- a/tests/check/gst/gstvalue.c +++ b/tests/check/gst/gstvalue.c @@ -256,6 +256,9 @@ GST_START_TEST (test_string) "\nserialized : %s\ndeserialized: %s", try[i], g_value_get_string (&v)); } + /* NULL strings should not be serializable */ + g_value_set_string (&v, NULL); + fail_unless (gst_value_serialize (&v) == NULL); g_value_unset (&v); }