diff --git a/FLAC.sln b/FLAC.sln
index 84bcf7b2..c9884151 100644
--- a/FLAC.sln
+++ b/FLAC.sln
@@ -4,23 +4,27 @@ Microsoft Visual Studio Solution File, Format Version 9.00
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "example_c_decode_file", "examples\c\decode\file\example_c_decode_file.vcproj", "{4cefbd00-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "example_c_encode_file", "examples\c\encode\file\example_c_encode_file.vcproj", "{4cefbd01-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "example_cpp_decode_file", "examples\cpp\decode\file\example_cpp_decode_file.vcproj", "{4cefbe00-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
{4cefbc86-c215-11db-8314-0800200c9a66} = {4cefbc86-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "example_cpp_encode_file", "examples\cpp\encode\file\example_cpp_encode_file.vcproj", "{4cefbe01-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
{4cefbc86-c215-11db-8314-0800200c9a66} = {4cefbc86-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac", "src\flac\flac.vcproj", "{4cefbc7d-c215-11db-8314-0800200c9a66}"
@@ -31,16 +35,19 @@ Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac", "src\flac\flac.vcpro
{4cefbc80-c215-11db-8314-0800200c9a66} = {4cefbc80-c215-11db-8314-0800200c9a66}
{4cefbc8a-c215-11db-8314-0800200c9a66} = {4cefbc8a-c215-11db-8314-0800200c9a66}
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "iffscan", "src\flac\iffscan.vcproj", "{4cefbc94-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac_mac", "src\monkeys_audio_utilities\flac_mac\flac_mac.vcproj", "{4cefbc7e-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flac_ren", "src\monkeys_audio_utilities\flac_ren\flac_ren.vcproj", "{4cefbc7f-c215-11db-8314-0800200c9a66}"
@@ -48,6 +55,7 @@ EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flacdiff", "src\utils\flacdiff\flacdiff.vcproj", "{4cefbc93-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc86-c215-11db-8314-0800200c9a66} = {4cefbc86-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "flactimer", "src\utils\flactimer\flactimer.vcproj", "{4cefbc95-c215-11db-8314-0800200c9a66}"
@@ -58,20 +66,26 @@ Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "grabbag_static", "src\share
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
{4cefbc89-c215-11db-8314-0800200c9a66} = {4cefbc89-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "libFLAC_dynamic", "src\libFLAC\libFLAC_dynamic.vcproj", "{4cefbc83-c215-11db-8314-0800200c9a66}"
+ ProjectSection(ProjectDependencies) = postProject
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
+ EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "libFLAC_static", "src\libFLAC\libFLAC_static.vcproj", "{4cefbc84-c215-11db-8314-0800200c9a66}"
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "libFLAC++_dynamic", "src\libFLAC++\libFLAC++_dynamic.vcproj", "{4cefbc85-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc83-c215-11db-8314-0800200c9a66} = {4cefbc83-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "libFLAC++_static", "src\libFLAC++\libFLAC++_static.vcproj", "{4cefbc86-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "metaflac", "src\metaflac\metaflac.vcproj", "{4cefbc87-c215-11db-8314-0800200c9a66}"
@@ -81,12 +95,14 @@ Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "metaflac", "src\metaflac\me
{4cefbc92-c215-11db-8314-0800200c9a66} = {4cefbc92-c215-11db-8314-0800200c9a66}
{4cefbc89-c215-11db-8314-0800200c9a66} = {4cefbc89-c215-11db-8314-0800200c9a66}
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "plugin_common_static", "src\plugin_common\plugin_common_static.vcproj", "{4cefbc88-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "replaygain_analysis_static", "src\share\replaygain_analysis\replaygain_analysis_static.vcproj", "{4cefbc89-c215-11db-8314-0800200c9a66}"
@@ -96,6 +112,7 @@ EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_cuesheet", "src\test_grabbag\cuesheet\test_cuesheet.vcproj", "{4cefbc8b-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_libFLAC", "src\test_libFLAC\test_libFLAC.vcproj", "{4cefbc8c-c215-11db-8314-0800200c9a66}"
@@ -103,6 +120,7 @@ Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_libFLAC", "src\test_li
{4cefbc8e-c215-11db-8314-0800200c9a66} = {4cefbc8e-c215-11db-8314-0800200c9a66}
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_libFLAC++", "src\test_libFLAC++\test_libFLAC++.vcproj", "{4cefbc8d-c215-11db-8314-0800200c9a66}"
@@ -110,152 +128,225 @@ Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_libFLAC++", "src\test_
{4cefbc86-c215-11db-8314-0800200c9a66} = {4cefbc86-c215-11db-8314-0800200c9a66}
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
{4cefbc8e-c215-11db-8314-0800200c9a66} = {4cefbc8e-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_libs_common_static", "src\test_libs_common\test_libs_common_static.vcproj", "{4cefbc8e-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_picture", "src\test_grabbag\picture\test_picture.vcproj", "{4cefbc8f-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_seeking", "src\test_seeking\test_seeking.vcproj", "{4cefbc90-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc84-c215-11db-8314-0800200c9a66} = {4cefbc84-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "test_streams", "src\test_streams\test_streams.vcproj", "{4cefbc91-c215-11db-8314-0800200c9a66}"
ProjectSection(ProjectDependencies) = postProject
{4cefbc81-c215-11db-8314-0800200c9a66} = {4cefbc81-c215-11db-8314-0800200c9a66}
+ {4cefbe02-c215-11db-8314-0800200c9a66} = {4cefbe02-c215-11db-8314-0800200c9a66}
EndProjectSection
EndProject
Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "utf8_static", "src\share\utf8\utf8_static.vcproj", "{4cefbc92-c215-11db-8314-0800200c9a66}"
EndProject
+EndProject
+Project("{4cefbc7c-c215-11db-8314-0800200c9a66}") = "utf8_io", "src\share\utf8_io\utf8_io.vcproj", "{4cefbe02-c215-11db-8314-0800200c9a66}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
+ Release (UTF8)|Win32 = Release (UTF8)|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4cefbc7d-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc7d-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc7d-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc7d-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc7d-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc7d-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc7e-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc7e-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc7e-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc7e-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc7e-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc7e-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc7f-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc7f-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc7f-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc7f-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc7f-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc7f-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc80-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc80-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc80-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc80-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc80-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc80-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc81-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc81-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc81-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc81-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc81-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc81-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc82-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc82-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc82-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc82-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc82-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc82-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc83-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc83-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc83-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc83-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc83-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc83-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc84-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc84-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc84-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc84-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc84-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc84-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc85-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc85-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc85-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc85-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc85-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc85-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc86-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc86-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc86-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc86-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc86-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc86-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc87-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc87-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc87-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc87-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc87-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc87-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc88-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc88-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc88-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc88-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc88-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc88-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc89-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc89-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc89-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc89-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc89-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc89-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc8a-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc8a-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc8a-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc8a-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc8a-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc8a-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc8b-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc8b-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc8b-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc8b-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc8b-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc8b-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc8c-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc8c-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc8c-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc8c-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc8c-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc8c-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc8d-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc8d-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc8d-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc8d-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc8d-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc8d-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc8e-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc8e-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc8e-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc8e-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc8e-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc8e-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc8f-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc8f-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc8f-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc8f-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc8f-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc8f-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc90-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc90-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc90-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc90-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc90-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc90-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc91-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc91-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc91-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc91-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc91-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc91-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc92-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc92-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc92-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc92-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc92-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc92-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc93-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc93-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc93-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc93-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc93-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc93-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc94-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc94-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc94-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc94-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc94-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc94-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbc95-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbc95-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbc95-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbc95-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbc95-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbc95-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbd00-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbd00-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbd00-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbd00-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbd00-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbd00-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbd01-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbd01-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbd01-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbd01-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbd01-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbd01-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbe00-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbe00-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbe00-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbe00-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbe00-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbe00-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
{4cefbe01-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
{4cefbe01-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
{4cefbe01-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
{4cefbe01-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbe01-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbe01-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
+ {4cefbe02-c215-11db-8314-0800200c9a66}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4cefbe02-c215-11db-8314-0800200c9a66}.Debug|Win32.Build.0 = Debug|Win32
+ {4cefbe02-c215-11db-8314-0800200c9a66}.Release|Win32.ActiveCfg = Release|Win32
+ {4cefbe02-c215-11db-8314-0800200c9a66}.Release|Win32.Build.0 = Release|Win32
+ {4cefbe02-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.ActiveCfg = Release (UTF8)|Win32
+ {4cefbe02-c215-11db-8314-0800200c9a66}.Release (UTF8)|Win32.Build.0 = Release (UTF8)|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/examples/c/decode/file/example_c_decode_file.vcproj b/examples/c/decode/file/example_c_decode_file.vcproj
index 2498c816..4b1d250f 100644
--- a/examples/c/decode/file/example_c_decode_file.vcproj
+++ b/examples/c/decode/file/example_c_decode_file.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/c/encode/file/example_c_encode_file.vcproj b/examples/c/encode/file/example_c_encode_file.vcproj
index 4d10ac55..a6287fd2 100644
--- a/examples/c/encode/file/example_c_encode_file.vcproj
+++ b/examples/c/encode/file/example_c_encode_file.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/cpp/decode/file/example_cpp_decode_file.vcproj b/examples/cpp/decode/file/example_cpp_decode_file.vcproj
index b09bc0fe..40226cab 100644
--- a/examples/cpp/decode/file/example_cpp_decode_file.vcproj
+++ b/examples/cpp/decode/file/example_cpp_decode_file.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/cpp/encode/file/example_cpp_encode_file.vcproj b/examples/cpp/encode/file/example_cpp_encode_file.vcproj
index 38a3e26d..a2ea87e5 100644
--- a/examples/cpp/encode/file/example_cpp_encode_file.vcproj
+++ b/examples/cpp/encode/file/example_cpp_encode_file.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/include/share/compat.h b/include/share/compat.h
index 64139a2e..5c9f3289 100644
--- a/include/share/compat.h
+++ b/include/share/compat.h
@@ -141,6 +141,44 @@
# endif
#endif /* defined _MSC_VER */
+#ifdef FLAC__STRINGS_IN_UTF8 /* all char* strings are in UTF-8 format. Added to support Unicode files on Windows */
+#include "share/utf8_io.h"
+
+#define flac_printf printf_utf8
+#define flac_fprintf fprintf_utf8
+#define flac_vfprintf vfprintf_utf8
+#define flac_fopen fopen_utf8
+#define flac_stat _stat64_utf8
+#define flac_chmod chmod_utf8
+#define flac_utime utime_utf8
+#define flac_unlink unlink_utf8
+#define flac_rename rename_utf8
+
+#else
+
+#define flac_printf printf
+#define flac_fprintf fprintf
+#define flac_vfprintf vfprintf
+#define flac_fopen fopen
+#ifdef _WIN32
+#define flac_stat _stat64
+#else
+#define flac_stat stat
+#endif
+#define flac_chmod chmod
+#define flac_utime utime
+#define flac_unlink unlink
+#define flac_rename rename
+#endif
+
+#ifdef _WIN32
+#define _flac_stat _stat64 /* stat struct */
+#define flac_fstat _fstat64
+#else
+#define _flac_stat stat /* stat struct */
+#define flac_fstat fstat
+#endif
+
/* FLAC needs to compile and work correctly on systems with a norrmal ISO C99
* snprintf as well as Microsoft Visual Studio which has an non-standards
diff --git a/include/share/utf8_io.h b/include/share/utf8_io.h
new file mode 100644
index 00000000..1b8988a8
--- /dev/null
+++ b/include/share/utf8_io.h
@@ -0,0 +1,34 @@
+#ifdef FLAC__STRINGS_IN_UTF8
+
+#ifndef flac__utf8_io_h
+#define flac__utf8_io_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include
+#include
+#include
+
+
+int get_utf8_argv(int *argc, char ***argv);
+
+int printf_utf8(const char *format, ...);
+int fprintf_utf8(FILE *stream, const char *format, ...);
+int vfprintf_utf8(FILE *stream, const char *format, va_list argptr);
+
+FILE *fopen_utf8(const char *filename, const char *mode);
+int stat_utf8(const char *path, struct stat *buffer);
+int _stat64_utf8(const char *path, struct _stat64 *buffer);
+int chmod_utf8(const char *filename, int pmode);
+int utime_utf8(const char *filename, struct utimbuf *times);
+int unlink_utf8(const char *filename);
+int rename_utf8(const char *oldname, const char *newname);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
+#endif
diff --git a/src/flac/analyze.c b/src/flac/analyze.c
index f5a3f2e4..67020d0a 100644
--- a/src/flac/analyze.c
+++ b/src/flac/analyze.c
@@ -217,7 +217,7 @@ FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename)
const double s1 = stats->stddev, s2 = s1*2, s3 = s1*3, s4 = s1*4, s5 = s1*5, s6 = s1*6;
const double p = stats->buckets[stats->peak_index].count;
- outfile = fopen(filename, "w");
+ outfile = flac_fopen(filename, "w");
if(0 == outfile) {
fprintf(stderr, "ERROR opening %s: %s\n", filename, strerror(errno));
diff --git a/src/flac/decode.c b/src/flac/decode.c
index cc6bdc5d..646c386d 100644
--- a/src/flac/decode.c
+++ b/src/flac/decode.c
@@ -244,7 +244,7 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__
d->fout = grabbag__file_get_binary_stdout();
}
else {
- if(0 == (d->fout = fopen(outfilename, "wb"))) {
+ if(0 == (d->fout = flac_fopen(outfilename, "wb"))) {
flac__utils_printf(stderr, 1, "%s: ERROR: can't open output file %s: %s\n", d->inbasefilename, outfilename, strerror(errno));
DecoderSession_destroy(d, /*error_occurred=*/true);
return false;
@@ -263,7 +263,7 @@ void DecoderSession_destroy(DecoderSession *d, FLAC__bool error_occurred)
if(0 != d->fout && d->fout != stdout) {
fclose(d->fout);
if(error_occurred)
- unlink(d->outfilename);
+ flac_unlink(d->outfilename);
}
}
@@ -926,7 +926,7 @@ FLAC__bool fixup_iff_headers(DecoderSession *d)
d->format==FORMAT_WAVE64? "Wave64" :
d->format==FORMAT_RF64? "RF64" :
"AIFF";
- FILE *f = fopen(d->outfilename, "r+b"); /* stream is positioned at beginning of file */
+ FILE *f = flac_fopen(d->outfilename, "r+b"); /* stream is positioned at beginning of file */
if(0 == f) {
flac__utils_printf(stderr, 1, "ERROR, couldn't open file %s while fixing up %s chunk size: %s\n", d->outfilename, fmt_desc, strerror(errno));
diff --git a/src/flac/encode.c b/src/flac/encode.c
index 50ca006c..9e2cb77c 100644
--- a/src/flac/encode.c
+++ b/src/flac/encode.c
@@ -1665,7 +1665,7 @@ int EncoderSession_finish_error(EncoderSession *e)
print_verify_error(e);
else if(e->outputfile_opened)
/* only want to delete the file if we opened it; otherwise it could be an existing file and our overwrite failed */
- unlink(e->outfilename);
+ flac_unlink(e->outfilename);
EncoderSession_destroy(e);
@@ -2562,7 +2562,7 @@ FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_
return false;
}
- if(0 == (f = fopen(cuesheet_filename, "r"))) {
+ if(0 == (f = flac_fopen(cuesheet_filename, "r"))) {
flac__utils_printf(stderr, 1, "%s: ERROR opening cuesheet \"%s\" for reading: %s\n", inbasefilename, cuesheet_filename, strerror(errno));
return false;
}
@@ -2800,9 +2800,9 @@ FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, const char *fn)
FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset)
{
static unsigned char dump[8192];
- struct stat stb;
+ struct _flac_stat stb;
- if(fstat(fileno(f), &stb) == 0 && (stb.st_mode & S_IFMT) == S_IFREG)
+ if(flac_fstat(fileno(f), &stb) == 0 && (stb.st_mode & S_IFMT) == S_IFREG)
{
if(fseeko(f, offset, SEEK_CUR) == 0)
return true;
diff --git a/src/flac/flac.vcproj b/src/flac/flac.vcproj
index d0d50321..f166a958 100644
--- a/src/flac/flac.vcproj
+++ b/src/flac/flac.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/flac/foreign_metadata.c b/src/flac/foreign_metadata.c
index 3015f1d9..83729261 100644
--- a/src/flac/foreign_metadata.c
+++ b/src/flac/foreign_metadata.c
@@ -702,7 +702,7 @@ void flac__foreign_metadata_delete(foreign_metadata_t *fm)
FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error)
{
FLAC__bool ok;
- FILE *f = fopen(filename, "rb");
+ FILE *f = flac_fopen(filename, "rb");
if(!f) {
if(error) *error = "can't open AIFF file for reading (000)";
return false;
@@ -715,7 +715,7 @@ FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const c
FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error)
{
FLAC__bool ok;
- FILE *f = fopen(filename, "rb");
+ FILE *f = flac_fopen(filename, "rb");
if(!f) {
if(error) *error = "can't open WAVE file for reading (000)";
return false;
@@ -728,7 +728,7 @@ FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const c
FLAC__bool flac__foreign_metadata_read_from_wave64(foreign_metadata_t *fm, const char *filename, const char **error)
{
FLAC__bool ok;
- FILE *f = fopen(filename, "rb");
+ FILE *f = flac_fopen(filename, "rb");
if(!f) {
if(error) *error = "can't open Wave64 file for reading (000)";
return false;
@@ -752,12 +752,12 @@ FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const ch
FLAC__metadata_simple_iterator_delete(it);
return false;
}
- if(0 == (fin = fopen(infilename, "rb"))) {
+ if(0 == (fin = flac_fopen(infilename, "rb"))) {
if(error) *error = "can't open WAVE/AIFF file for reading (002)";
FLAC__metadata_simple_iterator_delete(it);
return false;
}
- if(0 == (fout = fopen(outfilename, "r+b"))) {
+ if(0 == (fout = flac_fopen(outfilename, "r+b"))) {
if(error) *error = "can't open FLAC file for updating (003)";
FLAC__metadata_simple_iterator_delete(it);
fclose(fin);
@@ -784,7 +784,7 @@ FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const c
FLAC__metadata_simple_iterator_delete(it);
return false;
}
- if(0 == (f = fopen(filename, "rb"))) {
+ if(0 == (f = flac_fopen(filename, "rb"))) {
if(error) *error = "can't open FLAC file for reading (002)";
FLAC__metadata_simple_iterator_delete(it);
return false;
@@ -799,11 +799,11 @@ FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const cha
{
FLAC__bool ok;
FILE *fin, *fout;
- if(0 == (fin = fopen(infilename, "rb"))) {
+ if(0 == (fin = flac_fopen(infilename, "rb"))) {
if(error) *error = "can't open FLAC file for reading (000)";
return false;
}
- if(0 == (fout = fopen(outfilename, "r+b"))) {
+ if(0 == (fout = flac_fopen(outfilename, "r+b"))) {
if(error) *error = "can't open WAVE/AIFF file for updating (001)";
fclose(fin);
return false;
diff --git a/src/flac/iffscan.c b/src/flac/iffscan.c
index b268cc8a..cf0fb936 100644
--- a/src/flac/iffscan.c
+++ b/src/flac/iffscan.c
@@ -58,43 +58,50 @@ int main(int argc, char *argv[])
size_t i;
FLAC__uint32 size;
+#ifdef FLAC__STRINGS_IN_UTF8
+ if (get_utf8_argv(&argc, &argv) != 0) {
+ fprintf(stderr, "%ERROR: failed to convert command line parameters to UTF-8\n");
+ return 1;
+ }
+#endif
+
if(argc != 2) {
- fprintf(stderr, "usage: %s { file.wav | file.aif }\n", argv[0]);
+ flac_fprintf(stderr, "usage: %s { file.wav | file.aif }\n", argv[0]);
return 1;
}
fn = argv[1];
- if(0 == (f = fopen(fn, "rb")) || fread(buf, 1, 4, f) != 4) {
- fprintf(stderr, "ERROR opening %s for reading\n", fn);
+ if(0 == (f = flac_fopen(fn, "rb")) || fread(buf, 1, 4, f) != 4) {
+ flac_fprintf(stderr, "ERROR opening %s for reading\n", fn);
return 1;
}
fclose(f);
if(0 == (fm = flac__foreign_metadata_new(memcmp(buf, "RIFF", 4) && memcmp(buf, "RF64", 4)? FOREIGN_BLOCK_TYPE__AIFF : FOREIGN_BLOCK_TYPE__RIFF))) {
- fprintf(stderr, "ERROR: out of memory\n");
+ flac_fprintf(stderr, "ERROR: out of memory\n");
return 1;
}
if(fm->type == FOREIGN_BLOCK_TYPE__AIFF) {
if(!flac__foreign_metadata_read_from_aiff(fm, fn, &error)) {
- fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error);
+ flac_fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error);
return 1;
}
}
else {
if(!flac__foreign_metadata_read_from_wave(fm, fn, &error)) {
- fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error);
+ flac_fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error);
return 1;
}
}
- if(0 == (f = fopen(fn, "rb"))) {
- fprintf(stderr, "ERROR opening %s for reading\n", fn);
+ if(0 == (f = flac_fopen(fn, "rb"))) {
+ flac_fprintf(stderr, "ERROR opening %s for reading\n", fn);
return 1;
}
for(i = 0; i < fm->num_blocks; i++) {
if(fseeko(f, fm->blocks[i].offset, SEEK_SET) < 0) {
- fprintf(stderr, "ERROR seeking in %s\n", fn);
+ flac_fprintf(stderr, "ERROR seeking in %s\n", fn);
return 1;
}
if(fread(buf, 1, i==0?12:8, f) != (i==0?12:8)) {
- fprintf(stderr, "ERROR reading %s\n", fn);
+ flac_fprintf(stderr, "ERROR reading %s\n", fn);
return 1;
}
size = unpack32_((const FLAC__byte*)buf+4, fm->type);
@@ -105,7 +112,7 @@ int main(int argc, char *argv[])
printf(" offset size=%08x=(%10u)", fm->ssnd_offset_size, fm->ssnd_offset_size);
else if(fm->type == FOREIGN_BLOCK_TYPE__RIFF && i == 1 && !memcmp(buf, "ds64", 4)) {
if(fread(buf+8, 1, 36-8, f) != 36-8) {
- fprintf(stderr, "ERROR reading %s\n", fn);
+ flac_fprintf(stderr, "ERROR reading %s\n", fn);
return 1;
}
printf(" RIFF size=%016" PRIx64 "=(" PRIu64 ")", unpack64le_(buf+8), unpack64le_(buf+8));
diff --git a/src/flac/iffscan.vcproj b/src/flac/iffscan.vcproj
index 3153029e..d9a241fd 100644
--- a/src/flac/iffscan.vcproj
+++ b/src/flac/iffscan.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/flac/main.c b/src/flac/main.c
index b6d4893a..7bbe460e 100644
--- a/src/flac/main.c
+++ b/src/flac/main.c
@@ -304,6 +304,12 @@ int main(int argc, char *argv[])
_response(&argc, &argv);
_wildcard(&argc, &argv);
#endif
+#ifdef FLAC__STRINGS_IN_UTF8
+ if (get_utf8_argv(&argc, &argv) != 0) {
+ fprintf(stderr, "ERROR: failed to convert command line parameters to UTF-8\n");
+ return 1;
+ }
+#endif
srand((unsigned)time(0));
setlocale(LC_ALL, "");
@@ -1684,7 +1690,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
}
else {
infilesize = grabbag__file_get_filesize(infilename);
- if(0 == (encode_infile = fopen(infilename, "rb"))) {
+ if(0 == (encode_infile = flac_fopen(infilename, "rb"))) {
flac__utils_printf(stderr, 1, "ERROR: can't open input file %s: %s\n", infilename, strerror(errno));
return 1;
}
@@ -1973,14 +1979,14 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
/* rename temporary file if necessary */
if(retval == 0 && internal_outfilename != 0) {
- if(rename(internal_outfilename, outfilename) < 0) {
+ if(flac_rename(internal_outfilename, outfilename) < 0) {
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
- /* on some flavors of windows, rename() will fail if the destination already exists, so we unlink and try again */
- if(unlink(outfilename) < 0) {
+ /* on some flavors of windows, flac_rename() will fail if the destination already exists, so we unlink and try again */
+ if(flac_unlink(outfilename) < 0) {
flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, keeping both\n", internal_outfilename, outfilename);
retval = 1;
}
- else if(rename(internal_outfilename, outfilename) < 0) {
+ else if(flac_rename(internal_outfilename, outfilename) < 0) {
flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, you must do it\n", internal_outfilename, outfilename);
retval = 1;
}
@@ -1993,7 +1999,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
/* handle --delete-input-file, but don't want to delete if piping from stdin, or if input filename and output filename are the same */
if(retval == 0 && option_values.delete_input && strcmp(infilename, "-") && internal_outfilename == 0)
- unlink(infilename);
+ flac_unlink(infilename);
if(internal_outfilename != 0)
free(internal_outfilename);
@@ -2135,7 +2141,7 @@ int decode_file(const char *infilename)
if(option_values.preserve_modtime && strcmp(outfilename, "-"))
grabbag__file_copy_metadata(infilename, outfilename);
if(option_values.delete_input && !option_values.test_only && !option_values.analyze)
- unlink(infilename);
+ flac_unlink(infilename);
}
return retval;
diff --git a/src/flac/utils.c b/src/flac/utils.c
index 4b36141b..1df651f7 100644
--- a/src/flac/utils.c
+++ b/src/flac/utils.c
@@ -147,7 +147,7 @@ void flac__utils_printf(FILE *stream, int level, const char *format, ...)
va_start(args, format);
- (void) vfprintf(stream, format, args);
+ (void) flac_vfprintf(stream, format, args);
va_end(args);
diff --git a/src/flac/vorbiscomment.c b/src/flac/vorbiscomment.c
index 789b1834..db6d9ade 100644
--- a/src/flac/vorbiscomment.c
+++ b/src/flac/vorbiscomment.c
@@ -126,7 +126,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie
if(0 == (data = malloc(size+1)))
die("out of memory allocating tag value");
data[size] = '\0';
- if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
+ if(0 == (f = flac_fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
free(data);
if(f)
fclose(f);
@@ -170,6 +170,9 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie
}
else {
FLAC__bool needs_free = false;
+#ifdef FLAC__STRINGS_IN_UTF8 /* everything in UTF-8 already. Must not alter */
+ entry.entry = (FLAC__byte *)field->field;
+#else
if(raw) {
entry.entry = (FLAC__byte *)field->field;
}
@@ -181,6 +184,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie
*violation = "error converting comment to UTF-8";
return false;
}
+#endif
entry.length = strlen((const char *)entry.entry);
if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) {
if(needs_free)
diff --git a/src/libFLAC++/libFLAC++_dynamic.vcproj b/src/libFLAC++/libFLAC++_dynamic.vcproj
index 2b7575c3..a019a3a2 100644
--- a/src/libFLAC++/libFLAC++_dynamic.vcproj
+++ b/src/libFLAC++/libFLAC++_dynamic.vcproj
@@ -166,6 +166,84 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libFLAC++/libFLAC++_static.vcproj b/src/libFLAC++/libFLAC++_static.vcproj
index e2c26ce4..fa91d66f 100644
--- a/src/libFLAC++/libFLAC++_static.vcproj
+++ b/src/libFLAC++/libFLAC++_static.vcproj
@@ -145,6 +145,72 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libFLAC/libFLAC_dynamic.vcproj b/src/libFLAC/libFLAC_dynamic.vcproj
index 414cfdaf..76383e22 100644
--- a/src/libFLAC/libFLAC_dynamic.vcproj
+++ b/src/libFLAC/libFLAC_dynamic.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -427,6 +508,16 @@
Outputs="ia32/bitreader_asm.obj"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libFLAC/libFLAC_static.vcproj b/src/libFLAC/libFLAC_static.vcproj
index 3f9a8de1..963cf781 100644
--- a/src/libFLAC/libFLAC_static.vcproj
+++ b/src/libFLAC/libFLAC_static.vcproj
@@ -147,6 +147,73 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -402,6 +469,16 @@
Outputs="ia32/bitreader_asm.obj"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libFLAC/metadata_iterators.c b/src/libFLAC/metadata_iterators.c
index 7349ff80..5e1bf880 100644
--- a/src/libFLAC/metadata_iterators.c
+++ b/src/libFLAC/metadata_iterators.c
@@ -118,8 +118,8 @@ static FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path
static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status);
static void cleanup_tempfile_(FILE **tempfile, char **tempfilename);
-static FLAC__bool get_file_stats_(const char *filename, struct stat *stats);
-static void set_file_stats_(const char *filename, struct stat *stats);
+static FLAC__bool get_file_stats_(const char *filename, struct _flac_stat *stats);
+static void set_file_stats_(const char *filename, struct _flac_stat *stats);
static int fseek_wrapper_(FLAC__IOHandle handle, FLAC__int64 offset, int whence);
static FLAC__int64 ftell_wrapper_(FLAC__IOHandle handle);
@@ -327,7 +327,7 @@ FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__Strea
struct FLAC__Metadata_SimpleIterator {
FILE *file;
char *filename, *tempfile_path_prefix;
- struct stat stats;
+ struct _flac_stat stats;
FLAC__bool has_stats;
FLAC__bool is_writable;
FLAC__Metadata_SimpleIteratorStatus status;
@@ -420,10 +420,10 @@ static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *it
FLAC__ASSERT(0 != iterator);
- if(read_only || 0 == (iterator->file = fopen(iterator->filename, "r+b"))) {
+ if(read_only || 0 == (iterator->file = flac_fopen(iterator->filename, "r+b"))) {
iterator->is_writable = false;
if(read_only || errno == EACCES) {
- if(0 == (iterator->file = fopen(iterator->filename, "rb"))) {
+ if(0 == (iterator->file = flac_fopen(iterator->filename, "rb"))) {
iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
return false;
}
@@ -478,7 +478,7 @@ FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *it
FLAC_API FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool read_only, FLAC__bool preserve_file_stats)
{
- const char *tempfile_path_prefix = 0; /*@@@ search for comments near 'rename(...)' for what it will take to finish implementing this */
+ const char *tempfile_path_prefix = 0; /*@@@ search for comments near 'flac_rename(...)' for what it will take to finish implementing this */
FLAC__ASSERT(0 != iterator);
FLAC__ASSERT(0 != filename);
@@ -1363,7 +1363,7 @@ static FLAC__bool chain_rewrite_metadata_in_place_(FLAC__Metadata_Chain *chain)
FLAC__ASSERT(0 != chain->filename);
- if(0 == (file = fopen(chain->filename, "r+b"))) {
+ if(0 == (file = flac_fopen(chain->filename, "r+b"))) {
chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
return false;
}
@@ -1388,7 +1388,7 @@ static FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *t
FLAC__ASSERT(0 != chain->head);
/* copy the file prefix (data up to first metadata block */
- if(0 == (f = fopen(chain->filename, "rb"))) {
+ if(0 == (f = flac_fopen(chain->filename, "rb"))) {
chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
return false;
}
@@ -1526,7 +1526,7 @@ static FLAC__bool chain_read_(FLAC__Metadata_Chain *chain, const char *filename,
chain->is_ogg = is_ogg;
- if(0 == (file = fopen(filename, "rb"))) {
+ if(0 == (file = flac_fopen(filename, "rb"))) {
chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE;
return false;
}
@@ -1630,7 +1630,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata
FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats)
{
- struct stat stats;
+ struct _flac_stat stats;
const char *tempfile_path_prefix = 0;
FLAC__off_t current_length;
@@ -3243,7 +3243,7 @@ FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix
local_snprintf(*tempfilename, dest_len, "%s/%s%s", tempfile_path_prefix, p, tempfile_suffix);
}
- if(0 == (*tempfile = fopen(*tempfilename, "w+b"))) {
+ if(0 == (*tempfile = flac_fopen(*tempfilename, "w+b"))) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
return false;
}
@@ -3264,16 +3264,16 @@ FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tem
*tempfile = 0;
#if defined _MSC_VER || defined __BORLANDC__ || 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);
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR;
return false;
}
#endif
- /*@@@ to fully support the tempfile_path_prefix we need to update this piece to actually copy across filesystems instead of just rename(): */
- if(0 != rename(*tempfilename, filename)) {
+ /*@@@ to fully support the tempfile_path_prefix we need to update this piece to actually copy across filesystems instead of just flac_rename(): */
+ if(0 != flac_rename(*tempfilename, filename)) {
cleanup_tempfile_(tempfile, tempfilename);
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR;
return false;
@@ -3292,20 +3292,20 @@ void cleanup_tempfile_(FILE **tempfile, char **tempfilename)
}
if(0 != *tempfilename) {
- (void)unlink(*tempfilename);
+ (void)flac_unlink(*tempfilename);
free(*tempfilename);
*tempfilename = 0;
}
}
-FLAC__bool get_file_stats_(const char *filename, struct stat *stats)
+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));
}
-void set_file_stats_(const char *filename, struct stat *stats)
+void set_file_stats_(const char *filename, struct _flac_stat *stats)
{
struct utimbuf srctime;
@@ -3314,8 +3314,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 __BORLANDC__ && !defined __MINGW32__
FLAC_CHECK_RETURN(chown(filename, stats->st_uid, -1));
FLAC_CHECK_RETURN(chown(filename, -1, stats->st_gid));
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c
index 320baa86..753fd230 100644
--- a/src/libFLAC/stream_decoder.c
+++ b/src/libFLAC/stream_decoder.c
@@ -604,7 +604,7 @@ static FLAC__StreamDecoderInitStatus init_file_internal_(
if(0 == write_callback || 0 == error_callback)
return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
- file = filename? fopen(filename, "rb") : stdin;
+ file = filename? flac_fopen(filename, "rb") : stdin;
if(0 == file)
return FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE;
@@ -3342,20 +3342,12 @@ FLAC__StreamDecoderTellStatus file_tell_callback_(const FLAC__StreamDecoder *dec
FLAC__StreamDecoderLengthStatus file_length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
{
-#if defined _MSC_VER || defined __MINGW32__
- struct _stat64 filestats;
-#else
- struct stat filestats;
-#endif
+ struct _flac_stat filestats;
(void)client_data;
if(decoder->private_->file == stdin)
return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
-#if defined _MSC_VER || defined __MINGW32__
- else if(_fstat64(fileno(decoder->private_->file), &filestats) != 0)
-#else
- else if(fstat(fileno(decoder->private_->file), &filestats) != 0)
-#endif
+ else if(flac_fstat(fileno(decoder->private_->file), &filestats) != 0)
return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
else {
*stream_length = (FLAC__uint64)filestats.st_size;
diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c
index f51ba742..6c180fe4 100644
--- a/src/libFLAC/stream_encoder.c
+++ b/src/libFLAC/stream_encoder.c
@@ -1250,7 +1250,7 @@ static FLAC__StreamEncoderInitStatus init_file_internal_(
if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
- file = filename? fopen(filename, "w+b") : stdout;
+ file = filename? flac_fopen(filename, "w+b") : stdout;
if(file == 0) {
encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR;
diff --git a/src/metaflac/main.c b/src/metaflac/main.c
index 10baffd6..e85d1c29 100644
--- a/src/metaflac/main.c
+++ b/src/metaflac/main.c
@@ -24,6 +24,7 @@
#include "options.h"
#include
#include
+#include "share/compat.h"
int main(int argc, char *argv[])
{
@@ -34,6 +35,12 @@ int main(int argc, char *argv[])
_response(&argc, &argv);
_wildcard(&argc, &argv);
#endif
+#ifdef FLAC__STRINGS_IN_UTF8
+ if (get_utf8_argv(&argc, &argv) != 0) {
+ fprintf(stderr, "%ERROR: failed to convert command line parameters to UTF-8\n");
+ return 1;
+ }
+#endif
setlocale(LC_ALL, "");
init_options(&options);
diff --git a/src/metaflac/metaflac.vcproj b/src/metaflac/metaflac.vcproj
index d6637fe1..b31e2045 100644
--- a/src/metaflac/metaflac.vcproj
+++ b/src/metaflac/metaflac.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/metaflac/operations.c b/src/metaflac/operations.c
index 84d49417..cd31a3d4 100644
--- a/src/metaflac/operations.c
+++ b/src/metaflac/operations.c
@@ -187,7 +187,7 @@ FLAC__bool do_major_operation__list(const char *filename, FLAC__Metadata_Chain *
block = FLAC__metadata_iterator_get_block(iterator);
ok &= (0 != block);
if(!ok)
- fprintf(stderr, "%s: ERROR: couldn't get block from chain\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: couldn't get block from chain\n", filename);
else if(passes_filter(options, FLAC__metadata_iterator_get_block(iterator), block_number))
write_metadata(filename, block, block_number, !options->utf8_convert, options->application_data_format_is_hexdump);
block_number++;
@@ -201,7 +201,7 @@ FLAC__bool do_major_operation__list(const char *filename, FLAC__Metadata_Chain *
FLAC__bool do_major_operation__append(FLAC__Metadata_Chain *chain, const CommandLineOptions *options)
{
(void) chain, (void) options;
- fprintf(stderr, "ERROR: --append not implemented yet\n");
+ flac_fprintf(stderr, "ERROR: --append not implemented yet\n");
return false;
}
@@ -406,7 +406,7 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu
for(i = 0; i < num_files; i++) {
FLAC__ASSERT(0 != filenames[i]);
if(!FLAC__metadata_get_streaminfo(filenames[i], &streaminfo)) {
- fprintf(stderr, "%s: ERROR: can't open file or get STREAMINFO block\n", filenames[i]);
+ flac_fprintf(stderr, "%s: ERROR: can't open file or get STREAMINFO block\n", filenames[i]);
return false;
}
if(first) {
@@ -417,24 +417,24 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu
}
else {
if(sample_rate != streaminfo.data.stream_info.sample_rate) {
- fprintf(stderr, "%s: ERROR: sample rate of %u Hz does not match previous files' %u Hz\n", filenames[i], streaminfo.data.stream_info.sample_rate, sample_rate);
+ flac_fprintf(stderr, "%s: ERROR: sample rate of %u Hz does not match previous files' %u Hz\n", filenames[i], streaminfo.data.stream_info.sample_rate, sample_rate);
return false;
}
if(bits_per_sample != streaminfo.data.stream_info.bits_per_sample) {
- fprintf(stderr, "%s: ERROR: resolution of %u bps does not match previous files' %u bps\n", filenames[i], streaminfo.data.stream_info.bits_per_sample, bits_per_sample);
+ flac_fprintf(stderr, "%s: ERROR: resolution of %u bps does not match previous files' %u bps\n", filenames[i], streaminfo.data.stream_info.bits_per_sample, bits_per_sample);
return false;
}
if(channels != streaminfo.data.stream_info.channels) {
- fprintf(stderr, "%s: ERROR: # channels (%u) does not match previous files' (%u)\n", filenames[i], streaminfo.data.stream_info.channels, channels);
+ flac_fprintf(stderr, "%s: ERROR: # channels (%u) does not match previous files' (%u)\n", filenames[i], streaminfo.data.stream_info.channels, channels);
return false;
}
}
if(!grabbag__replaygain_is_valid_sample_frequency(sample_rate)) {
- fprintf(stderr, "%s: ERROR: sample rate of %u Hz is not supported\n", filenames[i], sample_rate);
+ flac_fprintf(stderr, "%s: ERROR: sample rate of %u Hz is not supported\n", filenames[i], sample_rate);
return false;
}
if(channels != 1 && channels != 2) {
- fprintf(stderr, "%s: ERROR: # of channels (%u) is not supported, must be 1 or 2\n", filenames[i], channels);
+ flac_fprintf(stderr, "%s: ERROR: # of channels (%u) is not supported, must be 1 or 2\n", filenames[i], channels);
return false;
}
}
@@ -443,7 +443,7 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu
if(!grabbag__replaygain_init(sample_rate)) {
FLAC__ASSERT(0);
/* double protection */
- fprintf(stderr, "internal error\n");
+ flac_fprintf(stderr, "internal error\n");
return false;
}
@@ -455,7 +455,7 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu
for(i = 0; i < num_files; i++) {
if(0 != (error = grabbag__replaygain_analyze_file(filenames[i], title_gains+i, title_peaks+i))) {
- fprintf(stderr, "%s: ERROR: during analysis (%s)\n", filenames[i], error);
+ flac_fprintf(stderr, "%s: ERROR: during analysis (%s)\n", filenames[i], error);
free(title_gains);
free(title_peaks);
return false;
@@ -465,7 +465,7 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu
for(i = 0; i < num_files; i++) {
if(0 != (error = grabbag__replaygain_store_to_file(filenames[i], album_gain, album_peak, title_gains[i], title_peaks[i], preserve_modtime))) {
- fprintf(stderr, "%s: ERROR: writing tags (%s)\n", filenames[i], error);
+ flac_fprintf(stderr, "%s: ERROR: writing tags (%s)\n", filenames[i], error);
free(title_gains);
free(title_peaks);
return false;
@@ -551,7 +551,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
unsigned i, j;
/*@@@ yuck, should do this with a varargs function or something: */
-#define PPR if(filename)printf("%s:",filename);
+#define PPR if(filename)flac_printf("%s:",filename);
PPR; printf("METADATA block #%u\n", block_number);
PPR; printf(" type: %u (%s)\n", (unsigned)block->type, block->type < FLAC__METADATA_TYPE_UNDEFINED? FLAC__MetadataTypeString[block->type] : "UNKNOWN");
PPR; printf(" is last: %s\n", block->is_last? "true":"false");
diff --git a/src/metaflac/operations_shorthand_cuesheet.c b/src/metaflac/operations_shorthand_cuesheet.c
index f59bc899..10f814b4 100644
--- a/src/metaflac/operations_shorthand_cuesheet.c
+++ b/src/metaflac/operations_shorthand_cuesheet.c
@@ -51,7 +51,7 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata
if(block->type == FLAC__METADATA_TYPE_STREAMINFO) {
lead_out_offset = block->data.stream_info.total_samples;
if(lead_out_offset == 0) {
- fprintf(stderr, "%s: ERROR: FLAC file must have total_samples set in STREAMINFO in order to import/export cuesheet\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: FLAC file must have total_samples set in STREAMINFO in order to import/export cuesheet\n", filename);
FLAC__metadata_iterator_delete(iterator);
return false;
}
@@ -63,7 +63,7 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata
} while(FLAC__metadata_iterator_next(iterator));
if(lead_out_offset == 0) {
- fprintf(stderr, "%s: ERROR: FLAC stream has no STREAMINFO block\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: FLAC stream has no STREAMINFO block\n", filename);
FLAC__metadata_iterator_delete(iterator);
return false;
}
@@ -71,7 +71,7 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata
switch(operation->type) {
case OP__IMPORT_CUESHEET_FROM:
if(0 != cuesheet) {
- fprintf(stderr, "%s: ERROR: FLAC file already has CUESHEET block\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: FLAC file already has CUESHEET block\n", filename);
ok = false;
}
else {
@@ -90,7 +90,7 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata
break;
case OP__EXPORT_CUESHEET_TO:
if(0 == cuesheet) {
- fprintf(stderr, "%s: ERROR: FLAC file has no CUESHEET block\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: FLAC file has no CUESHEET block\n", filename);
ok = false;
}
else
@@ -118,16 +118,16 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet,
unsigned last_line_read;
if(0 == cs_filename || strlen(cs_filename) == 0) {
- fprintf(stderr, "%s: ERROR: empty import file name\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: empty import file name\n", filename);
return false;
}
if(0 == strcmp(cs_filename, "-"))
f = stdin;
else
- f = fopen(cs_filename, "r");
+ f = flac_fopen(cs_filename, "r");
if(0 == f) {
- fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, cs_filename, strerror(errno));
+ flac_fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, cs_filename, strerror(errno));
return false;
}
@@ -137,18 +137,18 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet,
fclose(f);
if(0 == *cuesheet) {
- fprintf(stderr, "%s: ERROR: while parsing cuesheet \"%s\" on line %u: %s\n", filename, cs_filename, last_line_read, error_message);
+ flac_fprintf(stderr, "%s: ERROR: while parsing cuesheet \"%s\" on line %u: %s\n", filename, cs_filename, last_line_read, error_message);
return false;
}
if(!FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/false, &error_message)) {
- fprintf(stderr, "%s: ERROR parsing cuesheet \"%s\": %s\n", filename, cs_filename, error_message);
+ flac_fprintf(stderr, "%s: ERROR parsing cuesheet \"%s\": %s\n", filename, cs_filename, error_message);
return false;
}
/* if we're expecting CDDA, warn about non-compliance */
if(is_cdda && !FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/true, &error_message)) {
- fprintf(stderr, "%s: WARNING cuesheet \"%s\" is not audio CD compliant: %s\n", filename, cs_filename, error_message);
+ flac_fprintf(stderr, "%s: WARNING cuesheet \"%s\" is not audio CD compliant: %s\n", filename, cs_filename, error_message);
(*cuesheet)->data.cue_sheet.is_cd = false;
}
@@ -179,22 +179,22 @@ FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cueshe
size_t reflen;
if(0 == cs_filename || strlen(cs_filename) == 0) {
- fprintf(stderr, "%s: ERROR: empty export file name\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: empty export file name\n", filename);
return false;
}
if(0 == strcmp(cs_filename, "-"))
f = stdout;
else
- f = fopen(cs_filename, "w");
+ f = flac_fopen(cs_filename, "w");
if(0 == f) {
- fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, cs_filename, strerror(errno));
+ flac_fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, cs_filename, strerror(errno));
return false;
}
reflen = strlen(filename) + 7 + 1;
if(0 == (ref = malloc(reflen))) {
- fprintf(stderr, "%s: ERROR: allocating memory\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: allocating memory\n", filename);
if(f != stdout)
fclose(f);
return false;
diff --git a/src/metaflac/operations_shorthand_picture.c b/src/metaflac/operations_shorthand_picture.c
index b0f5ce27..8cfd4cb4 100644
--- a/src/metaflac/operations_shorthand_picture.c
+++ b/src/metaflac/operations_shorthand_picture.c
@@ -94,9 +94,9 @@ FLAC__bool do_shorthand_operation__picture(const char *filename, FLAC__Metadata_
} while(FLAC__metadata_iterator_next(iterator) && 0 == picture);
if(0 == picture) {
if(block_number < 0)
- fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block\n", filename);
else
- fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block at block #%d\n", filename, block_number);
+ flac_fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block at block #%d\n", filename, block_number);
ok = false;
}
else
@@ -122,19 +122,19 @@ FLAC__bool import_pic_from(const char *filename, FLAC__StreamMetadata **picture,
const char *error_message;
if(0 == specification || strlen(specification) == 0) {
- fprintf(stderr, "%s: ERROR: empty picture specification\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: empty picture specification\n", filename);
return false;
}
*picture = grabbag__picture_parse_specification(specification, &error_message);
if(0 == *picture) {
- fprintf(stderr, "%s: ERROR: while parsing picture specification \"%s\": %s\n", filename, specification, error_message);
+ flac_fprintf(stderr, "%s: ERROR: while parsing picture specification \"%s\": %s\n", filename, specification, error_message);
return false;
}
if(!FLAC__format_picture_is_legal(&(*picture)->data.picture, &error_message)) {
- fprintf(stderr, "%s: ERROR: new PICTURE block for \"%s\" is illegal: %s\n", filename, specification, error_message);
+ flac_fprintf(stderr, "%s: ERROR: new PICTURE block for \"%s\" is illegal: %s\n", filename, specification, error_message);
return false;
}
@@ -148,21 +148,21 @@ FLAC__bool export_pic_to(const char *filename, const FLAC__StreamMetadata *pictu
const FLAC__uint32 len = picture->data.picture.data_length;
if(0 == pic_filename || strlen(pic_filename) == 0) {
- fprintf(stderr, "%s: ERROR: empty export file name\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: empty export file name\n", filename);
return false;
}
if(0 == strcmp(pic_filename, "-"))
f = grabbag__file_get_binary_stdout();
else
- f = fopen(pic_filename, "wb");
+ f = flac_fopen(pic_filename, "wb");
if(0 == f) {
- fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, pic_filename, strerror(errno));
+ flac_fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, pic_filename, strerror(errno));
return false;
}
if(fwrite(picture->data.picture.data, 1, len, f) != len) {
- fprintf(stderr, "%s: ERROR: writing PICTURE data to file\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: writing PICTURE data to file\n", filename);
if(f != stdout)
fclose(f);
return false;
diff --git a/src/metaflac/operations_shorthand_seektable.c b/src/metaflac/operations_shorthand_seektable.c
index a06d6764..dbc8c532 100644
--- a/src/metaflac/operations_shorthand_seektable.c
+++ b/src/metaflac/operations_shorthand_seektable.c
@@ -53,7 +53,7 @@ FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Me
} while(!found_seektable_block && FLAC__metadata_iterator_next(iterator));
if(total_samples == 0) {
- fprintf(stderr, "%s: ERROR: cannot add seekpoints because STREAMINFO block does not specify total_samples\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: cannot add seekpoints because STREAMINFO block does not specify total_samples\n", filename);
return false;
}
@@ -79,7 +79,7 @@ FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Me
FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_SEEKTABLE);
if(!grabbag__seektable_convert_specification_to_template(specification, /*only_explicit_placeholders=*/false, total_samples, sample_rate, block, /*spec_has_real_points=*/0)) {
- fprintf(stderr, "%s: ERROR (internal) preparing seektable with seekpoints\n", filename);
+ flac_fprintf(stderr, "%s: ERROR (internal) preparing seektable with seekpoints\n", filename);
return false;
}
@@ -178,7 +178,7 @@ FLAC__bool populate_seekpoint_values(const char *filename, FLAC__StreamMetadata
decoder = FLAC__stream_decoder_new();
if(0 == decoder) {
- fprintf(stderr, "%s: ERROR (--add-seekpoint) creating the decoder instance\n", filename);
+ flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) creating the decoder instance\n", filename);
return false;
}
@@ -186,28 +186,28 @@ FLAC__bool populate_seekpoint_values(const char *filename, FLAC__StreamMetadata
FLAC__stream_decoder_set_metadata_ignore_all(decoder);
if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, /*metadata_callback=*/0, error_callback_, &client_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
- fprintf(stderr, "%s: ERROR (--add-seekpoint) initializing the decoder instance (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
+ flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) initializing the decoder instance (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
ok = false;
}
if(ok && !FLAC__stream_decoder_process_until_end_of_metadata(decoder)) {
- fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
+ flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
ok = false;
}
if(ok && !FLAC__stream_decoder_get_decode_position(decoder, &client_data.audio_offset)) {
- fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file\n", filename);
+ flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file\n", filename);
ok = false;
}
client_data.last_offset = client_data.audio_offset;
if(ok && !FLAC__stream_decoder_process_until_end_of_stream(decoder)) {
- fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
+ flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder));
ok = false;
}
if(ok && client_data.error_occurred) {
- fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%u:%s)\n", filename, (unsigned)client_data.error_status, FLAC__StreamDecoderErrorStatusString[client_data.error_status]);
+ flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%u:%s)\n", filename, (unsigned)client_data.error_status, FLAC__StreamDecoderErrorStatusString[client_data.error_status]);
ok = false;
}
diff --git a/src/metaflac/operations_shorthand_streaminfo.c b/src/metaflac/operations_shorthand_streaminfo.c
index a392a5a0..e37a5771 100644
--- a/src/metaflac/operations_shorthand_streaminfo.c
+++ b/src/metaflac/operations_shorthand_streaminfo.c
@@ -46,7 +46,7 @@ FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool p
FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_STREAMINFO);
if(prefix_with_filename)
- printf("%s:", filename);
+ flac_printf("%s:", filename);
switch(operation->type) {
case OP__SHOW_MD5SUM:
diff --git a/src/metaflac/operations_shorthand_vorbiscomment.c b/src/metaflac/operations_shorthand_vorbiscomment.c
index 610e972d..61537bf5 100644
--- a/src/metaflac/operations_shorthand_vorbiscomment.c
+++ b/src/metaflac/operations_shorthand_vorbiscomment.c
@@ -127,7 +127,7 @@ FLAC__bool remove_vc_all(const char *filename, FLAC__StreamMetadata *block, FLAC
if(0 != block->data.vorbis_comment.comments) {
FLAC__ASSERT(block->data.vorbis_comment.num_comments > 0);
if(!FLAC__metadata_object_vorbiscomment_resize_comments(block, 0)) {
- fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
return false;
}
*needs_write = true;
@@ -148,7 +148,7 @@ FLAC__bool remove_vc_field(const char *filename, FLAC__StreamMetadata *block, co
n = FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, field_name);
if(n < 0) {
- fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
return false;
}
else if(n > 0)
@@ -166,7 +166,7 @@ FLAC__bool remove_vc_firstfield(const char *filename, FLAC__StreamMetadata *bloc
n = FLAC__metadata_object_vorbiscomment_remove_entry_matching(block, field_name);
if(n < 0) {
- fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
return false;
}
else if(n > 0)
@@ -191,18 +191,18 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
char *data = 0;
const FLAC__off_t size = grabbag__file_get_filesize(field->field_value);
if(size < 0) {
- fprintf(stderr, "%s: ERROR: can't open file '%s' for '%s' tag value\n", filename, field->field_value, field->field_name);
+ flac_fprintf(stderr, "%s: ERROR: can't open file '%s' for '%s' tag value\n", filename, field->field_value, field->field_name);
return false;
}
if(size >= 0x100000) { /* magic arbitrary limit, actual format limit is near 16MB */
- fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is too large\n", filename, field->field_value, field->field_name);
+ flac_fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is too large\n", filename, field->field_value, field->field_name);
return false;
}
if(0 == (data = malloc(size+1)))
die("out of memory allocating tag value");
data[size] = '\0';
- if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
- fprintf(stderr, "%s: ERROR: while reading file '%s' for '%s' tag value: %s\n", filename, field->field_value, field->field_name, strerror(errno));
+ if(0 == (f = flac_fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
+ flac_fprintf(stderr, "%s: ERROR: while reading file '%s' for '%s' tag value: %s\n", filename, field->field_value, field->field_name, strerror(errno));
free(data);
if(f)
fclose(f);
@@ -211,7 +211,7 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
fclose(f);
if(strlen(data) != (size_t)size) {
free(data);
- fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value has embedded NULs\n", filename, field->field_value, field->field_name);
+ flac_fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value has embedded NULs\n", filename, field->field_value, field->field_name);
return false;
}
@@ -224,19 +224,19 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
}
else {
free(data);
- fprintf(stderr, "%s: ERROR: converting file '%s' contents to UTF-8 for tag value\n", filename, field->field_value);
+ flac_fprintf(stderr, "%s: ERROR: converting file '%s' contents to UTF-8 for tag value\n", filename, field->field_value);
return false;
}
/* create and entry and append it */
if(!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, field->field_name, converted)) {
free(converted);
- fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is not valid UTF-8\n", filename, field->field_value, field->field_name);
+ flac_fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is not valid UTF-8\n", filename, field->field_value, field->field_name);
return false;
}
free(converted);
if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) {
- fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
return false;
}
@@ -245,6 +245,9 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
}
else {
FLAC__bool needs_free = false;
+#ifdef FLAC__STRINGS_IN_UTF8 /* do not convert anything or things will break */
+ entry.entry = (FLAC__byte *)field->field;
+#else
if(raw) {
entry.entry = (FLAC__byte *)field->field;
}
@@ -253,9 +256,10 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
needs_free = true;
}
else {
- fprintf(stderr, "%s: ERROR: converting comment '%s' to UTF-8\n", filename, field->field);
+ flac_fprintf(stderr, "%s: ERROR: converting comment '%s' to UTF-8\n", filename, field->field);
return false;
}
+#endif
entry.length = strlen((const char *)entry.entry);
if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) {
if(needs_free)
@@ -264,14 +268,14 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
* our previous parsing has already established that the field
* name is OK, so it must be the field value
*/
- fprintf(stderr, "%s: ERROR: tag value for '%s' is not valid UTF-8\n", filename, field->field_name);
+ flac_fprintf(stderr, "%s: ERROR: tag value for '%s' is not valid UTF-8\n", filename, field->field_name);
return false;
}
if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) {
if(needs_free)
free(converted);
- fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename);
return false;
}
@@ -289,16 +293,16 @@ FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, con
FLAC__bool ret;
if(0 == vc_filename->value || strlen(vc_filename->value) == 0) {
- fprintf(stderr, "%s: ERROR: empty import file name\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: empty import file name\n", filename);
return false;
}
if(0 == strcmp(vc_filename->value, "-"))
f = stdin;
else
- f = fopen(vc_filename->value, "r");
+ f = flac_fopen(vc_filename->value, "r");
if(0 == f) {
- fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, vc_filename->value, strerror(errno));
+ flac_fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, vc_filename->value, strerror(errno));
return false;
}
@@ -307,7 +311,7 @@ FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, con
if(!feof(f)) {
char *p = strchr(line, '\n');
if(0 == p) {
- fprintf(stderr, "%s: ERROR: line too long, aborting\n", vc_filename->value);
+ flac_fprintf(stderr, "%s: ERROR: line too long, aborting\n", vc_filename->value);
ret = false;
}
else {
@@ -318,7 +322,7 @@ FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, con
field.field_value_from_file = false;
if(!parse_vorbis_comment_field(line, &field.field, &field.field_name, &field.field_value, &field.field_value_length, &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "%s: ERROR: malformed vorbis comment field \"%s\",\n %s\n", vc_filename->value, line, violation);
+ flac_fprintf(stderr, "%s: ERROR: malformed vorbis comment field \"%s\",\n %s\n", vc_filename->value, line, violation);
ret = false;
}
else {
@@ -345,16 +349,16 @@ FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const
FLAC__bool ret;
if(0 == vc_filename->value || strlen(vc_filename->value) == 0) {
- fprintf(stderr, "%s: ERROR: empty export file name\n", filename);
+ flac_fprintf(stderr, "%s: ERROR: empty export file name\n", filename);
return false;
}
if(0 == strcmp(vc_filename->value, "-"))
f = stdout;
else
- f = fopen(vc_filename->value, "w");
+ f = flac_fopen(vc_filename->value, "w");
if(0 == f) {
- fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, vc_filename->value, strerror(errno));
+ flac_fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, vc_filename->value, strerror(errno));
return false;
}
diff --git a/src/metaflac/options.c b/src/metaflac/options.c
index 2ff4ce4b..6aded4a4 100644
--- a/src/metaflac/options.c
+++ b/src/metaflac/options.c
@@ -178,8 +178,8 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
options->prefix_with_filename = (argc - share__optind > 1);
if(share__optind >= argc && !options->show_long_help && !options->show_version) {
- fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n");
- fprintf(stderr," metaflac cannot be used as a pipe\n");
+ flac_fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n");
+ flac_fprintf(stderr," metaflac cannot be used as a pipe\n");
had_error = true;
}
@@ -195,11 +195,11 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
if(options->args.checks.num_major_ops > 0) {
if(options->args.checks.num_major_ops > 1) {
- fprintf(stderr, "ERROR: you may only specify one major operation at a time\n");
+ flac_fprintf(stderr, "ERROR: you may only specify one major operation at a time\n");
had_error = true;
}
else if(options->args.checks.num_shorthand_ops > 0) {
- fprintf(stderr, "ERROR: you may not mix shorthand and major operations\n");
+ flac_fprintf(stderr, "ERROR: you may not mix shorthand and major operations\n");
had_error = true;
}
}
@@ -207,28 +207,28 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
/* check for only one FLAC file used with certain options */
if(options->num_files > 1) {
if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) {
- fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from'\n");
+ flac_fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from'\n");
had_error = true;
}
if(0 != find_shorthand_operation(options, OP__EXPORT_CUESHEET_TO)) {
- fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-cuesheet-to'\n");
+ flac_fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-cuesheet-to'\n");
had_error = true;
}
if(0 != find_shorthand_operation(options, OP__EXPORT_PICTURE_TO)) {
- fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-picture-to'\n");
+ flac_fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-picture-to'\n");
had_error = true;
}
if(
0 != find_shorthand_operation(options, OP__IMPORT_VC_FROM) &&
0 == strcmp(find_shorthand_operation(options, OP__IMPORT_VC_FROM)->argument.filename.value, "-")
) {
- fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-tags-from=-'\n");
+ flac_fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-tags-from=-'\n");
had_error = true;
}
}
if(options->args.checks.has_block_type && options->args.checks.has_except_block_type) {
- fprintf(stderr, "ERROR: you may not specify both '--block-type' and '--except-block-type'\n");
+ flac_fprintf(stderr, "ERROR: you may not specify both '--block-type' and '--except-block-type'\n");
had_error = true;
}
@@ -400,7 +400,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op = append_shorthand_operation(options, OP__SET_MD5SUM);
FLAC__ASSERT(0 != option_argument);
if(!parse_md5(option_argument, op->argument.streaminfo_md5.value)) {
- fprintf(stderr, "ERROR (--%s): bad MD5 sum\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): bad MD5 sum\n", opt);
ok = false;
}
else
@@ -409,7 +409,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
else if(0 == strcmp(opt, "set-min-blocksize")) {
op = append_shorthand_operation(options, OP__SET_MIN_BLOCKSIZE);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BLOCK_SIZE || op->argument.streaminfo_uint32.value > FLAC__MAX_BLOCK_SIZE) {
- fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
+ flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
ok = false;
}
else
@@ -418,7 +418,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
else if(0 == strcmp(opt, "set-max-blocksize")) {
op = append_shorthand_operation(options, OP__SET_MAX_BLOCKSIZE);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BLOCK_SIZE || op->argument.streaminfo_uint32.value > FLAC__MAX_BLOCK_SIZE) {
- fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
+ flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
ok = false;
}
else
@@ -427,7 +427,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
else if(0 == strcmp(opt, "set-min-framesize")) {
op = append_shorthand_operation(options, OP__SET_MIN_FRAMESIZE);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value >= (1u<argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value >= (1u<argument.streaminfo_uint32.value)) || !FLAC__format_sample_rate_is_valid(op->argument.streaminfo_uint32.value)) {
- fprintf(stderr, "ERROR (--%s): invalid sample rate\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): invalid sample rate\n", opt);
ok = false;
}
else
@@ -454,7 +454,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
else if(0 == strcmp(opt, "set-channels")) {
op = append_shorthand_operation(options, OP__SET_CHANNELS);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value > FLAC__MAX_CHANNELS) {
- fprintf(stderr, "ERROR (--%s): value must be > 0 and <= %u\n", opt, FLAC__MAX_CHANNELS);
+ flac_fprintf(stderr, "ERROR (--%s): value must be > 0 and <= %u\n", opt, FLAC__MAX_CHANNELS);
ok = false;
}
else
@@ -463,7 +463,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
else if(0 == strcmp(opt, "set-bps")) {
op = append_shorthand_operation(options, OP__SET_BPS);
if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BITS_PER_SAMPLE || op->argument.streaminfo_uint32.value > FLAC__MAX_BITS_PER_SAMPLE) {
- fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BITS_PER_SAMPLE, FLAC__MAX_BITS_PER_SAMPLE);
+ flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BITS_PER_SAMPLE, FLAC__MAX_BITS_PER_SAMPLE);
ok = false;
}
else
@@ -472,7 +472,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
else if(0 == strcmp(opt, "set-total-samples")) {
op = append_shorthand_operation(options, OP__SET_TOTAL_SAMPLES);
if(!parse_uint64(option_argument, &(op->argument.streaminfo_uint64.value)) || op->argument.streaminfo_uint64.value >= (((FLAC__uint64)1)<argument.vc_field_name.value), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
@@ -500,7 +500,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
FLAC__ASSERT(0 != option_argument);
if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
@@ -510,7 +510,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
FLAC__ASSERT(0 != option_argument);
if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
@@ -521,7 +521,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op->argument.vc_field.field_value_from_file = false;
if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
@@ -532,7 +532,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op->argument.vc_field.field_value_from_file = true;
if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
}
@@ -540,7 +540,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op = append_shorthand_operation(options, OP__IMPORT_VC_FROM);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.filename.value))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
@@ -548,19 +548,19 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op = append_shorthand_operation(options, OP__EXPORT_VC_TO);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.filename.value))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
else if(0 == strcmp(opt, "import-cuesheet-from")) {
if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) {
- fprintf(stderr, "ERROR (--%s): may be specified only once\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): may be specified only once\n", opt);
ok = false;
}
op = append_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.import_cuesheet_from.filename))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
@@ -568,7 +568,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op = append_shorthand_operation(options, OP__EXPORT_CUESHEET_TO);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.filename.value))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
}
@@ -576,7 +576,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op = append_shorthand_operation(options, OP__IMPORT_PICTURE_FROM);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.specification.value))) {
- fprintf(stderr, "ERROR (--%s): missing specification\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing specification\n", opt);
ok = false;
}
}
@@ -585,7 +585,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op = append_shorthand_operation(options, OP__EXPORT_PICTURE_TO);
FLAC__ASSERT(0 != option_argument);
if(!parse_string(option_argument, &(op->argument.export_picture_to.filename))) {
- fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
+ flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt);
ok = false;
}
op->argument.export_picture_to.block_number_link = arg? &(arg->value.block_number) : 0;
@@ -596,7 +596,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
FLAC__ASSERT(0 != option_argument);
if(!parse_add_seekpoint(option_argument, &spec, &violation)) {
FLAC__ASSERT(0 != violation);
- fprintf(stderr, "ERROR (--%s): malformed seekpoint specification \"%s\",\n %s\n", opt, option_argument, violation);
+ flac_fprintf(stderr, "ERROR (--%s): malformed seekpoint specification \"%s\",\n %s\n", opt, option_argument, violation);
ok = false;
}
else {
@@ -629,7 +629,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
op = append_shorthand_operation(options, OP__ADD_PADDING);
FLAC__ASSERT(0 != option_argument);
if(!parse_add_padding(option_argument, &(op->argument.add_padding.length))) {
- fprintf(stderr, "ERROR (--%s): illegal length \"%s\", length must be >= 0 and < 2^%u\n", opt, option_argument, FLAC__STREAM_METADATA_LENGTH_LEN);
+ flac_fprintf(stderr, "ERROR (--%s): illegal length \"%s\", length must be >= 0 and < 2^%u\n", opt, option_argument, FLAC__STREAM_METADATA_LENGTH_LEN);
ok = false;
}
}
@@ -661,7 +661,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
arg = append_argument(options, ARG__BLOCK_NUMBER);
FLAC__ASSERT(0 != option_argument);
if(!parse_block_number(option_argument, &(arg->value.block_number))) {
- fprintf(stderr, "ERROR: malformed block number specification \"%s\"\n", option_argument);
+ flac_fprintf(stderr, "ERROR: malformed block number specification \"%s\"\n", option_argument);
ok = false;
}
}
@@ -669,7 +669,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
arg = append_argument(options, ARG__BLOCK_TYPE);
FLAC__ASSERT(0 != option_argument);
if(!parse_block_type(option_argument, &(arg->value.block_type))) {
- fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument);
+ flac_fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument);
ok = false;
}
options->args.checks.has_block_type = true;
@@ -678,7 +678,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
arg = append_argument(options, ARG__EXCEPT_BLOCK_TYPE);
FLAC__ASSERT(0 != option_argument);
if(!parse_block_type(option_argument, &(arg->value.block_type))) {
- fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument);
+ flac_fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument);
ok = false;
}
options->args.checks.has_except_block_type = true;
@@ -687,14 +687,14 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
arg = append_argument(options, ARG__DATA_FORMAT);
FLAC__ASSERT(0 != option_argument);
if(!parse_data_format(option_argument, &(arg->value.data_format))) {
- fprintf(stderr, "ERROR (--%s): illegal data format \"%s\"\n", opt, option_argument);
+ flac_fprintf(stderr, "ERROR (--%s): illegal data format \"%s\"\n", opt, option_argument);
ok = false;
}
}
else if(0 == strcmp(opt, "application-data-format")) {
FLAC__ASSERT(0 != option_argument);
if(!parse_application_data_format(option_argument, &(options->application_data_format_is_hexdump))) {
- fprintf(stderr, "ERROR (--%s): illegal application data format \"%s\"\n", opt, option_argument);
+ flac_fprintf(stderr, "ERROR (--%s): illegal application data format \"%s\"\n", opt, option_argument);
ok = false;
}
}
@@ -1084,5 +1084,5 @@ FLAC__bool parse_application_data_format(const char *in, FLAC__bool *out)
void undocumented_warning(const char *opt)
{
- fprintf(stderr, "WARNING: undocmented option --%s should be used with caution,\n only for repairing a damaged STREAMINFO block\n", opt);
+ flac_fprintf(stderr, "WARNING: undocmented option --%s should be used with caution,\n only for repairing a damaged STREAMINFO block\n", opt);
}
diff --git a/src/metaflac/usage.c b/src/metaflac/usage.c
index b08c4979..0b05eee1 100644
--- a/src/metaflac/usage.c
+++ b/src/metaflac/usage.c
@@ -24,6 +24,7 @@
#include "FLAC/format.h"
#include
#include
+#include "share/compat.h"
static void usage_header(FILE *out)
{
@@ -83,9 +84,9 @@ int short_usage(const char *message, ...)
}
usage_header(stderr);
- fprintf(stderr, "\n");
- fprintf(stderr, "This is the short help; for full help use 'metaflac --help'\n");
- fprintf(stderr, "\n");
+ flac_fprintf(stderr, "\n");
+ flac_fprintf(stderr, "This is the short help; for full help use 'metaflac --help'\n");
+ flac_fprintf(stderr, "\n");
usage_summary(stderr);
return message? 1 : 0;
diff --git a/src/metaflac/utils.c b/src/metaflac/utils.c
index 13e7cec3..934cfcf3 100644
--- a/src/metaflac/utils.c
+++ b/src/metaflac/utils.c
@@ -30,11 +30,12 @@
#include "share/alloc.h"
#include "share/safe_str.h"
#include "share/utf8.h"
+#include "share/compat.h"
void die(const char *message)
{
FLAC__ASSERT(0 != message);
- fprintf(stderr, "ERROR: %s\n", message);
+ flac_fprintf(stderr, "ERROR: %s\n", message);
exit(1);
}
@@ -82,7 +83,7 @@ void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const
const FLAC__byte *b = buf;
for(i = 0; i < bytes; i += 16) {
- printf("%s%s%s%08X: "
+ flac_printf("%s%s%s%08X: "
"%02X %02X %02X %02X %02X %02X %02X %02X "
"%02X %02X %02X %02X %02X %02X %02X %02X "
"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
@@ -139,43 +140,43 @@ void print_error_with_chain_status(FLAC__Metadata_Chain *chain, const char *form
va_end(args);
- fprintf(stderr, ", status = \"%s\"\n", FLAC__Metadata_ChainStatusString[status]);
+ flac_fprintf(stderr, ", status = \"%s\"\n", FLAC__Metadata_ChainStatusString[status]);
if(status == FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE) {
- fprintf(stderr, "\n"
+ flac_fprintf(stderr, "\n"
"The FLAC file could not be opened. Most likely the file does not exist\n"
"or is not readable.\n"
);
}
else if(status == FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE) {
- fprintf(stderr, "\n"
+ flac_fprintf(stderr, "\n"
"The file does not appear to be a FLAC file.\n"
);
}
else if(status == FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE) {
- fprintf(stderr, "\n"
+ flac_fprintf(stderr, "\n"
"The FLAC file does not have write permissions.\n"
);
}
else if(status == FLAC__METADATA_CHAIN_STATUS_BAD_METADATA) {
- fprintf(stderr, "\n"
+ flac_fprintf(stderr, "\n"
"The metadata to be writted does not conform to the FLAC metadata\n"
"specifications.\n"
);
}
else if(status == FLAC__METADATA_CHAIN_STATUS_READ_ERROR) {
- fprintf(stderr, "\n"
+ flac_fprintf(stderr, "\n"
"There was an error while reading the FLAC file.\n"
);
}
else if(status == FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR) {
- fprintf(stderr, "\n"
+ flac_fprintf(stderr, "\n"
"There was an error while writing FLAC file; most probably the disk is\n"
"full.\n"
);
}
else if(status == FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR) {
- fprintf(stderr, "\n"
+ flac_fprintf(stderr, "\n"
"There was an error removing the temporary FLAC file.\n"
);
}
diff --git a/src/monkeys_audio_utilities/flac_mac/flac_mac.vcproj b/src/monkeys_audio_utilities/flac_mac/flac_mac.vcproj
index 6c076d41..315d4dbb 100644
--- a/src/monkeys_audio_utilities/flac_mac/flac_mac.vcproj
+++ b/src/monkeys_audio_utilities/flac_mac/flac_mac.vcproj
@@ -168,6 +168,85 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj b/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj
index 5fc7cbce..bd0f971f 100644
--- a/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj
+++ b/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj
@@ -168,6 +168,85 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/plugin_common/plugin_common_static.vcproj b/src/plugin_common/plugin_common_static.vcproj
index 502b2039..c8e1295c 100644
--- a/src/plugin_common/plugin_common_static.vcproj
+++ b/src/plugin_common/plugin_common_static.vcproj
@@ -147,6 +147,73 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/share/getopt/getopt_static.vcproj b/src/share/getopt/getopt_static.vcproj
index 6f0c7a77..0c9df720 100644
--- a/src/share/getopt/getopt_static.vcproj
+++ b/src/share/getopt/getopt_static.vcproj
@@ -147,6 +147,73 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/share/grabbag/file.c b/src/share/grabbag/file.c
index 04e3aad4..601dba50 100644
--- a/src/share/grabbag/file.c
+++ b/src/share/grabbag/file.c
@@ -50,28 +50,22 @@
void grabbag__file_copy_metadata(const char *srcpath, const char *destpath)
{
- struct stat srcstat;
+ struct _flac_stat srcstat;
struct utimbuf srctime;
- if(0 == stat(srcpath, &srcstat)) {
+ if(0 == flac_stat(srcpath, &srcstat)) {
srctime.actime = srcstat.st_atime;
srctime.modtime = srcstat.st_mtime;
- (void)chmod(destpath, srcstat.st_mode);
- (void)utime(destpath, &srctime);
+ (void)flac_chmod(destpath, srcstat.st_mode);
+ (void)flac_utime(destpath, &srctime);
}
}
FLAC__off_t grabbag__file_get_filesize(const char *srcpath)
{
-#if defined _MSC_VER || defined __MINGW32__
- struct _stat64 srcstat;
+ struct _flac_stat srcstat;
- if(0 == _stat64(srcpath, &srcstat))
-#else
- struct stat srcstat;
-
- if(0 == stat(srcpath, &srcstat))
-#endif
+ if(0 == flac_stat(srcpath, &srcstat))
return srcstat.st_size;
else
return -1;
@@ -92,9 +86,9 @@ const char *grabbag__file_get_basename(const char *srcpath)
FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only)
{
- struct stat stats;
+ struct _flac_stat stats;
- if(0 == stat(filename, &stats)) {
+ if(0 == flac_stat(filename, &stats)) {
#if !defined _MSC_VER && !defined __MINGW32__
if(read_only) {
stats.st_mode &= ~S_IWUSR;
@@ -110,7 +104,7 @@ FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only
else
stats.st_mode |= S_IWRITE;
#endif
- if(0 != chmod(filename, stats.st_mode))
+ if(0 != flac_chmod(filename, stats.st_mode))
return false;
}
else
@@ -151,14 +145,14 @@ FLAC__bool grabbag__file_are_same(const char *f1, const char *f2)
CloseHandle(h2);
return same;
#else
- struct stat s1, s2;
- return f1 && f2 && stat(f1, &s1) == 0 && stat(f2, &s2) == 0 && s1.st_ino == s2.st_ino && s1.st_dev == s2.st_dev;
+ struct _flac_stat s1, s2;
+ return f1 && f2 && flac_stat(f1, &s1) == 0 && flac_stat(f2, &s2) == 0 && s1.st_ino == s2.st_ino && s1.st_dev == s2.st_dev;
#endif
}
FLAC__bool grabbag__file_remove_file(const char *filename)
{
- return grabbag__file_change_stats(filename, /*read_only=*/false) && 0 == unlink(filename);
+ return grabbag__file_change_stats(filename, /*read_only=*/false) && 0 == flac_unlink(filename);
}
FILE *grabbag__file_get_binary_stdin(void)
diff --git a/src/share/grabbag/grabbag_static.vcproj b/src/share/grabbag/grabbag_static.vcproj
index 284bbb85..5a54709a 100644
--- a/src/share/grabbag/grabbag_static.vcproj
+++ b/src/share/grabbag/grabbag_static.vcproj
@@ -147,6 +147,73 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/share/grabbag/picture.c b/src/share/grabbag/picture.c
index 965a7b34..1afa1c7e 100644
--- a/src/share/grabbag/picture.c
+++ b/src/share/grabbag/picture.c
@@ -365,7 +365,7 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con
if(0 == buffer)
*error_message = error_messages[0];
else {
- FILE *f = fopen(spec, "rb");
+ FILE *f = flac_fopen(spec, "rb");
if(0 == f) {
*error_message = error_messages[5];
free(buffer);
diff --git a/src/share/grabbag/replaygain.c b/src/share/grabbag/replaygain.c
index 34cac63e..ba6b98c9 100644
--- a/src/share/grabbag/replaygain.c
+++ b/src/share/grabbag/replaygain.c
@@ -69,19 +69,19 @@ const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN = (const FLAC__byte
const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK = (const FLAC__byte * const)"REPLAYGAIN_ALBUM_PEAK";
-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)
{
FLAC__ASSERT(0 != filename);
FLAC__ASSERT(0 != stats);
- (void)chmod(filename, stats->st_mode);
+ (void)flac_chmod(filename, stats->st_mode);
}
static FLAC__bool append_tag_(FLAC__StreamMetadata *block, const char *format, const FLAC__byte *name, float value)
@@ -478,7 +478,7 @@ static const char *store_to_file_pre_(const char *filename, FLAC__Metadata_Chain
static const char *store_to_file_post_(const char *filename, FLAC__Metadata_Chain *chain, FLAC__bool preserve_modtime)
{
- struct stat stats;
+ struct _flac_stat stats;
const FLAC__bool have_stats = get_file_stats_(filename, &stats);
(void)grabbag__file_change_stats(filename, /*read_only=*/false);
diff --git a/src/share/replaygain_analysis/replaygain_analysis_static.vcproj b/src/share/replaygain_analysis/replaygain_analysis_static.vcproj
index 38846d9a..2b35a710 100644
--- a/src/share/replaygain_analysis/replaygain_analysis_static.vcproj
+++ b/src/share/replaygain_analysis/replaygain_analysis_static.vcproj
@@ -147,6 +147,73 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj b/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj
index 6c50b1e0..ceb0d879 100644
--- a/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj
+++ b/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj
@@ -147,6 +147,73 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/share/utf8/utf8_static.vcproj b/src/share/utf8/utf8_static.vcproj
index 9fe4f8aa..cf691eae 100644
--- a/src/share/utf8/utf8_static.vcproj
+++ b/src/share/utf8/utf8_static.vcproj
@@ -147,6 +147,73 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/share/utf8_io/utf8_io.c b/src/share/utf8_io/utf8_io.c
new file mode 100644
index 00000000..8bae43e0
--- /dev/null
+++ b/src/share/utf8_io/utf8_io.c
@@ -0,0 +1,258 @@
+#ifdef FLAC__STRINGS_IN_UTF8
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include /* for WideCharToMultiByte and MultiByteToWideChar */
+
+/* convert WCHAR stored Unicode string to UTF-8. Caller is responsible for freeing memory */
+char *utf8_from_wchar(const wchar_t *wstr)
+{
+ char *utf8str;
+ int len;
+
+ if (!wstr) return NULL;
+ if ((len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL)) == 0) return NULL;
+ if ((utf8str = (char *)malloc(++len)) == NULL) return NULL;
+ if (WideCharToMultiByte(CP_UTF8, 0, wstr, -1, utf8str, len, NULL, NULL) == 0) {
+ free(utf8str);
+ utf8str = NULL;
+ }
+
+ return utf8str;
+}
+
+/* convert UTF-8 back to WCHAR. Caller is responsible for freeing memory */
+wchar_t *wchar_from_utf8(const char *str)
+{
+ wchar_t *widestr;
+ int len;
+
+ if (!str) return NULL;
+ len=(int)strlen(str)+1;
+ if ((widestr = (wchar_t *)malloc(len*sizeof(wchar_t))) != NULL) {
+ if (MultiByteToWideChar(CP_UTF8, 0, str, len, widestr, len) == 0) {
+ if (MultiByteToWideChar(CP_ACP, 0, str, len, widestr, len) == 0) { /* try conversion from Ansi in case the initial UTF-8 conversion had failed */
+ free(widestr);
+ widestr = NULL;
+ }
+ }
+ }
+
+ return widestr;
+}
+
+/* retrieve WCHAR commandline, expand wildcards and convert everything to UTF-8 */
+int get_utf8_argv(int *argc, char ***argv)
+{
+ typedef int (__cdecl *__wgetmainargs_)(int*, wchar_t***, wchar_t***, int, int*);
+ __wgetmainargs_ __wgetmainargs;
+ HMODULE handle;
+ int wargc;
+ wchar_t **wargv;
+ wchar_t **wenv;
+ char **utf8argv;
+ int ret, i;
+
+ if ((handle = LoadLibrary("msvcrt.dll")) == NULL) return 1;
+ if ((__wgetmainargs = (__wgetmainargs_)GetProcAddress(handle, "__wgetmainargs")) == NULL) return 1;
+ i = 0;
+ if (__wgetmainargs(&wargc, &wargv, &wenv, 1, &i) != 0) return 1;
+ if ((utf8argv = (char **)malloc(wargc*sizeof(char*))) == NULL) return 1;
+ ret = 0;
+
+ for (i=0; iactime = ut.actime;
+ times->modtime = ut.modtime;
+ }
+ }
+
+ return ret;
+}
+
+int unlink_utf8(const char *filename)
+{
+ wchar_t *wname;
+ int ret;
+
+ if (!(wname = wchar_from_utf8(filename))) return -1;
+ ret = _wunlink(wname);
+ free(wname);
+
+ return ret;
+}
+
+int rename_utf8(const char *oldname, const char *newname)
+{
+ wchar_t *wold = NULL;
+ wchar_t *wnew = NULL;
+ int ret = -1;
+
+ while (1) {
+ if (!(wold = wchar_from_utf8(oldname))) break;
+ if (!(wnew = wchar_from_utf8(newname))) break;
+ ret = _wrename(wold, wnew);
+ break;
+ }
+ if (wold) free(wold);
+ if (wnew) free(wnew);
+
+ return ret;
+}
+
+#endif
diff --git a/src/share/utf8_io/utf8_io.vcproj b/src/share/utf8_io/utf8_io.vcproj
new file mode 100644
index 00000000..c63aeb74
--- /dev/null
+++ b/src/share/utf8_io/utf8_io.vcproj
@@ -0,0 +1,242 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test_grabbag/cuesheet/main.c b/src/test_grabbag/cuesheet/main.c
index d04fa4ba..002830b4 100644
--- a/src/test_grabbag/cuesheet/main.c
+++ b/src/test_grabbag/cuesheet/main.c
@@ -44,7 +44,7 @@ static int do_cuesheet(const char *infilename, unsigned sample_rate, FLAC__bool
if(0 == strcmp(infilename, "-")) {
fin = stdin;
}
- else if(0 == (fin = fopen(infilename, "r"))) {
+ else if(0 == (fin = flac_fopen(infilename, "r"))) {
fprintf(stderr, "can't open file %s for reading: %s\n", infilename, strerror(errno));
return 255;
}
@@ -64,7 +64,7 @@ static int do_cuesheet(const char *infilename, unsigned sample_rate, FLAC__bool
return 1;
}
flac_snprintf(tmpfilename, sizeof (tmpfilename), "%s.1", infilename);
- if(0 == (fout = fopen(tmpfilename, "w"))) {
+ if(0 == (fout = flac_fopen(tmpfilename, "w"))) {
fprintf(stderr, "can't open file %s for writing: %s\n", tmpfilename, strerror(errno));
FLAC__metadata_object_delete(cuesheet);
return 255;
@@ -76,7 +76,7 @@ static int do_cuesheet(const char *infilename, unsigned sample_rate, FLAC__bool
/*
* pass 2
*/
- if(0 == (fin = fopen(tmpfilename, "r"))) {
+ if(0 == (fin = flac_fopen(tmpfilename, "r"))) {
fprintf(stderr, "can't open file %s for reading: %s\n", tmpfilename, strerror(errno));
return 255;
}
@@ -96,7 +96,7 @@ static int do_cuesheet(const char *infilename, unsigned sample_rate, FLAC__bool
return 1;
}
flac_snprintf(tmpfilename, sizeof (tmpfilename), "%s.2", infilename);
- if(0 == (fout = fopen(tmpfilename, "w"))) {
+ if(0 == (fout = flac_fopen(tmpfilename, "w"))) {
fprintf(stderr, "can't open file %s for writing: %s\n", tmpfilename, strerror(errno));
FLAC__metadata_object_delete(cuesheet);
return 255;
diff --git a/src/test_grabbag/cuesheet/test_cuesheet.vcproj b/src/test_grabbag/cuesheet/test_cuesheet.vcproj
index 0d72363c..56458cb3 100644
--- a/src/test_grabbag/cuesheet/test_cuesheet.vcproj
+++ b/src/test_grabbag/cuesheet/test_cuesheet.vcproj
@@ -170,6 +170,86 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test_grabbag/picture/test_picture.vcproj b/src/test_grabbag/picture/test_picture.vcproj
index 6f73d078..84fdcc96 100644
--- a/src/test_grabbag/picture/test_picture.vcproj
+++ b/src/test_grabbag/picture/test_picture.vcproj
@@ -170,6 +170,86 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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(decoder)->file_ = ::fopen(flacfilename(is_ogg), "rb");
+ dynamic_cast(decoder)->file_ = ::flac_fopen(flacfilename(is_ogg), "rb");
if(0 == dynamic_cast(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"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test_libFLAC/decoders.c b/src/test_libFLAC/decoders.c
index 100318e4..6c132d94 100644
--- a/src/test_libFLAC/decoders.c
+++ b/src/test_libFLAC/decoders.c
@@ -88,7 +88,7 @@ static FLAC__bool die_s_(const char *msg, const FLAC__StreamDecoder *decoder)
static void open_test_file(StreamDecoderClientData * pdcd, int is_ogg, const char * mode)
{
- pdcd->file = fopen(flacfilename(is_ogg), mode);
+ pdcd->file = flac_fopen(flacfilename(is_ogg), mode);
safe_strncpy(pdcd->filename, flacfilename(is_ogg), sizeof (pdcd->filename));
}
diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c
index 8ed55f68..a577a91d 100644
--- a/src/test_libFLAC/encoders.c
+++ b/src/test_libFLAC/encoders.c
@@ -276,7 +276,7 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__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.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)) {
diff --git a/src/test_libFLAC/test_libFLAC.vcproj b/src/test_libFLAC/test_libFLAC.vcproj
index 6a4097d5..dee4f9bb 100644
--- a/src/test_libFLAC/test_libFLAC.vcproj
+++ b/src/test_libFLAC/test_libFLAC.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test_libs_common/file_utils_flac.c b/src/test_libs_common/file_utils_flac.c
index 0de9e9c9..af53f472 100644
--- a/src/test_libs_common/file_utils_flac.c
+++ b/src/test_libs_common/file_utils_flac.c
@@ -81,7 +81,7 @@ FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_f
FLAC__ASSERT(streaminfo->type == FLAC__METADATA_TYPE_STREAMINFO);
FLAC__ASSERT((streaminfo->is_last && num_metadata == 0) || (!streaminfo->is_last && num_metadata > 0));
- if(0 == (encoder_client_data.file = fopen(output_filename, "wb")))
+ if(0 == (encoder_client_data.file = flac_fopen(output_filename, "wb")))
return false;
encoder = FLAC__stream_encoder_new();
@@ -142,15 +142,9 @@ FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_f
FLAC__stream_encoder_delete(encoder);
if(0 != output_filesize) {
-#if defined _MSC_VER || defined __MINGW32__
- struct _stat64 filestats;
+ struct _flac_stat filestats;
- if(_stat64(output_filename, &filestats) != 0)
-#else
- struct stat filestats;
-
- if(stat(output_filename, &filestats) != 0)
-#endif
+ if(flac_stat(output_filename, &filestats) != 0)
return false;
else
*output_filesize = filestats.st_size;
diff --git a/src/test_libs_common/test_libs_common_static.vcproj b/src/test_libs_common/test_libs_common_static.vcproj
index bac24b44..e5ebc798 100644
--- a/src/test_libs_common/test_libs_common_static.vcproj
+++ b/src/test_libs_common/test_libs_common_static.vcproj
@@ -147,6 +147,73 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test_seeking/main.c b/src/test_seeking/main.c
index 318bce84..68935aa7 100644
--- a/src/test_seeking/main.c
+++ b/src/test_seeking/main.c
@@ -93,15 +93,9 @@ static unsigned local_rand_(void)
static FLAC__off_t get_filesize_(const char *srcpath)
{
-#if defined _MSC_VER || defined __MINGW32__
- struct _stat64 srcstat;
+ struct _flac_stat srcstat;
- if(0 == _stat64(srcpath, &srcstat))
-#else
- struct stat srcstat;
-
- if(0 == stat(srcpath, &srcstat))
-#endif
+ if(0 == flac_stat(srcpath, &srcstat))
return srcstat.st_size;
else
return -1;
@@ -164,7 +158,7 @@ static FLAC__bool read_pcm_(FLAC__int32 *pcm[], const char *rawfilename, const c
return false;
}
}
- if(0 == (f = fopen(rawfilename, "rb"))) {
+ if(0 == (f = flac_fopen(rawfilename, "rb"))) {
printf("ERROR: opening %s for reading\n", rawfilename);
return false;
}
diff --git a/src/test_seeking/test_seeking.vcproj b/src/test_seeking/test_seeking.vcproj
index f5939c62..1304a771 100644
--- a/src/test_seeking/test_seeking.vcproj
+++ b/src/test_seeking/test_seeking.vcproj
@@ -172,6 +172,87 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test_streams/main.c b/src/test_streams/main.c
index 723269bd..bb1d5fc3 100644
--- a/src/test_streams/main.c
+++ b/src/test_streams/main.c
@@ -221,7 +221,7 @@ static FLAC__bool generate_01(void)
FILE *f;
FLAC__int16 x = -32768;
- if(0 == (f = fopen("test01.raw", "wb")))
+ if(0 == (f = flac_fopen("test01.raw", "wb")))
return false;
if(!write_little_endian_int16(f, x))
@@ -240,7 +240,7 @@ static FLAC__bool generate_02(void)
FILE *f;
FLAC__int16 xl = -32768, xr = 32767;
- if(0 == (f = fopen("test02.raw", "wb")))
+ if(0 == (f = flac_fopen("test02.raw", "wb")))
return false;
if(!write_little_endian_int16(f, xl))
@@ -262,7 +262,7 @@ static FLAC__bool generate_03(void)
FLAC__int16 x[] = { -25, 0, 25, 50, 100 };
unsigned i;
- if(0 == (f = fopen("test03.raw", "wb")))
+ if(0 == (f = flac_fopen("test03.raw", "wb")))
return false;
for(i = 0; i < 5; i++)
@@ -283,7 +283,7 @@ static FLAC__bool generate_04(void)
FLAC__int16 x[] = { -25, 500, 0, 400, 25, 300, 50, 200, 100, 100 };
unsigned i;
- if(0 == (f = fopen("test04.raw", "wb")))
+ if(0 == (f = flac_fopen("test04.raw", "wb")))
return false;
for(i = 0; i < 10; i++)
@@ -305,7 +305,7 @@ static FLAC__bool generate_fsd8(const char *fn, const int pattern[], unsigned re
FLAC__ASSERT(pattern != 0);
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(rep = 0; rep < reps; rep++) {
@@ -331,7 +331,7 @@ static FLAC__bool generate_fsd16(const char *fn, const int pattern[], unsigned r
FLAC__ASSERT(pattern != 0);
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(rep = 0; rep < reps; rep++) {
@@ -355,7 +355,7 @@ static FLAC__bool generate_wbps16(const char *fn, unsigned samples)
FILE *f;
unsigned sample;
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(sample = 0; sample < samples; sample++) {
@@ -382,7 +382,7 @@ static FLAC__bool generate_fsd24(const char *fn, const int pattern[], unsigned r
FLAC__ASSERT(pattern != 0);
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(rep = 0; rep < reps; rep++) {
@@ -410,7 +410,7 @@ static FLAC__bool generate_sine8_1(const char *fn, const double sample_rate, con
double theta1, theta2;
unsigned i;
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
@@ -437,7 +437,7 @@ static FLAC__bool generate_sine8_2(const char *fn, const double sample_rate, con
double theta1, theta2;
unsigned i;
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
@@ -468,7 +468,7 @@ static FLAC__bool generate_sine16_1(const char *fn, const double sample_rate, co
double theta1, theta2;
unsigned i;
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
@@ -495,7 +495,7 @@ static FLAC__bool generate_sine16_2(const char *fn, const double sample_rate, co
double theta1, theta2;
unsigned i;
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
@@ -526,7 +526,7 @@ static FLAC__bool generate_sine24_1(const char *fn, const double sample_rate, co
double theta1, theta2;
unsigned i;
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
@@ -553,7 +553,7 @@ static FLAC__bool generate_sine24_2(const char *fn, const double sample_rate, co
double theta1, theta2;
unsigned i;
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
@@ -579,7 +579,7 @@ static FLAC__bool generate_noise(const char *fn, unsigned bytes)
FILE *f;
unsigned b;
- if(0 == (f = fopen(fn, "wb")))
+ if(0 == (f = flac_fopen(fn, "wb")))
return false;
for(b = 0; b < bytes; b++) {
@@ -609,7 +609,7 @@ static FLAC__bool generate_raw(const char *filename, unsigned channels, unsigned
FILE *f;
unsigned i, j;
- if(0 == (f = fopen(filename, "wb")))
+ if(0 == (f = flac_fopen(filename, "wb")))
return false;
for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) {
@@ -642,7 +642,7 @@ static FLAC__bool generate_aiff(const char *filename, unsigned sample_rate, unsi
FILE *f;
unsigned i, j;
- if(0 == (f = fopen(filename, "wb")))
+ if(0 == (f = flac_fopen(filename, "wb")))
return false;
if(fwrite("FORM", 1, 4, f) < 4)
goto foo;
@@ -706,7 +706,7 @@ static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsig
FILE *f;
unsigned i, j;
- if(0 == (f = fopen(filename, "wb")))
+ if(0 == (f = flac_fopen(filename, "wb")))
return false;
/* RIFFxxxxWAVE or equivalent: */
switch(flavor) {
@@ -852,14 +852,14 @@ static FLAC__bool generate_wackywavs(void)
4, 0, 0, 0, 'b', 'l', 'a', 'h'
};
- if(0 == (f = fopen("wacky1.wav", "wb")))
+ if(0 == (f = flac_fopen("wacky1.wav", "wb")))
return false;
if(fwrite(wav, 1, 84, f) < 84)
goto foo;
fclose(f);
wav[4] += 12;
- if(0 == (f = fopen("wacky2.wav", "wb")))
+ if(0 == (f = flac_fopen("wacky2.wav", "wb")))
return false;
if(fwrite(wav, 1, 96, f) < 96)
goto foo;
@@ -886,7 +886,7 @@ static FLAC__bool generate_noisy_sine(void)
double sample, last_val = 0.0;
int k;
- if(0 == (f = fopen("noisy-sine.wav", "wb")))
+ if(0 == (f = flac_fopen("noisy-sine.wav", "wb")))
return false;
if(fwrite(wav, 1, sizeof (wav), f) < sizeof (wav))
goto foo;
@@ -948,14 +948,14 @@ static FLAC__bool generate_wackywav64s(void)
'b', 'l', 'a', 'h', 'b', 'l', 'a', 'h'
};
- if(0 == (f = fopen("wacky1.w64", "wb")))
+ if(0 == (f = flac_fopen("wacky1.w64", "wb")))
return false;
if(fwrite(wav, 1, wav[16], f) < wav[16])
goto foo;
fclose(f);
wav[16] += 32;
- if(0 == (f = fopen("wacky2.w64", "wb")))
+ if(0 == (f = flac_fopen("wacky2.w64", "wb")))
return false;
if(fwrite(wav, 1, wav[16], f) < wav[16])
goto foo;
@@ -990,14 +990,14 @@ static FLAC__bool generate_wackyrf64s(void)
4, 0, 0, 0, 'b', 'l', 'a', 'h'
};
- if(0 == (f = fopen("wacky1.rf64", "wb")))
+ if(0 == (f = flac_fopen("wacky1.rf64", "wb")))
return false;
if(fwrite(wav, 1, 120, f) < 120)
goto foo;
fclose(f);
wav[20] += 12;
- if(0 == (f = fopen("wacky2.rf64", "wb")))
+ if(0 == (f = flac_fopen("wacky2.rf64", "wb")))
return false;
if(fwrite(wav, 1, 132, f) < 132)
goto foo;
diff --git a/src/test_streams/test_streams.vcproj b/src/test_streams/test_streams.vcproj
index 9b27738c..5eff1d4b 100644
--- a/src/test_streams/test_streams.vcproj
+++ b/src/test_streams/test_streams.vcproj
@@ -170,6 +170,86 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/utils/flacdiff/flacdiff.vcproj b/src/utils/flacdiff/flacdiff.vcproj
index b5c7d39b..a945e263 100644
--- a/src/utils/flacdiff/flacdiff.vcproj
+++ b/src/utils/flacdiff/flacdiff.vcproj
@@ -170,6 +170,86 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/utils/flacdiff/main.cpp b/src/utils/flacdiff/main.cpp
index d4c8f066..7ce89105 100644
--- a/src/utils/flacdiff/main.cpp
+++ b/src/utils/flacdiff/main.cpp
@@ -189,11 +189,11 @@ static bool run(const char *fn1, const char *fn2)
AutoFILE f1(fn1, "rb"), f2(fn2, "rb");
if(!f1) {
- fprintf(stderr, "ERROR: opening %s for reading\n", fn1);
+ flac_fprintf(stderr, "ERROR: opening %s for reading\n", fn1);
return false;
}
if(!f2) {
- fprintf(stderr, "ERROR: opening %s for reading\n", fn2);
+ flac_fprintf(stderr, "ERROR: opening %s for reading\n", fn2);
return false;
}
@@ -209,6 +209,13 @@ int main(int argc, char *argv[])
{
const char *usage = "usage: flacdiff flacfile1 flacfile2\n";
+#ifdef FLAC__STRINGS_IN_UTF8
+ if (get_utf8_argv(&argc, &argv) != 0) {
+ fprintf(stderr, "%ERROR: failed to convert command line parameters to UTF-8\n");
+ return 1;
+ }
+#endif
+
if(argc > 1 && 0 == strcmp(argv[1], "-h")) {
printf(usage);
return 0;
diff --git a/src/utils/flactimer/flactimer.vcproj b/src/utils/flactimer/flactimer.vcproj
index 7e3b8b8f..8a6b9f6d 100644
--- a/src/utils/flactimer/flactimer.vcproj
+++ b/src/utils/flactimer/flactimer.vcproj
@@ -168,6 +168,85 @@
Name="VCPostBuildEventTool"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+