[vlc-commits] lua: export make_URI()

Pierre Ynard git at videolan.org
Sun Apr 3 18:46:16 CEST 2011


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Apr  3 18:46:07 2011 +0200| [e816d6a9637356d4c7d1bbb704ed43ab4ad8aaf1] | committer: Pierre Ynard

lua: export make_URI()

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

 modules/lua/libs/strings.c |   11 +++++++++++
 share/lua/README.txt       |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/modules/lua/libs/strings.c b/modules/lua/libs/strings.c
index ae4a37f..7920025 100644
--- a/modules/lua/libs/strings.c
+++ b/modules/lua/libs/strings.c
@@ -81,6 +81,16 @@ static int vlclua_encode_uri_component( lua_State *L )
     return i_top;
 }
 
+static int vlclua_make_uri( lua_State *L )
+{
+    const char *psz_input = luaL_checkstring( L, 1 );
+    const char *psz_scheme = luaL_optstring( L, 2, NULL );
+    char *psz_uri = make_URI( psz_input, psz_scheme );
+    lua_pushstring( L, psz_uri );
+    free( psz_uri );
+    return 1;
+}
+
 static int vlclua_resolve_xml_special_chars( lua_State *L )
 {
     int i_top = lua_gettop( L );
@@ -134,6 +144,7 @@ static int vlclua_from_charset( lua_State *L )
 static const luaL_Reg vlclua_strings_reg[] = {
     { "decode_uri", vlclua_decode_uri },
     { "encode_uri_component", vlclua_encode_uri_component },
+    { "make_uri", vlclua_make_uri },
     { "resolve_xml_special_chars", vlclua_resolve_xml_special_chars },
     { "convert_xml_special_chars", vlclua_convert_xml_special_chars },
     { "from_charset", vlclua_from_charset },
diff --git a/share/lua/README.txt b/share/lua/README.txt
index 3fa5cdb..9714109 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -373,6 +373,7 @@ strings.decode_uri( [uri1, [uri2, [...]]] ): Decode a list of URIs. This
   function returns as many variables as it had arguments.
 strings.encode_uri_component( [uri1, [uri2, [...]]] ): Encode a list of URI
   components. This function returns as many variables as it had arguments.
+strings.make_uri( path, [scheme] ): Convert a file path to a URI.
 strings.resolve_xml_special_chars( [str1, [str2, [...]]] ): Resolve XML
   special characters in a list of strings. This function returns as many
   variables as it had arguments.



More information about the vlc-commits mailing list