diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2013-01-17 23:15:09 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@iem.at> | 2015-10-14 15:23:30 +0200 |
commit | 6bf58497fe25026cb7adcdf1a408f24c8ba955e5 (patch) | |
tree | 7efefc8281acb05d45b2bb9ffaec674deb4246a2 | |
parent | 3597f35314d4d5f1974c9236dcc427bca5adab7e (diff) |
replace POSIX fopen() with Pd's new sys_fopen() to get cross-platform unicode filename support (Pd-extended 0.43.4/Pd-vanilla 0.44)
svn path=/trunk/externals/unauthorized/; revision=16902
-rw-r--r-- | blinkenlights.c | 2 | ||||
-rw-r--r-- | mp3fileout~.c | 2 | ||||
-rw-r--r-- | mp3write~.c | 12 | ||||
-rw-r--r-- | pianoroll.c | 4 |
4 files changed, 9 insertions, 11 deletions
diff --git a/blinkenlights.c b/blinkenlights.c index 65e02a4..1e49474 100644 --- a/blinkenlights.c +++ b/blinkenlights.c @@ -758,7 +758,7 @@ static void blinkenlights_open(t_blinkenlights *x, t_symbol *sfile) //-------------------------------- - if ( ( x->x_filed = fopen( sfile->s_name, "r" ) ) == NULL ) + if ( ( x->x_filed = sys_fopen( sfile->s_name, "r" ) ) == NULL ) { error( "blinkenlights : cannot open >%s<", sfile->s_name); return; diff --git a/mp3fileout~.c b/mp3fileout~.c index 87ff56d..69e76fa 100644 --- a/mp3fileout~.c +++ b/mp3fileout~.c @@ -397,7 +397,7 @@ static void mp3fileout_open(t_mp3fileout *x, t_symbol *filename) outlet_float( x->x_frames, x->x_outframes ); } - if ( ( x->x_fd = open( filename->s_name, O_RDONLY ) ) < 0 ) + if ( ( x->x_fd = sys_open( filename->s_name, O_RDONLY ) ) < 0 ) { post( "mp3fileout~ : could not open file : %s", filename->s_name ); perror( "open" ); diff --git a/mp3write~.c b/mp3write~.c index 202d5ab..0ed6845 100644 --- a/mp3write~.c +++ b/mp3write~.c @@ -418,11 +418,7 @@ static void mp3write_open(t_mp3write *x, t_symbol *sfile) /* closing previous file descriptor */
if ( x->x_fd > 0 )
{
-#ifdef _WIN32
- if(_close(x->x_fd) < 0 )
-#else
- if(close(x->x_fd) < 0)
-#endif
+ if(sys_close(x->x_fd) < 0)
{
perror( "mp3write~ : closing file" );
}
@@ -433,11 +429,13 @@ static void mp3write_open(t_mp3write *x, t_symbol *sfile) x->x_recflag = 0;
}
+
#ifdef _WIN32
- if ( ( x->x_fd = _open( sfile->s_name, x->x_file_open_mode, _S_IREAD|_S_IWRITE) ) < 0 )
+ int mode = _S_IREAD|_S_IWRITE;
#else
- if ( ( x->x_fd = open( sfile->s_name, x->x_file_open_mode, S_IRWXU|S_IRWXG|S_IRWXO ) ) < 0 )
+ int mode = S_IRWXU|S_IRWXG|S_IRWXO;
#endif
+ if ( ( x->x_fd = sys_open( sfile->s_name, x->x_file_open_mode, mode) ) < 0 )
{
error( "mp3write~ : cannot open >%s<", sfile->s_name);
x->x_fd=-1;
diff --git a/pianoroll.c b/pianoroll.c index 8a5269e..560afb9 100644 --- a/pianoroll.c +++ b/pianoroll.c @@ -468,7 +468,7 @@ static void pianoroll_save_file(t_pianoroll *x, t_symbol *ffile) FILE *tmph; t_int si; - if ( ( tmph = fopen( ffile->s_name, "w" ) ) == NULL ) + if ( ( tmph = sys_fopen( ffile->s_name, "w" ) ) == NULL ) { post( "pianoroll : could not open file : %s for writing", ffile->s_name ); return; @@ -497,7 +497,7 @@ static void pianoroll_load(t_pianoroll *x, t_symbol *ffile) FILE *tmph; t_int si; - if ( ( tmph = fopen( ffile->s_name, "r" ) ) == NULL ) + if ( ( tmph = sys_fopen( ffile->s_name, "r" ) ) == NULL ) { post( "pianoroll : could not open file : %s for reading", ffile->s_name ); return; |