Commit 4a9766d2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

filesystem: constify vlc_readdir()

parent 3244a744
...@@ -173,7 +173,7 @@ VLC_API DIR *vlc_opendir(const char *dirname) VLC_USED; ...@@ -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 there are no more entries in the directory, NULL is returned.
* If an error occurs, errno is set and 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_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 ** ) ); VLC_API int vlc_scandir( const char *dirname, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) );
......
...@@ -439,7 +439,8 @@ static void AllocatePluginDir (module_bank_t *bank, unsigned maxdepth, ...@@ -439,7 +439,8 @@ static void AllocatePluginDir (module_bank_t *bank, unsigned maxdepth,
/* Parse the directory and try to load all files it contains. */ /* Parse the directory and try to load all files it contains. */
for (;;) for (;;)
{ {
char *file = vlc_readdir (dh), *relpath = NULL, *abspath = NULL; char *relpath = NULL, *abspath = NULL;
const char *file = vlc_readdir (dh);
if (file == NULL) if (file == NULL)
break; break;
......
...@@ -109,7 +109,7 @@ DIR *vlc_opendir (const char *dirname) ...@@ -109,7 +109,7 @@ DIR *vlc_opendir (const char *dirname)
return dir; 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 /* Beware that readdir_r() assumes <buf> is large enough to hold the result
* dirent including the file name. A buffer overflow could occur otherwise. * dirent including the file name. A buffer overflow could occur otherwise.
......
...@@ -107,7 +107,7 @@ DIR *vlc_opendir (const char *dirname) ...@@ -107,7 +107,7 @@ DIR *vlc_opendir (const char *dirname)
return opendir (dirname); return opendir (dirname);
} }
char *vlc_readdir( DIR *dir ) const char *vlc_readdir(DIR *dir)
{ {
struct dirent *ent = readdir (dir); struct dirent *ent = readdir (dir);
return (ent != NULL) ? ent->d_name : NULL; return (ent != NULL) ? ent->d_name : NULL;
......
...@@ -169,7 +169,7 @@ DIR *vlc_opendir (const char *dirname) ...@@ -169,7 +169,7 @@ DIR *vlc_opendir (const char *dirname)
return (void *)p_dir; return (void *)p_dir;
} }
char *vlc_readdir (DIR *dir) const char *vlc_readdir (DIR *dir)
{ {
vlc_DIR *p_dir = (vlc_DIR *)dir; vlc_DIR *p_dir = (vlc_DIR *)dir;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment