mirror of
https://github.com/videolan/vlc.git
synced 2025-01-25 17:15:46 +08:00
Don't use void * for utf8_(l)?stat() as it hinders bug detection
This commit is contained in:
parent
65b7318b10
commit
2f095050c2
@ -28,6 +28,11 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#else
|
||||
struct stat { };
|
||||
#endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -44,8 +49,13 @@ VLC_EXPORT( FILE *, utf8_fopen, ( const char *filename, const char *mode ) );
|
||||
VLC_EXPORT( void *, utf8_opendir, ( const char *dirname ) );
|
||||
VLC_EXPORT( char *, utf8_readdir, ( void *dir ) );
|
||||
VLC_EXPORT( int, utf8_scandir, ( const char *dirname, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) ) );
|
||||
VLC_EXPORT( int, utf8_stat, ( const char *filename, void *buf ) );
|
||||
VLC_EXPORT( int, utf8_lstat, ( const char *filename, void *buf ) );
|
||||
|
||||
#ifdef WIN32
|
||||
# define stat _stati64
|
||||
#endif
|
||||
|
||||
VLC_EXPORT( int, utf8_stat, ( const char *filename, struct stat *buf ) );
|
||||
VLC_EXPORT( int, utf8_lstat, ( const char *filename, struct stat *buf ) );
|
||||
VLC_EXPORT( int, utf8_mkdir, ( const char *filename ) );
|
||||
|
||||
VLC_EXPORT( int, utf8_vfprintf, ( FILE *stream, const char *fmt, va_list ap ) );
|
||||
|
@ -469,8 +469,8 @@ struct module_symbols_t
|
||||
void * (*utf8_opendir_inner) (const char *dirname);
|
||||
FILE * (*utf8_fopen_inner) (const char *filename, const char *mode);
|
||||
char * (*utf8_readdir_inner) (void *dir);
|
||||
int (*utf8_stat_inner) (const char *filename, void *buf);
|
||||
int (*utf8_lstat_inner) (const char *filename, void *buf);
|
||||
int (*utf8_stat_inner) (const char *filename, struct stat *buf);
|
||||
int (*utf8_lstat_inner) (const char *filename, struct stat *buf);
|
||||
char * (*FromLocaleDup_inner) (const char *);
|
||||
int (*utf8_mkdir_inner) (const char *filename);
|
||||
vlm_media_t* (*vlm_MediaSearch_inner) (vlm_t *, const char *);
|
||||
|
@ -53,7 +53,6 @@
|
||||
#if defined( WIN32 ) && !defined( UNDER_CE )
|
||||
/* fstat() support for large files on win32 */
|
||||
# define fstat(a,b) _fstati64(a,b)
|
||||
# define FILESTAT _stati64
|
||||
# ifdef lseek
|
||||
# undef lseek
|
||||
# endif
|
||||
@ -68,8 +67,6 @@
|
||||
# undef lseek
|
||||
# endif
|
||||
# define lseek fseek
|
||||
#else
|
||||
# define FILESTAT stat
|
||||
#endif
|
||||
|
||||
#include "charset.h"
|
||||
@ -169,7 +166,7 @@ static int Open( vlc_object_t *p_this )
|
||||
fd = open_file (p_access, p_access->psz_path);
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
struct FILESTAT st;
|
||||
struct stat st;
|
||||
|
||||
while (fd != -1)
|
||||
{
|
||||
@ -302,7 +299,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
|
||||
if( p_access->info.i_size != 0 &&
|
||||
(p_sys->i_nb_reads % INPUT_FSTAT_NB_READS) == 0 )
|
||||
{
|
||||
struct FILESTAT st;
|
||||
struct stat st;
|
||||
|
||||
if ((fstat (fd, &st) == 0)
|
||||
&& (p_access->info.i_size != st.st_size))
|
||||
|
@ -518,7 +518,7 @@ int utf8_scandir( const char *dirname, char ***namelist,
|
||||
}
|
||||
|
||||
|
||||
static int utf8_statEx( const char *filename, void *buf,
|
||||
static int utf8_statEx( const char *filename, struct stat *buf,
|
||||
vlc_bool_t deref )
|
||||
{
|
||||
#if defined (WIN32) || defined (UNDER_CE)
|
||||
@ -535,7 +535,7 @@ static int utf8_statEx( const char *filename, void *buf,
|
||||
}
|
||||
wpath[MAX_PATH] = L'\0';
|
||||
|
||||
return _wstati64( wpath, (struct _stati64 *)buf );
|
||||
return _wstati64( wpath, buf );
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
@ -543,8 +543,8 @@ static int utf8_statEx( const char *filename, void *buf,
|
||||
|
||||
if( local_name != NULL )
|
||||
{
|
||||
int res = deref ? stat( local_name, (struct stat *)buf )
|
||||
: lstat( local_name, (struct stat *)buf );
|
||||
int res = deref ? stat( local_name, buf )
|
||||
: lstat( local_name, buf );
|
||||
LocaleFree( local_name );
|
||||
return res;
|
||||
}
|
||||
@ -554,12 +554,12 @@ static int utf8_statEx( const char *filename, void *buf,
|
||||
}
|
||||
|
||||
|
||||
int utf8_stat( const char *filename, void *buf)
|
||||
int utf8_stat( const char *filename, struct stat *buf)
|
||||
{
|
||||
return utf8_statEx( filename, buf, VLC_TRUE );
|
||||
}
|
||||
|
||||
int utf8_lstat( const char *filename, void *buf)
|
||||
int utf8_lstat( const char *filename, struct stat *buf)
|
||||
{
|
||||
return utf8_statEx( filename, buf, VLC_FALSE );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user