[vlc-commits] commit: SplitMRL: warn if we get a path instead of a MRL/URI ( Rémi Denis-Courmont )
git version control
git at videolan.org
Tue Mar 2 18:15:12 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 1 23:22:46 2010 +0200| [937fb9bc4f88c2d59748bd9ff130a00b3760d877] | committer: Rémi Denis-Courmont
SplitMRL: warn if we get a path instead of a MRL/URI
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=937fb9bc4f88c2d59748bd9ff130a00b3760d877
---
src/input/input.c | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/input/input.c b/src/input/input.c
index 9b65121..495ae18 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -3073,11 +3073,11 @@ static void input_ChangeState( input_thread_t *p_input, int i_state )
* MRLSplit: parse the access, demux and url part of the
* Media Resource Locator.
*****************************************************************************/
-void input_SplitMRL( const char **ppsz_access, const char **ppsz_demux, char **ppsz_path,
- char *psz_dup )
+void input_SplitMRL( const char **ppsz_access, const char **ppsz_demux,
+ char **ppsz_path, char *psz_dup )
{
- char *psz_access = NULL;
- char *psz_demux = NULL;
+ const char *psz_access;
+ const char *psz_demux = "";
char *psz_path;
/* Either there is an access/demux specification before ://
@@ -3090,22 +3090,32 @@ void input_SplitMRL( const char **ppsz_access, const char **ppsz_demux, char **p
/* Separate access from demux (<access>/<demux>://<path>) */
psz_access = psz_dup;
- psz_demux = strchr( psz_access, '/' );
- if( psz_demux )
- *psz_demux++ = '\0';
/* We really don't want module name substitution here! */
if( psz_access[0] == '$' )
psz_access++;
- if( psz_demux && psz_demux[0] == '$' )
- psz_demux++;
+
+ char *p = strchr( psz_access, '/' );
+ if( p )
+ {
+ *p = '\0';
+ psz_demux = p + 1;
+ if( psz_demux[0] == '$' )
+ psz_demux++;
+ }
}
else
{
+#ifndef NDEBUG
+ fprintf( stderr, "%s(\"%s\"): not a valid URI!\n", __func__,
+ psz_dup );
+#endif
psz_path = psz_dup;
+ psz_access = "";
}
- *ppsz_access = psz_access ? psz_access : "";
- *ppsz_demux = psz_demux ? psz_demux : "";
+
+ *ppsz_access = psz_access;
+ *ppsz_demux = psz_demux;
*ppsz_path = psz_path;
}
More information about the vlc-commits
mailing list