gst/gstmessage.c: Don't crash when return location for error/warning debug string is NULL; add fact that return locat...

Original commit message from CVS:
* gst/gstmessage.c: (gst_message_parse_tag),
(gst_message_parse_error), (gst_message_parse_warning):
Don't crash when return location for error/warning debug
string is NULL; add fact that return locations can be
NULL to docs where appropriate.
This commit is contained in:
Tim-Philipp Müller 2006-01-06 17:16:40 +00:00
parent 80d706f806
commit 53040a8d23
2 changed files with 25 additions and 13 deletions

View file

@ -1,3 +1,11 @@
2006-01-06 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstmessage.c: (gst_message_parse_tag),
(gst_message_parse_error), (gst_message_parse_warning):
Don't crash when return location for error/warning debug
string is NULL; add fact that return locations can be
NULL to docs where appropriate.
2006-01-05 Wim Taymans <wim@fluendo.com> 2006-01-05 Wim Taymans <wim@fluendo.com>
* gst/gstplugin.c: (gst_plugin_load_file): * gst/gstplugin.c: (gst_plugin_load_file):

View file

@ -694,6 +694,7 @@ gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list)
{ {
g_return_if_fail (GST_IS_MESSAGE (message)); g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG); g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
g_return_if_fail (tag_list != NULL);
*tag_list = (GstTagList *) gst_structure_copy (message->structure); *tag_list = (GstTagList *) gst_structure_copy (message->structure);
} }
@ -701,9 +702,9 @@ gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list)
/** /**
* gst_message_parse_state_changed: * gst_message_parse_state_changed:
* @message: a valid #GstMessage of type GST_MESSAGE_STATE_CHANGED * @message: a valid #GstMessage of type GST_MESSAGE_STATE_CHANGED
* @oldstate: the previous state * @oldstate: the previous state, or NULL
* @newstate: the new (current) state * @newstate: the new (current) state, or NULL
* @pending: the pending (target) state * @pending: the pending (target) state, or NULL
* *
* Extracts the old and new states from the GstMessage. * Extracts the old and new states from the GstMessage.
* *
@ -813,7 +814,7 @@ gst_message_parse_new_clock (GstMessage * message, GstClock ** clock)
* gst_message_parse_error: * gst_message_parse_error:
* @message: A valid #GstMessage of type GST_MESSAGE_ERROR. * @message: A valid #GstMessage of type GST_MESSAGE_ERROR.
* @gerror: Location for the GError * @gerror: Location for the GError
* @debug: Location for the debug message * @debug: Location for the debug message, or NULL
* *
* Extracts the GError and debug string from the GstMessage. The values returned * Extracts the GError and debug string from the GstMessage. The values returned
* in the output arguments are copies; the caller must free them when done. * in the output arguments are copies; the caller must free them when done.
@ -838,6 +839,8 @@ gst_message_parse_error (GstMessage * message, GError ** gerror, gchar ** debug)
*gerror = g_error_copy (error_val); *gerror = g_error_copy (error_val);
else else
*gerror = NULL; *gerror = NULL;
if (debug)
*debug = g_strdup (gst_structure_get_string (message->structure, "debug")); *debug = g_strdup (gst_structure_get_string (message->structure, "debug"));
} }
@ -845,7 +848,7 @@ gst_message_parse_error (GstMessage * message, GError ** gerror, gchar ** debug)
* gst_message_parse_warning: * gst_message_parse_warning:
* @message: A valid #GstMessage of type GST_MESSAGE_WARNING. * @message: A valid #GstMessage of type GST_MESSAGE_WARNING.
* @gerror: Location for the GError * @gerror: Location for the GError
* @debug: Location for the debug message * @debug: Location for the debug message, or NULL
* *
* Extracts the GError and debug string from the GstMessage. The values returned * Extracts the GError and debug string from the GstMessage. The values returned
* in the output arguments are copies; the caller must free them when done. * in the output arguments are copies; the caller must free them when done.
@ -872,14 +875,15 @@ gst_message_parse_warning (GstMessage * message, GError ** gerror,
else else
*gerror = NULL; *gerror = NULL;
if (debug)
*debug = g_strdup (gst_structure_get_string (message->structure, "debug")); *debug = g_strdup (gst_structure_get_string (message->structure, "debug"));
} }
/** /**
* gst_message_parse_segment_start: * gst_message_parse_segment_start:
* @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_START. * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_START.
* @format: Result location for the format * @format: Result location for the format, or NULL
* @position: Result location for the position * @position: Result location for the position, or NULL
* *
* Extracts the position and format from the segment start message. * Extracts the position and format from the segment start message.
* *
@ -905,8 +909,8 @@ gst_message_parse_segment_start (GstMessage * message, GstFormat * format,
/** /**
* gst_message_parse_segment_done: * gst_message_parse_segment_done:
* @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_DONE. * @message: A valid #GstMessage of type GST_MESSAGE_SEGMENT_DONE.
* @format: Result location for the format * @format: Result location for the format, or NULL
* @position: Result location for the position * @position: Result location for the position, or NULL
* *
* Extracts the position and format from the segment start message. * Extracts the position and format from the segment start message.
* *
@ -932,8 +936,8 @@ gst_message_parse_segment_done (GstMessage * message, GstFormat * format,
/** /**
* gst_message_parse_duration: * gst_message_parse_duration:
* @message: A valid #GstMessage of type GST_MESSAGE_DURATION. * @message: A valid #GstMessage of type GST_MESSAGE_DURATION.
* @format: Result location for the format * @format: Result location for the format, or NULL
* @duration: Result location for the duration * @duration: Result location for the duration, or NULL
* *
* Extracts the duration and format from the duration message. The duration * Extracts the duration and format from the duration message. The duration
* might be GST_CLOCK_TIME_NONE, which indicates that the duration has * might be GST_CLOCK_TIME_NONE, which indicates that the duration has