[vlc-devel] commit: input: Allow NULL item name. (Pierre d'Herbemont )

git version control git at videolan.org
Mon Mar 31 00:44:53 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Mon Mar 31 00:39:57 2008 +0200| [f188c1f57cf840828fbd34e04818576fd8ca1a46]

input: Allow NULL item name.

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

 src/input/item.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index 53d2f3a..77ee6e7 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -277,7 +277,7 @@ input_item_t *input_ItemNewWithType( vlc_object_t *p_obj, const char *psz_uri,
 
     if( psz_name != NULL )
         p_input->psz_name = strdup( psz_name );
-    else if( p_input->i_type == ITEM_TYPE_FILE )
+    else if( p_input->i_type == ITEM_TYPE_FILE && p_input->psz_uri )
     {
         const char *psz_filename = strrchr( p_input->psz_uri, DIR_SEP_CHAR );
         if( psz_filename && *psz_filename == DIR_SEP_CHAR )
@@ -286,7 +286,7 @@ input_item_t *input_ItemNewWithType( vlc_object_t *p_obj, const char *psz_uri,
                                     ? psz_filename : p_input->psz_uri );
     }
     else
-        p_input->psz_name = strdup( p_input->psz_uri );
+        p_input->psz_name = p_input->psz_uri ? strdup( p_input->psz_uri ) : NULL;
 
     p_input->i_duration = i_duration;
 
@@ -318,6 +318,12 @@ static void GuessType( input_item_t *p_item)
         { NULL, 0 }
     };
 
+    if( !p_item->psz_uri )
+    {
+        p_item->i_type = ITEM_TYPE_FILE;
+        return;
+    }
+
     for( i = 0; types_array[i].psz_search != NULL; i++ )
     {
         if( !strncmp( p_item->psz_uri, types_array[i].psz_search,




More information about the vlc-devel mailing list