[vlc-devel] commit: add xml_encode to http-control rpn, so status/playlist. xml can be easier (Ilkka Ollakka )

git version control git at videolan.org
Fri Jun 20 10:14:31 CEST 2008


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Jun 18 10:56:44 2008 +0300| [89cbc196a3ce2bb0e54f16575a48d94703c1cc6e]

add xml_encode to http-control rpn, so status/playlist.xml can be easier
be valid xml without str_replace-stuff.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89cbc196a3ce2bb0e54f16575a48d94703c1cc6e
---

 modules/control/http/rpn.c       |    8 ++++++++
 share/http/requests/playlist.xml |    4 ++--
 share/http/requests/status.xml   |    4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/control/http/rpn.c b/modules/control/http/rpn.c
index 982d455..e55a2fb 100644
--- a/modules/control/http/rpn.c
+++ b/modules/control/http/rpn.c
@@ -370,6 +370,14 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t  *vars,
             SSPush( st, value );
             free( value );
         }
+        else if( !strcmp( s, "xml_encode" ) )
+        {
+            char *url = SSPop( st );
+            char *value = convert_xml_special_chars( url );
+            free( url );
+            SSPush( st, value );
+            free( value );
+        }
         else if( !strcmp( s, "addslashes" ) )
         {
             char *psz_src = SSPop( st );
diff --git a/share/http/requests/playlist.xml b/share/http/requests/playlist.xml
index debe400..5a3fb5c 100644
--- a/share/http/requests/playlist.xml
+++ b/share/http/requests/playlist.xml
@@ -35,9 +35,9 @@
   <vlc id="end" />
   <vlc id="if" param1="pl.type value 'Node' strcmp" />
     <vlc id="rpn" param1="1 +" />
-    <leaf id="<vlc id="value" param1="pl.index" />" <vlc id="if" param1="pl.current" /> current="current" <vlc id="end" /> uri="<vlc id="value" param1="pl.uri value '&' '&' str_replace" />" name="<vlc id="value" param1="pl.name value '&' '&' str_replace" />" ro="<vlc id="value" param1="pl.ro" />" duration="<vlc id="value" param1="pl.duration" />" />
+    <leaf id="<vlc id="value" param1="pl.index" />" <vlc id="if" param1="pl.current" /> current="current" <vlc id="end" /> uri="<vlc id="value" param1="pl.uri xml_encode" />" name="<vlc id="value" param1="pl.name xml_encode" />" ro="<vlc id="value" param1="pl.ro" />" duration="<vlc id="value" param1="pl.duration" />" />
   <vlc id="else" />
-    <node id="<vlc id="value" param1="pl.index" />" name="<vlc id="value" param1="pl.name value '&' '&' str_replace" />" ro="<vlc id="value" param1="pl.ro" />" >
+    <node id="<vlc id="value" param1="pl.index" />" name="<vlc id="value" param1="pl.name xml_encode" />" ro="<vlc id="value" param1="pl.ro" />" >
     <vlc id="if" param1="first_item value 0 ="/>
       <vlc id="rpn" param1="first_item 1 store" />
     <vlc id="end"/>
diff --git a/share/http/requests/status.xml b/share/http/requests/status.xml
index 1e476f2..c180fa2 100644
--- a/share/http/requests/status.xml
+++ b/share/http/requests/status.xml
@@ -117,9 +117,9 @@
   <repeat><vlc id="value" param1="'repeat' 'VLC_OBJECT_PLAYLIST' vlc_var_get" /></repeat>
   <information>
     <vlc id="foreach" param1="inf" param2="information" />
-      <category name="<vlc id="value" param1="inf.name" />">
+      <category name="<vlc id="value" param1="inf.name xml_encode" />">
         <vlc id="foreach" param1="subinf" param2="inf.info" />
-          <info name="<vlc id="value" param1="subinf.name" />"><vlc id="value" param1="subinf.value" /></info>
+          <info name="<vlc id="value" param1="subinf.name xml_encode" />"><vlc id="value" param1="subinf.value xml_encode" /></info>
         <vlc id="end" />
       </category>
     <vlc id="end" />




More information about the vlc-devel mailing list