]> git.sesse.net Git - vlc/blobdiff - modules/access/directory.c
Fix Windows case which implements fd_set differently:
[vlc] / modules / access / directory.c
index 10fc0fed8c37be6a1d192b7d276f892e82a26e5c..884a708ebf38f30bc09d47bed36fa250378d94ca 100644 (file)
@@ -121,8 +121,8 @@ enum
 
 typedef struct stat_list_t stat_list_t;
 
-static int Read( access_t *, uint8_t *, int );
-static int ReadNull( access_t *, uint8_t *, int );
+static ssize_t Read( access_t *, uint8_t *, size_t );
+static ssize_t ReadNull( access_t *, uint8_t *, size_t );
 static int Control( access_t *, int, va_list );
 
 static int Demux( demux_t *p_demux );
@@ -172,7 +172,7 @@ static void Close( vlc_object_t * p_this )
 /*****************************************************************************
  * ReadNull: read the directory
  *****************************************************************************/
-static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len)
+static ssize_t ReadNull( access_t *p_access, uint8_t *p_buffer, size_t i_len)
 {
     /* Return fake data */
     memset( p_buffer, 0, i_len );
@@ -182,7 +182,7 @@ static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len)
 /*****************************************************************************
  * Read: read the directory
  *****************************************************************************/
-static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
+static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len)
 {
     char               *psz;
     int                 i_mode, i_activity;
@@ -261,7 +261,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
 
     /* Return fake data forever */
     p_access->pf_read = ReadNull;
-    return ReadNull( p_access, p_buffer, i_len );
+    return -1;
 }
 
 /*****************************************************************************
@@ -301,6 +301,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
         case ACCESS_SET_TITLE:
         case ACCESS_SET_SEEKPOINT:
         case ACCESS_SET_PRIVATE_ID_STATE:
+        case ACCESS_GET_CONTENT_TYPE:
             return VLC_EGENERIC;
 
         default:
@@ -377,8 +378,7 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
 
     if ((fd == -1) || fstat (fd, &stself.st))
     {
-        msg_Err (p_playlist, "cannot stat `%s': %s", psz_name,
-                 strerror (errno));
+        msg_Err (p_playlist, "cannot stat `%s': %m", psz_name);
         return VLC_EGENERIC;
     }
 
@@ -405,8 +405,7 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
     i_dir_content = utf8_loaddir (handle, &pp_dir_content, NULL, Sort);
     if( i_dir_content == -1 )
     {
-        msg_Err (p_playlist, "cannot read `%s': %s", psz_name,
-                 strerror (errno));
+        msg_Err (p_playlist, "cannot read `%s': %m", psz_name);
         return VLC_EGENERIC;
     }
     else if( i_dir_content <= 0 )
@@ -477,7 +476,7 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
 
                 p_node = playlist_NodeCreate( p_playlist, entry,
                                               p_parent_category,
-                                              PLAYLIST_NO_REBUILD );
+                                              PLAYLIST_NO_REBUILD, NULL );
 
                 /* If we had the parent in category, the it is now node.
                  * Else, we still don't have  */
@@ -515,7 +514,7 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
                 memcpy (psz_uri, "file://", 7);
                 p_input = input_ItemNewWithType( VLC_OBJECT(p_playlist),
                                                  psz_uri, entry, 0, NULL,
-                                                 -1, ITEM_TYPE_VFILE );
+                                                 -1, ITEM_TYPE_FILE );
                 if (p_input != NULL)
                 {
                     if( p_current_input )
@@ -526,6 +525,7 @@ static int ReadDir( playlist_t *p_playlist, const char *psz_name,
                                            PLAYLIST_NO_REBUILD,
                                            PLAYLIST_END, NULL, NULL,
                                            VLC_FALSE );
+                    vlc_gc_decref( p_input );
                 }
             }
         }
@@ -551,7 +551,7 @@ static DIR *OpenDir (vlc_object_t *obj, const char *path)
     {
         int err = errno;
         if (err != ENOTDIR)
-            msg_Err (obj, "%s: %s", path, strerror (err));
+            msg_Err (obj, "%s: %m", path);
         else
             msg_Dbg (obj, "skipping non-directory `%s'", path);
         errno = err;