gst/gstvalue.c: Handle NULL input and output pointers silently as a failed conversion, rather than g_warnings.

Original commit message from CVS:
* gst/gstvalue.c: (gst_value_deserialize_fraction):
Handle NULL input and output pointers silently as a failed conversion,
rather than g_warnings.
This commit is contained in:
Jan Schmidt 2006-05-26 09:19:24 +00:00
parent 803ecd5d58
commit 8bf748a28e
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2006-05-26 Jan Schmidt <thaytan@mad.scientist.com>
* gst/gstvalue.c: (gst_value_deserialize_fraction):
Handle NULL input and output pointers silently as a failed conversion,
rather than g_warnings.
2006-05-25 Wim Taymans <wim@fluendo.com> 2006-05-25 Wim Taymans <wim@fluendo.com>
* libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_start): * libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_start):

View file

@ -3389,11 +3389,17 @@ gst_value_deserialize_fraction (GValue * dest, const gchar * s)
{ {
gint num, den; gint num, den;
if (s && sscanf (s, "%d/%d", &num, &den) == 2) { if (G_UNLIKELY (s == NULL))
return FALSE;
if (G_UNLIKELY (dest == NULL || !GST_VALUE_HOLDS_FRACTION (dest)))
return FALSE;
if (sscanf (s, "%d/%d", &num, &den) == 2) {
gst_value_set_fraction (dest, num, den); gst_value_set_fraction (dest, num, den);
return TRUE; return TRUE;
} }
if (s && sscanf (s, "%d", &num) == 1) { if (sscanf (s, "%d", &num) == 1) {
gst_value_set_fraction (dest, num, 1); gst_value_set_fraction (dest, num, 1);
return TRUE; return TRUE;
} }