printf: fix handling of old printf extension specifiers for ABI compatibility
authorTim-Philipp Müller <tim@centricular.net>
Wed, 17 Apr 2013 23:44:32 +0000 (00:44 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Wed, 17 Apr 2013 23:46:58 +0000 (00:46 +0100)
Fixes abort when the old specifiers are used. Fix up the conversion
specifier, it would get overwritten with 'c' below to the extension
format char, which then later is unhandled, leading to the abort.
Also fix up and enable unit test for this.

https://bugzilla.gnome.org/process_bug.cgi

gst/printf/printf-parse.c
tests/check/gst/gstinfo.c

index 300984a..5d60448 100644 (file)
@@ -392,7 +392,7 @@ printf_parse (const char *format, char_directives * d, arguments * a)
               type = TYPE_POINTER_EXT;
               dp->flags |= FLAG_PTR_EXT;
               dp->ptr_ext_char = 'A';
-              dp->conversion = 'p';
+              c = 'p';
               break;
             case 'p':
               /* Note: cp points already to the char after the 'p' now */
@@ -413,7 +413,7 @@ printf_parse (const char *format, char_directives * d, arguments * a)
               type = TYPE_POINTER_EXT;
               dp->flags |= FLAG_PTR_EXT;
               dp->ptr_ext_char = 'B';
-              dp->conversion = 'p';
+              c = 'p';
               break;
             case 'n':
 #ifdef HAVE_LONG_LONG
index 99bfcee..29f272c 100644 (file)
@@ -290,10 +290,18 @@ GST_START_TEST (info_old_printf_extensions)
   fail_unless_equals_int (g_list_length (messages), 1);
   str = (gchar *) messages->data;
   fail_unless (str != NULL);
-  fail_unless (strstr (str, "foo/bar") != NULL);
-  fail_unless (strstr (str, "width = (int) 4096") != NULL);
-  fail_unless (strstr (str, "framerate = (fraction) 50/1") != NULL);
+
+  GST_INFO ("str = '%s'", str);
+
   fail_unless (strstr (str, "time") != NULL);
+  fail_unless (strstr (str, "start=0:00:00.000000000") != NULL);
+  fail_unless (strstr (str, "stop=99:99:99.999999999") != NULL);
+  fail_unless (strstr (str, "applied_rate=1.000000") != NULL);
+
+  fail_unless (strstr (str, " caps are ") != NULL);
+  fail_unless (strstr (str, "foo/bar") != NULL);
+  fail_unless (strstr (str, "width=(int)4096") != NULL);
+  fail_unless (strstr (str, "framerate=(fraction)50/1") != NULL);
   fail_unless (strstr (str, "ARGB") != NULL);
 
   /* clean up */
@@ -323,7 +331,7 @@ gst_info_suite (void)
   tcase_add_test (tc_chain, info_log_handler);
   tcase_add_test (tc_chain, info_dump_mem);
   tcase_add_test (tc_chain, info_fixme);
-  tcase_skip_broken_test (tc_chain, info_old_printf_extensions);
+  tcase_add_test (tc_chain, info_old_printf_extensions);
 #endif
 
   return s;