dash: strip lead/trailing whitespace from descriptortype attributes

The spec says it is xs:anyURI and leading and trailing whitespace
are to be ignored

https://bugzilla.gnome.org/show_bug.cgi?id=758064
This commit is contained in:
Thiago Santos 2016-04-22 17:04:57 -03:00
parent 5b6b24859f
commit aa7a3cb24f

View file

@ -38,6 +38,8 @@ static gboolean gst_mpdparser_get_xml_prop_validated_string (xmlNode * a_node,
gboolean (*validator) (const char *)); gboolean (*validator) (const char *));
static gboolean gst_mpdparser_get_xml_prop_string (xmlNode * a_node, static gboolean gst_mpdparser_get_xml_prop_string (xmlNode * a_node,
const gchar * property_name, gchar ** property_value); const gchar * property_name, gchar ** property_value);
static gboolean gst_mpdparser_get_xml_prop_string_stripped (xmlNode * a_node,
const gchar * property_name, gchar ** property_value);
static gboolean gst_mpdparser_get_xml_ns_prop_string (xmlNode * a_node, static gboolean gst_mpdparser_get_xml_ns_prop_string (xmlNode * a_node,
const gchar * ns_name, const gchar * property_name, const gchar * ns_name, const gchar * property_name,
gchar ** property_value); gchar ** property_value);
@ -310,6 +312,18 @@ gst_mpdparser_get_xml_prop_string (xmlNode * a_node,
property_value, NULL); property_value, NULL);
} }
static gboolean
gst_mpdparser_get_xml_prop_string_stripped (xmlNode * a_node,
const gchar * property_name, gchar ** property_value)
{
gboolean ret;
ret =
gst_mpdparser_get_xml_prop_string (a_node, property_name, property_value);
if (ret)
*property_value = g_strstrip (*property_value);
return ret;
}
static gboolean static gboolean
gst_mpdparser_validate_no_whitespace (const char *s) gst_mpdparser_validate_no_whitespace (const char *s)
{ {
@ -1291,7 +1305,7 @@ gst_mpdparser_parse_descriptor_type_node (GList ** list, xmlNode * a_node)
*list = g_list_append (*list, new_descriptor); *list = g_list_append (*list, new_descriptor);
GST_LOG ("attributes of %s node:", a_node->name); GST_LOG ("attributes of %s node:", a_node->name);
gst_mpdparser_get_xml_prop_string (a_node, "schemeIdUri", gst_mpdparser_get_xml_prop_string_stripped (a_node, "schemeIdUri",
&new_descriptor->schemeIdUri); &new_descriptor->schemeIdUri);
if (!gst_mpdparser_get_xml_prop_string (a_node, "value", if (!gst_mpdparser_get_xml_prop_string (a_node, "value",
&new_descriptor->value)) { &new_descriptor->value)) {