check/gst/gstvalue.c (test_string): Add test for bug #165650.
authorAndy Wingo <wingo@pobox.com>
Sat, 19 Nov 2005 17:08:23 +0000 (17:08 +0000)
committerAndy Wingo <wingo@pobox.com>
Sat, 19 Nov 2005 17:08:23 +0000 (17:08 +0000)
Original commit message from CVS:
2005-11-19  Andy Wingo  <wingo@pobox.com>

* 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.

ChangeLog
check/gst/gstvalue.c
gst/gstvalue.c
tests/check/gst/gstvalue.c

index 878c065..28251fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-11-19  Andy Wingo  <wingo@pobox.com>
 
+       * 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) 
index 9e109e8..6683a42 100644 (file)
@@ -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);
 }
 
index 74361b7..1e5e6b9 100644 (file)
@@ -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++;
index 9e109e8..6683a42 100644 (file)
@@ -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);
 }