Commit 1c352886 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

All Unicode fixes for fopen() (refs #528)

parent 8a1c45df
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <vlc/decoder.h> #include <vlc/decoder.h>
#include <vlc_filter.h> #include <vlc_filter.h>
#include <vlc_image.h> #include <vlc_image.h>
#include <charset.h>
static picture_t *ImageRead( image_handler_t *, block_t *, static picture_t *ImageRead( image_handler_t *, block_t *,
video_format_t *, video_format_t * ); video_format_t *, video_format_t * );
...@@ -206,7 +207,7 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url, ...@@ -206,7 +207,7 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
FILE *file; FILE *file;
int i_size; int i_size;
file = fopen( psz_url, "rb" ); file = utf8_fopen( psz_url, "rb" );
if( !file ) if( !file )
{ {
msg_Dbg( p_image->p_parent, "could not open file %s for reading", msg_Dbg( p_image->p_parent, "could not open file %s for reading",
...@@ -344,7 +345,7 @@ static int ImageWriteUrl( image_handler_t *p_image, picture_t *p_pic, ...@@ -344,7 +345,7 @@ static int ImageWriteUrl( image_handler_t *p_image, picture_t *p_pic,
p_fmt_out->i_chroma = Ext2Fourcc( psz_url ); p_fmt_out->i_chroma = Ext2Fourcc( psz_url );
} }
file = fopen( psz_url, "wb" ); file = utf8_fopen( psz_url, "wb" );
if( !file ) if( !file )
{ {
msg_Dbg( p_image->p_parent, "could not open file %s for writing", msg_Dbg( p_image->p_parent, "could not open file %s for writing",
......
...@@ -1625,7 +1625,7 @@ static void CacheLoad( vlc_object_t *p_this ) ...@@ -1625,7 +1625,7 @@ static void CacheLoad( vlc_object_t *p_this )
msg_Dbg( p_this, "loading plugins cache file %s", psz_filename ); msg_Dbg( p_this, "loading plugins cache file %s", psz_filename );
file = fopen( psz_filename, "rb" ); file = utf8_fopen( psz_filename, "rb" );
if( !file ) if( !file )
{ {
msg_Warn( p_this, "could not open plugins cache file %s for reading", msg_Warn( p_this, "could not open plugins cache file %s for reading",
...@@ -1947,7 +1947,7 @@ static void CacheSave( vlc_object_t *p_this ) ...@@ -1947,7 +1947,7 @@ static void CacheSave( vlc_object_t *p_this )
strcat( psz_filename, "/CACHEDIR.TAG" ); strcat( psz_filename, "/CACHEDIR.TAG" );
file = fopen( psz_filename, "wb" ); file = utf8_fopen( psz_filename, "wb" );
if( file ) if( file )
{ {
fwrite( psz_tag, 1, strlen(psz_tag), file ); fwrite( psz_tag, 1, strlen(psz_tag), file );
...@@ -1959,7 +1959,7 @@ static void CacheSave( vlc_object_t *p_this ) ...@@ -1959,7 +1959,7 @@ static void CacheSave( vlc_object_t *p_this )
msg_Dbg( p_this, "saving plugins cache file %s", psz_filename ); msg_Dbg( p_this, "saving plugins cache file %s", psz_filename );
file = fopen( psz_filename, "wb" ); file = utf8_fopen( psz_filename, "wb" );
if( !file ) if( !file )
{ {
msg_Warn( p_this, "could not open plugins cache file %s for writing", msg_Warn( p_this, "could not open plugins cache file %s for writing",
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "vlc_stream.h" #include "vlc_stream.h"
#include "vlc_xml.h" #include "vlc_xml.h"
#include "vlc_interaction.h" #include "vlc_interaction.h"
#include "charset.h"
/***************************************************************************** /*****************************************************************************
* Misc defines * Misc defines
...@@ -1276,7 +1277,7 @@ void update_download_for_real( download_thread_t *p_this ) ...@@ -1276,7 +1277,7 @@ void update_download_for_real( download_thread_t *p_this )
else else
{ {
p_file = fopen( psz_dest, "w" ); p_file = utf8_fopen( psz_dest, "w" );
if( !p_file ) if( !p_file )
{ {
msg_Err( p_vlc, "Failed to open %s for writing", psz_dest ); msg_Err( p_vlc, "Failed to open %s for writing", psz_dest );
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "vlc_vlm.h" #include "vlc_vlm.h"
#include "vlc_vod.h" #include "vlc_vod.h"
#include "charset.h"
#define FREE( p ) \ #define FREE( p ) \
if( p ) { free( p ); (p) = NULL; } if( p ) { free( p ); (p) = NULL; }
...@@ -194,7 +195,7 @@ int vlm_Save( vlm_t *p_vlm, const char *psz_file ) ...@@ -194,7 +195,7 @@ int vlm_Save( vlm_t *p_vlm, const char *psz_file )
if( !p_vlm || !psz_file ) return 1; if( !p_vlm || !psz_file ) return 1;
file = fopen( psz_file, "wt" ); file = utf8_fopen( psz_file, "wt" );
if( file == NULL ) return 1; if( file == NULL ) return 1;
psz_save = Save( p_vlm ); psz_save = Save( p_vlm );
...@@ -221,7 +222,7 @@ int vlm_Load( vlm_t *p_vlm, const char *psz_file ) ...@@ -221,7 +222,7 @@ int vlm_Load( vlm_t *p_vlm, const char *psz_file )
if( !p_vlm || !psz_file ) return 1; if( !p_vlm || !psz_file ) return 1;
file = fopen( psz_file, "r" ); file = utf8_fopen( psz_file, "r" );
if( file == NULL ) return 1; if( file == NULL ) return 1;
if( fseek( file, 0, SEEK_END) != 0 ) if( fseek( file, 0, SEEK_END) != 0 )
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <errno.h> #include <errno.h>
#include "network.h" #include "network.h"
#include "charset.h"
/* FIXME: rwlock on acl, but libvlc doesn't implement rwlock */ /* FIXME: rwlock on acl, but libvlc doesn't implement rwlock */
typedef struct vlc_acl_entry_t typedef struct vlc_acl_entry_t
...@@ -268,7 +269,7 @@ int ACL_LoadFile( vlc_acl_t *p_acl, const char *psz_path ) ...@@ -268,7 +269,7 @@ int ACL_LoadFile( vlc_acl_t *p_acl, const char *psz_path )
if( p_acl == NULL ) if( p_acl == NULL )
return -1; return -1;
file = fopen( psz_path, "r" ); file = utf8_fopen( psz_path, "r" );
if( file == NULL ) if( file == NULL )
return -1; return -1;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <vlc_keys.h> #include <vlc_keys.h>
#include <vlc_image.h> #include <vlc_image.h>
#include <vlc_osd.h> #include <vlc_osd.h>
#include <charset.h>
#undef OSD_MENU_DEBUG #undef OSD_MENU_DEBUG
...@@ -319,7 +320,7 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file, ...@@ -319,7 +320,7 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file,
int result = 0; int result = 0;
msg_Dbg( p_this, "opening osd definition file %s", psz_file ); msg_Dbg( p_this, "opening osd definition file %s", psz_file );
fd = fopen( psz_file, "r" ); fd = utf8_fopen( psz_file, "r" );
if( !fd ) if( !fd )
{ {
msg_Err( p_this, "failed opening osd definition file %s", psz_file ); msg_Err( p_this, "failed opening osd definition file %s", psz_file );
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc/input.h> #include <vlc/input.h>
#include "vlc_playlist.h" #include "vlc_playlist.h"
#include "charset.h"
#define PLAYLIST_FILE_HEADER "# vlc playlist file version 0.5" #define PLAYLIST_FILE_HEADER "# vlc playlist file version 0.5"
...@@ -126,7 +127,7 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename , ...@@ -126,7 +127,7 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
msg_Err( p_playlist, "out of memory"); msg_Err( p_playlist, "out of memory");
return VLC_ENOMEM; return VLC_ENOMEM;
} }
p_export->p_file = fopen( psz_filename, "wt" ); p_export->p_file = utf8_fopen( psz_filename, "wt" );
if( !p_export->p_file ) if( !p_export->p_file )
{ {
msg_Err( p_playlist , "could not create playlist file %s" msg_Err( p_playlist , "could not create playlist file %s"
......
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