summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2015-02-25 08:26:19 +0100
committerEdward Hervey <bilboed@bilboed.com>2015-02-26 07:49:05 +0100
commit075def0f9771dd89503808e7d18f0569f7a76690 (patch)
treee1074cdd3dc5da6f7eb1530e29b1dbda23746748 /gst
parent4245658d28ffb5e2e6fce2d21eab2d94ba1f0b86 (diff)
gstvalue: Make sure GST_FOURCC_ARGS produces printable characters
Some systems will crash if we use non-printable characters in print/debug statements. Make sure that GST_FOURCC_ARGS never does that https://bugzilla.gnome.org/show_bug.cgi?id=745144
Diffstat (limited to 'gst')
-rw-r--r--gst/gstvalue.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/gst/gstvalue.h b/gst/gstvalue.h
index de01abc55..2e15642e9 100644
--- a/gst/gstvalue.h
+++ b/gst/gstvalue.h
@@ -80,12 +80,14 @@ G_BEGIN_DECLS
* Can be used together with #GST_FOURCC_FORMAT to properly output a
* #guint32 fourcc value in a printf()-style text message.
*/
-#define GST_FOURCC_ARGS(fourcc) \
- ((gchar) ((fourcc) &0xff)), \
- ((gchar) (((fourcc)>>8 )&0xff)), \
- ((gchar) (((fourcc)>>16)&0xff)), \
- ((gchar) (((fourcc)>>24)&0xff))
+#define __GST_PRINT_CHAR(c) \
+ g_ascii_isprint(c) ? (c) : '.'
+#define GST_FOURCC_ARGS(fourcc) \
+ __GST_PRINT_CHAR((fourcc) & 0xff), \
+ __GST_PRINT_CHAR(((fourcc) >> 8) & 0xff), \
+ __GST_PRINT_CHAR(((fourcc) >> 16) & 0xff), \
+ __GST_PRINT_CHAR(((fourcc) >> 24) & 0xff)
/**
* GST_VALUE_HOLDS_INT_RANGE:
* @x: the #GValue to check