summaryrefslogtreecommitdiff
path: root/src/test_libFLAC++
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++
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++')
-rw-r--r--src/test_libFLAC++/decoders.cpp6
-rw-r--r--src/test_libFLAC++/encoders.cpp2
-rw-r--r--src/test_libFLAC++/metadata_manip.cpp34
-rw-r--r--src/test_libFLAC++/test_libFLAC++.vcproj80
4 files changed, 101 insertions, 21 deletions
diff --git a/src/test_libFLAC++/decoders.cpp b/src/test_libFLAC++/decoders.cpp
index f5b1d0b9..3e402e27 100644
--- a/src/test_libFLAC++/decoders.cpp
+++ b/src/test_libFLAC++/decoders.cpp
@@ -379,7 +379,7 @@ bool FileDecoder::test_respond(bool is_ogg)
case LAYER_FILE:
{
printf("opening %sFLAC file... ", is_ogg? "Ogg ":"");
- FILE *file = ::fopen(flacfilename(is_ogg), "rb");
+ FILE *file = ::flac_fopen(flacfilename(is_ogg), "rb");
if(0 == file) {
printf("ERROR (%s)\n", strerror(errno));
return false;
@@ -546,7 +546,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
case LAYER_STREAM:
case LAYER_SEEKABLE_STREAM:
printf("opening %sFLAC file... ", is_ogg? "Ogg ":"");
- dynamic_cast<StreamDecoder*>(decoder)->file_ = ::fopen(flacfilename(is_ogg), "rb");
+ dynamic_cast<StreamDecoder*>(decoder)->file_ = ::flac_fopen(flacfilename(is_ogg), "rb");
if(0 == dynamic_cast<StreamDecoder*>(decoder)->file_) {
printf("ERROR (%s)\n", strerror(errno));
return false;
@@ -559,7 +559,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
case LAYER_FILE:
{
printf("opening FLAC file... ");
- FILE *file = ::fopen(flacfilename(is_ogg), "rb");
+ FILE *file = ::flac_fopen(flacfilename(is_ogg), "rb");
if(0 == file) {
printf("ERROR (%s)\n", strerror(errno));
return false;
diff --git a/src/test_libFLAC++/encoders.cpp b/src/test_libFLAC++/encoders.cpp
index daa12f36..528e52f9 100644
--- a/src/test_libFLAC++/encoders.cpp
+++ b/src/test_libFLAC++/encoders.cpp
@@ -310,7 +310,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg)
if(layer < LAYER_FILENAME) {
printf("opening file for FLAC output... ");
- file = ::fopen(flacfilename(is_ogg), "w+b");
+ file = ::flac_fopen(flacfilename(is_ogg), "w+b");
if(0 == file) {
printf("ERROR (%s)\n", strerror(errno));
return false;
diff --git a/src/test_libFLAC++/metadata_manip.cpp b/src/test_libFLAC++/metadata_manip.cpp
index ff024162..54ed0997 100644
--- a/src/test_libFLAC++/metadata_manip.cpp
+++ b/src/test_libFLAC++/metadata_manip.cpp
@@ -208,7 +208,7 @@ bool open_tempfile_(const char *filename, FILE **tempfile, char **tempfilename)
strcpy(*tempfilename, filename);
strcat(*tempfilename, tempfile_suffix);
- if(0 == (*tempfile = fopen(*tempfilename, "wb")))
+ if(0 == (*tempfile = flac_fopen(*tempfilename, "wb")))
return false;
return true;
@@ -222,7 +222,7 @@ void cleanup_tempfile_(FILE **tempfile, char **tempfilename)
}
if(0 != *tempfilename) {
- (void)unlink(*tempfilename);
+ (void)flac_unlink(*tempfilename);
free(*tempfilename);
*tempfilename = 0;
}
@@ -241,14 +241,14 @@ bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilen
}
#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;
}
@@ -258,14 +258,14 @@ bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilen
return true;
}
-bool get_file_stats_(const char *filename, struct stat *stats)
+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));
}
-void set_file_stats_(const char *filename, struct stat *stats)
+void set_file_stats_(const char *filename, struct _flac_stat *stats)
{
struct utimbuf srctime;
@@ -274,8 +274,8 @@ 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__ && !defined __EMX__
FLAC_CHECK_RETURN(chown(filename, stats->st_uid, (gid_t)(-1)));
FLAC_CHECK_RETURN(chown(filename, (uid_t)(-1), stats->st_gid));
@@ -328,14 +328,14 @@ static bool write_chain_(FLAC::Metadata::Chain &chain, bool use_padding, bool pr
callbacks.eof = chain_eof_cb_;
if(chain.check_if_tempfile_needed(use_padding)) {
- struct stat stats;
+ struct _flac_stat stats;
FILE *file, *tempfile;
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);
@@ -356,7 +356,7 @@ static bool write_chain_(FLAC::Metadata::Chain &chain, bool use_padding, bool pr
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(!chain.write(use_padding, (::FLAC__IOHandle)file, callbacks)) {
@@ -384,7 +384,7 @@ static bool read_chain_(FLAC::Metadata::Chain &chain, const char *filename, bool
{
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 = chain.read((::FLAC__IOHandle)file, callbacks, is_ogg);
@@ -2077,7 +2077,7 @@ static bool test_level_2_misc_(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(!chain.read((::FLAC__IOHandle)file, callbacks)) {
@@ -2098,7 +2098,7 @@ static bool test_level_2_misc_(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(!chain.read((::FLAC__IOHandle)file, callbacks)) {
@@ -2126,7 +2126,7 @@ static bool test_level_2_misc_(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(!chain.read((::FLAC__IOHandle)file, callbacks)) {
diff --git a/src/test_libFLAC++/test_libFLAC++.vcproj b/src/test_libFLAC++/test_libFLAC++.vcproj
index 46e44c73..864de2f6 100644
--- a/src/test_libFLAC++/test_libFLAC++.vcproj
+++ b/src/test_libFLAC++/test_libFLAC++.vcproj
@@ -170,6 +170,86 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Release (UTF8)|Win32"
+ OutputDirectory="..\..\objs\release\bin"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories=".;..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;FLAC__STRINGS_IN_UTF8"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4267;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="..\..\objs\release\lib\libogg_static.lib"
+ LinkIncremental="1"
+ IgnoreDefaultLibraryNames="uuid.lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
</Configurations>
<References>
</References>