[vlc-commits] filesystem: constify vlc_readdir()

Rémi Denis-Courmont git at videolan.org
Mon Aug 24 20:14:06 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 24 18:10:20 2015 +0300| [4a9766d288eba389030a5108851ec426b8a4a423] | committer: Rémi Denis-Courmont

filesystem: constify vlc_readdir()

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

 include/vlc_fs.h       |    2 +-
 src/modules/bank.c     |    3 ++-
 src/os2/filesystem.c   |    2 +-
 src/posix/filesystem.c |    2 +-
 src/win32/filesystem.c |    2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/vlc_fs.h b/include/vlc_fs.h
index 7fdd4f0..bd8731a 100644
--- a/include/vlc_fs.h
+++ b/include/vlc_fs.h
@@ -173,7 +173,7 @@ VLC_API DIR *vlc_opendir(const char *dirname) VLC_USED;
  * If there are no more entries in the directory, NULL is returned.
  * If an error occurs, errno is set and NULL is returned.
  */
-VLC_API char *vlc_readdir(DIR *dir) VLC_USED;
+VLC_API const char *vlc_readdir(DIR *dir) VLC_USED;
 
 VLC_API int vlc_loaddir( DIR *dir, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) );
 VLC_API int vlc_scandir( const char *dirname, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) );
diff --git a/src/modules/bank.c b/src/modules/bank.c
index e64ce41..142657e 100644
--- a/src/modules/bank.c
+++ b/src/modules/bank.c
@@ -439,7 +439,8 @@ static void AllocatePluginDir (module_bank_t *bank, unsigned maxdepth,
     /* Parse the directory and try to load all files it contains. */
     for (;;)
     {
-        char *file = vlc_readdir (dh), *relpath = NULL, *abspath = NULL;
+        char *relpath = NULL, *abspath = NULL;
+        const char *file = vlc_readdir (dh);
         if (file == NULL)
             break;
 
diff --git a/src/os2/filesystem.c b/src/os2/filesystem.c
index 7e89342..e0a635c 100644
--- a/src/os2/filesystem.c
+++ b/src/os2/filesystem.c
@@ -109,7 +109,7 @@ DIR *vlc_opendir (const char *dirname)
     return dir;
 }
 
-char *vlc_readdir( DIR *dir )
+const char *vlc_readdir(DIR *dir)
 {
     /* Beware that readdir_r() assumes <buf> is large enough to hold the result
      * dirent including the file name. A buffer overflow could occur otherwise.
diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index 8052722..a0f506f 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -107,7 +107,7 @@ DIR *vlc_opendir (const char *dirname)
     return opendir (dirname);
 }
 
-char *vlc_readdir( DIR *dir )
+const char *vlc_readdir(DIR *dir)
 {
     struct dirent *ent = readdir (dir);
     return (ent != NULL) ? ent->d_name : NULL;
diff --git a/src/win32/filesystem.c b/src/win32/filesystem.c
index cf722ab..0c40b6b 100644
--- a/src/win32/filesystem.c
+++ b/src/win32/filesystem.c
@@ -169,7 +169,7 @@ DIR *vlc_opendir (const char *dirname)
     return (void *)p_dir;
 }
 
-char *vlc_readdir (DIR *dir)
+const char *vlc_readdir (DIR *dir)
 {
     vlc_DIR *p_dir = (vlc_DIR *)dir;
 



More information about the vlc-commits mailing list