Commit 8a9fe652 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_fopen() wrapper including required file name conversion (refs #528, refs #543)

parent 8d6f2ab7
......@@ -32,6 +32,7 @@ VLC_EXPORT( vlc_bool_t, vlc_current_charset, ( char ** ) );
VLC_EXPORT( void, LocaleFree, ( const char * ) );
VLC_EXPORT( char *, FromLocale, ( const char * ) );
VLC_EXPORT( char *, ToLocale, ( const char * ) );
VLC_EXPORT( FILE *, vlc_fopen, ( const char *filename, const char *mode ) );
VLC_EXPORT( char *, EnsureUTF8, ( char * ) );
VLC_EXPORT( char *, FromUTF32, ( const wchar_t * ) );
VLC_EXPORT( char *, __vlc_fix_readdir_charset, ( vlc_object_t *, const char * ) );
......
......@@ -361,6 +361,7 @@ int intf_RunThread (intf_thread_t *);
int httpd_StreamSend (httpd_stream_t *, uint8_t *p_data, int i_data);
decoder_t * input_DecoderNew (input_thread_t *, es_format_t *, vlc_bool_t b_force_decoder);
xml_t * __xml_Create (vlc_object_t *);
FILE * vlc_fopen (const char *filename, const char *mode);
void* vlc_HashRetrieve (hashtable_entry_t*, int, int, const char *);
msg_subscription_t* __msg_Subscribe (vlc_object_t *, int);
const char * VLC_Version (void);
......@@ -925,6 +926,7 @@ struct module_symbols_t
void (*vlc_HashInsert_inner) (hashtable_entry_t **, int *, int, const char *, void *);
int (*vlc_HashLookup_inner) (hashtable_entry_t *, int, int, const char *);
void* (*vlc_HashRetrieve_inner) (hashtable_entry_t*, int, int, const char *);
FILE * (*vlc_fopen_inner) (const char *filename, const char *mode);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -1372,6 +1374,7 @@ struct module_symbols_t
# define vlc_HashInsert (p_symbols)->vlc_HashInsert_inner
# define vlc_HashLookup (p_symbols)->vlc_HashLookup_inner
# define vlc_HashRetrieve (p_symbols)->vlc_HashRetrieve_inner
# define vlc_fopen (p_symbols)->vlc_fopen_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1822,6 +1825,7 @@ struct module_symbols_t
((p_symbols)->vlc_HashInsert_inner) = vlc_HashInsert; \
((p_symbols)->vlc_HashLookup_inner) = vlc_HashLookup; \
((p_symbols)->vlc_HashRetrieve_inner) = vlc_HashRetrieve; \
((p_symbols)->vlc_fopen_inner) = vlc_fopen; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__stats_CounterGet_deprecated = NULL; \
(p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
......
......@@ -26,6 +26,23 @@
*****************************************************************************/
#include <vlc/vlc.h>
#include "charset.h"
#include <stdio.h>
/*****************************************************************************
* vlc_fopen: Calls fopen() after conversion of file name to OS locale
*****************************************************************************/
FILE *vlc_fopen( const char *filename, const char *mode )
{
const char *local_name = ToLocale( filename );
if( local_name != NULL )
{
FILE *stream = fopen( local_name, mode );
LocaleFree( local_name );
return stream;
}
return NULL;
}
/*****************************************************************************
* EnsureUTF8: replaces invalid/overlong UTF-8 sequences with question marks
......
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