Changeset f95f8bd64da303985e7f5b70af8838f9ec7f5d21
- Timestamp:
- 08/15/07 06:40:32
(1 year ago)
- Author:
- Pierre d'Herbemont <pdherbemont@videolan.org>
- git-committer:
- Pierre d'Herbemont <pdherbemont@videolan.org> 1187152832 +0000
- git-parent:
[51880eb16eed467a21c34b9e4bb962d1bd6a5be7]
- git-author:
- Pierre d'Herbemont <pdherbemont@videolan.org> 1187152832 +0000
- Message:
modules/meta_engine/luameta.c: Add resolve_xml_special_chars and decode_uri to the lua env.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r51880eb |
rf95f8bd |
|
| 32 | 32 | #include <vlc_playlist.h> |
|---|
| 33 | 33 | #include <vlc_meta.h> |
|---|
| | 34 | #include <vlc_url.h> |
|---|
| | 35 | #include <vlc_strings.h> |
|---|
| 34 | 36 | #include <vlc_stream.h> |
|---|
| 35 | 37 | #include <vlc_charset.h> |
|---|
| … | … | |
| 140 | 142 | } |
|---|
| 141 | 143 | |
|---|
| | 144 | static int vlclua_decode_uri( lua_State *p_state ) |
|---|
| | 145 | { |
|---|
| | 146 | int i = lua_gettop( p_state ); |
|---|
| | 147 | if( !i ) return 0; |
|---|
| | 148 | const char *psz_cstring = lua_tostring( p_state, 1 ); |
|---|
| | 149 | if( !psz_cstring ) return 0; |
|---|
| | 150 | char *psz_string = strdup( psz_cstring ); |
|---|
| | 151 | lua_pop( p_state, i ); |
|---|
| | 152 | decode_URI( psz_string ); |
|---|
| | 153 | lua_pushstring( p_state, psz_string ); |
|---|
| | 154 | free( psz_string ); |
|---|
| | 155 | return 1; |
|---|
| | 156 | } |
|---|
| | 157 | |
|---|
| | 158 | static int vlclua_resolve_xml_special_chars( lua_State *p_state ) |
|---|
| | 159 | { |
|---|
| | 160 | int i = lua_gettop( p_state ); |
|---|
| | 161 | if( !i ) return 0; |
|---|
| | 162 | const char *psz_cstring = lua_tostring( p_state, 1 ); |
|---|
| | 163 | if( !psz_cstring ) return 0; |
|---|
| | 164 | char *psz_string = strdup( psz_cstring ); |
|---|
| | 165 | lua_pop( p_state, i ); |
|---|
| | 166 | resolve_xml_special_chars( psz_string ); |
|---|
| | 167 | lua_pushstring( p_state, psz_string ); |
|---|
| | 168 | free( psz_string ); |
|---|
| | 169 | return 1; |
|---|
| | 170 | } |
|---|
| | 171 | |
|---|
| 142 | 172 | static int vlclua_msg_dbg( lua_State *p_state ) |
|---|
| 143 | 173 | { |
|---|
| … | … | |
| 188 | 218 | { "stream_readline", vlclua_stream_readline }, |
|---|
| 189 | 219 | { "stream_delete", vlclua_stream_delete }, |
|---|
| | 220 | { "decode_uri", vlclua_decode_uri }, |
|---|
| | 221 | { "resolve_xml_special_chars", vlclua_resolve_xml_special_chars }, |
|---|
| 190 | 222 | { "msg_dbg", vlclua_msg_dbg }, |
|---|
| 191 | 223 | { "msg_warn", vlclua_msg_warn }, |
|---|
| r1179afb |
rf95f8bd |
|
| 40 | 40 | * vlc.stream_readline |
|---|
| 41 | 41 | * vlc.stream_read |
|---|
| | 42 | * vlc.decode_uri( <string> ): decode %xy characters in a string. |
|---|
| | 43 | * vlc.resolve_xml_special_chars( <string> ): decode &abc; characters in a |
|---|
| | 44 | string. |
|---|
| 42 | 45 | * vlc.msg_dbg( <string> ): print a debug message. |
|---|
| 43 | 46 | * vlc.msg_warn( <string> ): print a warning message. |
|---|