[vlc-devel] commit: input SetURI. Do not decodeURI when we think that something is a path. ( Derk-Jan Hartman )

git version control git at videolan.org
Fri Jun 26 17:11:10 CEST 2009


vlc | branch: 1.0-bugfix | Derk-Jan Hartman <hartman at videolan.org> | Fri Jun 26 16:50:02 2009 +0200| [8221f20d736b62e550bd088cd69ab2e9184172a3] | committer: Derk-Jan Hartman 

input SetURI. Do not decodeURI when we think that something is a path.

This should not be forwardported, in master all URIs should be URIs.

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

 src/input/item.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index c403d3a..ad9658a 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -362,21 +362,20 @@ void input_item_SetURI( input_item_t *p_i, const char *psz_uri )
     if( !p_i->psz_name && p_i->i_type == ITEM_TYPE_FILE )
     {
         const char *psz_filename;
+        bool b_path = !strstr( p_i->psz_uri, "://" );
 
-        if( strstr( p_i->psz_uri, "://" ) )
-            psz_filename = strrchr( p_i->psz_uri, '/' );
-        else
-            psz_filename = strrchr( p_i->psz_uri, DIR_SEP_CHAR );
+        psz_filename = strrchr( p_i->psz_uri, b_path ? DIR_SEP_CHAR : '/' );
 
-        if( psz_filename && ( *psz_filename == DIR_SEP_CHAR || *psz_filename == '/' ) )
+        if( psz_filename && ( *psz_filename == (b_path ? DIR_SEP_CHAR : '/') ) )
             psz_filename++;
         if( psz_filename && *psz_filename )
             p_i->psz_name = strdup( psz_filename );
 
         /* Make the name more readable */
-        if( p_i->psz_name )
+        if( !b_path && p_i->psz_name )
             decode_URI( p_i->psz_name );
     }
+    else if( p_i->i_type == ITEM_TYPE_FILE ) fprintf(stderr, "A FILE, but ALREADY HAS A NAME" );
 
     /* The name is NULL: fill it with everything except login and password */
     if( !p_i->psz_name )




More information about the vlc-devel mailing list