summaryrefslogtreecommitdiff
path: root/src/test_libFLAC/metadata_manip.c
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2013-03-21 19:18:49 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2013-03-29 21:25:59 +1100
commit5705b4d7b2c3c5311138e9f4b66658c51f3cc22b (patch)
treee96ada937e8b57189f211fea9bfd47ae1688676f /src/test_libFLAC/metadata_manip.c
parent9b8fdafe3a4ba0b6272bdcb0161f921bf750ca49 (diff)
downloadflac-5705b4d7b2c3c5311138e9f4b66658c51f3cc22b.tar.gz
Huge Windows utf8 I/O patch.
Patch from Janne Hyvärinen <cse@sci.fi>.
Diffstat (limited to 'src/test_libFLAC/metadata_manip.c')
-rw-r--r--src/test_libFLAC/metadata_manip.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/test_libFLAC/metadata_manip.c b/src/test_libFLAC/metadata_manip.c
index baedd10a..a3e83e4b 100644
--- a/src/test_libFLAC/metadata_manip.c
+++ b/src/test_libFLAC/metadata_manip.c
@@ -193,7 +193,7 @@ static FLAC__bool open_tempfile_(const char *filename, FILE **tempfile, char **t
safe_strncpy(*tempfilename, filename, dest_len);
safe_strncat(*tempfilename, tempfile_suffix, dest_len);
- if(0 == (*tempfile = fopen(*tempfilename, "wb")))
+ if(0 == (*tempfile = flac_fopen(*tempfilename, "wb")))
return false;
return true;
@@ -207,7 +207,7 @@ static void cleanup_tempfile_(FILE **tempfile, char **tempfilename)
}
if(0 != *tempfilename) {
- (void)unlink(*tempfilename);
+ (void)flac_unlink(*tempfilename);
free(*tempfilename);
*tempfilename = 0;
}
@@ -226,14 +226,14 @@ static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, cha
}
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
- /* on some flavors of windows, rename() will fail if the destination already exists */
- if(unlink(filename) < 0) {
+ /* on some flavors of windows, flac_rename() will fail if the destination already exists */
+ if(flac_unlink(filename) < 0) {
cleanup_tempfile_(tempfile, tempfilename);
return false;
}
#endif
- if(0 != rename(*tempfilename, filename)) {
+ if(0 != flac_rename(*tempfilename, filename)) {
cleanup_tempfile_(tempfile, tempfilename);
return false;
}
@@ -243,14 +243,14 @@ static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, cha
return true;
}
-static FLAC__bool get_file_stats_(const char *filename, struct stat *stats)
+static FLAC__bool get_file_stats_(const char *filename, struct _flac_stat *stats)
{
FLAC__ASSERT(0 != filename);
FLAC__ASSERT(0 != stats);
- return (0 == stat(filename, stats));
+ return (0 == flac_stat(filename, stats));
}
-static void set_file_stats_(const char *filename, struct stat *stats)
+static void set_file_stats_(const char *filename, struct _flac_stat *stats)
{
struct utimbuf srctime;
@@ -259,8 +259,8 @@ static void set_file_stats_(const char *filename, struct stat *stats)
srctime.actime = stats->st_atime;
srctime.modtime = stats->st_mtime;
- (void)chmod(filename, stats->st_mode);
- (void)utime(filename, &srctime);
+ (void)flac_chmod(filename, stats->st_mode);
+ (void)flac_utime(filename, &srctime);
#if !defined _MSC_VER && !defined __MINGW32__
FLAC_CHECK_RETURN(chown(filename, stats->st_uid, -1));
FLAC_CHECK_RETURN(chown(filename, -1, stats->st_gid));
@@ -313,14 +313,14 @@ static FLAC__bool write_chain_(FLAC__Metadata_Chain *chain, FLAC__bool use_paddi
callbacks.eof = chain_eof_cb_;
if(FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding)) {
- struct stat stats;
+ struct _flac_stat stats;
FILE *file, *tempfile = 0;
char *tempfilename;
if(preserve_file_stats) {
if(!get_file_stats_(filename, &stats))
return false;
}
- if(0 == (file = fopen(filename, "rb")))
+ if(0 == (file = flac_fopen(filename, "rb")))
return false; /*@@@@ chain status still says OK though */
if(!open_tempfile_(filename, &tempfile, &tempfilename)) {
fclose(file);
@@ -341,7 +341,7 @@ static FLAC__bool write_chain_(FLAC__Metadata_Chain *chain, FLAC__bool use_paddi
set_file_stats_(filename, &stats);
}
else {
- FILE *file = fopen(filename, "r+b");
+ FILE *file = flac_fopen(filename, "r+b");
if(0 == file)
return false; /*@@@@ chain status still says OK though */
if(!FLAC__metadata_chain_write_with_callbacks(chain, use_padding, (FLAC__IOHandle)file, callbacks))
@@ -370,7 +370,7 @@ static FLAC__bool read_chain_(FLAC__Metadata_Chain *chain, const char *filename,
{
FLAC__bool ret;
- FILE *file = fopen(filename, "rb");
+ FILE *file = flac_fopen(filename, "rb");
if(0 == file)
return false; /*@@@@ chain status still says OK though */
ret = is_ogg?
@@ -1994,7 +1994,7 @@ static FLAC__bool test_level_2_misc_(FLAC__bool is_ogg)
printf("read chain (callback-based)\n");
{
- FILE *file = fopen(flacfilename(is_ogg), "rb");
+ FILE *file = flac_fopen(flacfilename(is_ogg), "rb");
if(0 == file)
return die_("opening file");
if(!FLAC__metadata_chain_read_with_callbacks(chain, (FLAC__IOHandle)file, callbacks)) {
@@ -2015,7 +2015,7 @@ static FLAC__bool test_level_2_misc_(FLAC__bool is_ogg)
printf("read chain (callback-based)\n");
{
- FILE *file = fopen(flacfilename(is_ogg), "rb");
+ FILE *file = flac_fopen(flacfilename(is_ogg), "rb");
if(0 == file)
return die_("opening file");
if(!FLAC__metadata_chain_read_with_callbacks(chain, (FLAC__IOHandle)file, callbacks)) {
@@ -2043,7 +2043,7 @@ static FLAC__bool test_level_2_misc_(FLAC__bool is_ogg)
printf("read chain (callback-based)\n");
{
- FILE *file = fopen(flacfilename(is_ogg), "rb");
+ FILE *file = flac_fopen(flacfilename(is_ogg), "rb");
if(0 == file)
return die_("opening file");
if(!FLAC__metadata_chain_read_with_callbacks(chain, (FLAC__IOHandle)file, callbacks)) {