[grilo-plugins] [shoutcast] Replaced xmlRecoverDoc with xmlReadMemory.
- From: Xabier Rodriguez Calvar <xrcalvar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] [shoutcast] Replaced xmlRecoverDoc with xmlReadMemory.
- Date: Tue, 4 May 2010 15:50:40 +0000 (UTC)
commit 0c834566284704000bcf64bf72d2e93db8eb046c
Author: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date: Tue Apr 27 15:25:13 2010 +0200
[shoutcast] Replaced xmlRecoverDoc with xmlReadMemory.
skip_garbage nodes is not useful anymore so it was removed.
src/shoutcast/grl-shoutcast.c | 19 ++-----------------
1 files changed, 2 insertions(+), 17 deletions(-)
---
diff --git a/src/shoutcast/grl-shoutcast.c b/src/shoutcast/grl-shoutcast.c
index 691313a..3a7a577 100644
--- a/src/shoutcast/grl-shoutcast.c
+++ b/src/shoutcast/grl-shoutcast.c
@@ -162,17 +162,6 @@ G_DEFINE_TYPE (GrlShoutcastSource, grl_shoutcast_source, GRL_TYPE_MEDIA_SOURCE);
/* ======================= Private ==================== */
-static void
-skip_garbage_nodes (xmlNodePtr *node)
-{
- /* Result contains "\n" and "\t" to pretty align XML. Unfortunately, libxml
- doesn't cope very fine with them, and it creates "fakes" nodes with name
- "text" and value those characters. So we need to skip them */
- while ((*node) && xmlStrcmp ((*node)->name, (const xmlChar *) "text") == 0) {
- (*node) = (*node)->next;
- }
-}
-
static gint
xml_count_nodes (xmlNodePtr node)
{
@@ -181,7 +170,6 @@ xml_count_nodes (xmlNodePtr node)
while (node) {
count++;
node = node->next;
- skip_garbage_nodes (&node);
}
return count;
@@ -274,7 +262,6 @@ send_media (OperationData *op_data, GrlMedia *media)
NULL);
op_data->xml_entries = op_data->xml_entries->next;
- skip_garbage_nodes (&op_data->xml_entries);
}
if (op_data->to_send == 0 || op_data->cancelled) {
@@ -315,7 +302,8 @@ xml_parse_result (const gchar *str, OperationData *op_data)
return;
}
- op_data->xml_doc = xmlRecoverDoc ((xmlChar *) str);
+ op_data->xml_doc = xmlReadMemory (str, xmlStrlen ((xmlChar*) str), NULL, NULL,
+ XML_PARSE_RECOVER | XML_PARSE_NOBLANKS);
if (!op_data->xml_doc) {
error = g_error_new (GRL_ERROR,
op_data->error_code,
@@ -335,7 +323,6 @@ xml_parse_result (const gchar *str, OperationData *op_data)
(const xmlChar *) "stationlist") == 0);
op_data->xml_entries = node->xmlChildrenNode;
- skip_garbage_nodes (&op_data->xml_entries);
/* Check if we are interesting only in updating a media (that is, a metadata()
operation) or just browsing/searching */
@@ -389,13 +376,11 @@ xml_parse_result (const gchar *str, OperationData *op_data)
if (stationlist_result) {
/* First node is "tunein"; skip it */
op_data->xml_entries = op_data->xml_entries->next;
- skip_garbage_nodes (&op_data->xml_entries);
}
/* Skip elements */
while (op_data->xml_entries && op_data->skip > 0) {
op_data->xml_entries = op_data->xml_entries->next;
- skip_garbage_nodes (&op_data->xml_entries);
op_data->skip--;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]