From 4a9766d288eba389030a5108851ec426b8a4a423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Mon, 24 Aug 2015 18:10:20 +0300 Subject: [PATCH] filesystem: constify vlc_readdir() --- 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 7fdd4f0222..bd8731a0ee 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 e64ce411e3..142657e866 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 7e89342453..e0a635ca13 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 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 8052722488..a0f506f2f6 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 cf722ab3b1..0c40b6bad6 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;