[grilo-plugins] raitv: Work-around leading linefeed at start of XML



commit 063064bceb777dc3d8dcd518c39d5ce404e30c2b
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jan 3 11:38:14 2017 +0100

    raitv: Work-around leading linefeed at start of XML
    
    1. Open grilo-test-ui in terminal
    2. Rai -> Most Popular -> Black and White.
    
    Entity: line 2: parser error : XML declaration allowed only at the start
    of the document
    <?xml version="1.0" encoding="UTF-8"?><CLASSIFICAVISTI>
    
    Removing the leading linefeed fixes that problem.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776482

 src/raitv/grl-raitv.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/raitv/grl-raitv.c b/src/raitv/grl-raitv.c
index ac65b38..490e058 100644
--- a/src/raitv/grl-raitv.c
+++ b/src/raitv/grl-raitv.c
@@ -638,7 +638,11 @@ proxy_call_browse_grlnet_async_cb (GObject *source_object,
     return;
   }
 
-  doc = xmlRecoverMemory (content, (gint) length);
+  /* Work-around leading linefeed */
+  if (*content == '\n')
+    doc = xmlRecoverMemory (content + 1, (gint) length - 1);
+  else
+    doc = xmlRecoverMemory (content, (gint) length);
 
   if (!doc) {
     GRL_DEBUG ("Doc failed");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]