Compare commits

..

4 Commits

Author SHA1 Message Date
elasota
c147e1100e Change MiniRez to use WindowsUnicodeToolShim 2021-03-11 22:28:01 -05:00
elasota
0a2e730d26 Change FTagData to use WindowsUnicodeToolShim 2021-03-11 22:22:30 -05:00
elasota
922cd0fd06 Add debug/release props to WindowsUnicodeToolShim 2021-03-11 22:22:14 -05:00
elasota
b8bf6be44f Change hqx2gp to use WindowsUnicodeToolShim 2021-03-11 22:18:07 -05:00
7 changed files with 35 additions and 34 deletions

View File

@@ -5,7 +5,9 @@
#include "CFileStream.h"
#include "CombinedTimestamp.h"
int main(int argc, const char **argv)
#include "WindowsUnicodeToolShim.h"
int toolMain(int argc, const char **argv)
{
if (argc < 7)
{
@@ -28,12 +30,11 @@ int main(int argc, const char **argv)
return -3;
}
FILE *tsF = nullptr;
errno_t ferr = fopen_s(&tsF, timestampPath.c_str(), "rb");
FILE *tsF = fopen_utf8(timestampPath.c_str(), "rb");
int64_t timestamp = 0;
PortabilityLayer::CombinedTimestamp ts;
if (!ferr)
if (tsF)
{
if (fread(&ts, 1, sizeof(ts), tsF) != sizeof(ts))
{
@@ -77,9 +78,8 @@ int main(int argc, const char **argv)
PortabilityLayer::MacFilePropertiesSerialized mps;
mps.Serialize(mfp);
FILE *file = nullptr;
errno_t err = fopen_s(&file, outPath.c_str(), "wb");
if (!err)
FILE *file = fopen_utf8(outPath.c_str(), "wb");
if (file)
{
PortabilityLayer::CFileStream stream(file);

View File

@@ -41,6 +41,7 @@
<Import Project="..\GpCommon.props" />
<Import Project="..\Common.props" />
<Import Project="..\Debug.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
@@ -48,6 +49,7 @@
<Import Project="..\GpCommon.props" />
<Import Project="..\Common.props" />
<Import Project="..\Release.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
@@ -77,6 +79,9 @@
<ProjectReference Include="..\PortabilityLayer\PortabilityLayer.vcxproj">
<Project>{6ec62b0f-9353-40a4-a510-3788f1368b33}</Project>
</ProjectReference>
<ProjectReference Include="..\WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj">
<Project>{15009625-1120-405e-8bba-69a16cd6713d}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="FTagData.cpp" />

View File

@@ -9,6 +9,7 @@
#include "MacBinary2.h"
#include "MacFileMem.h"
#include "WindowsUnicodeToolShim.h"
// Very simplified resource compiler
@@ -117,7 +118,7 @@ void DefError()
exit(-1);
}
int main(int argc, const char **argv)
int toolMain(int argc, const char **argv)
{
if (argc != 3)
{
@@ -125,8 +126,8 @@ int main(int argc, const char **argv)
return -1;
}
FILE *f = nullptr;
if (fopen_s(&f, argv[1], "rb"))
FILE *f = fopen_utf8(argv[1], "rb");
if (!f)
{
fprintf(stderr, "Failed to open input file");
return -1;
@@ -524,8 +525,8 @@ int main(int argc, const char **argv)
printf("Writing to %s...", argv[2]);
FILE *outF = nullptr;
if (fopen_s(&outF, argv[2], "wb"))
FILE *outF = fopen_utf8(argv[2], "wb");
if (!outF)
{
fprintf(stderr, "Failed to open output file");
return -1;

View File

@@ -41,6 +41,7 @@
<Import Project="..\Common.props" />
<Import Project="..\GpCommon.props" />
<Import Project="..\Debug.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
@@ -48,6 +49,7 @@
<Import Project="..\Common.props" />
<Import Project="..\GpCommon.props" />
<Import Project="..\Release.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
@@ -80,6 +82,9 @@
<ProjectReference Include="..\PortabilityLayer\PortabilityLayer.vcxproj">
<Project>{6ec62b0f-9353-40a4-a510-3788f1368b33}</Project>
</ProjectReference>
<ProjectReference Include="..\WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj">
<Project>{15009625-1120-405e-8bba-69a16cd6713d}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@@ -40,12 +40,14 @@
<Import Project="..\WindowsUnicodeToolShim.props" />
<Import Project="..\PortabilityLayer.props" />
<Import Project="..\Common.props" />
<Import Project="..\Debug.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\WindowsUnicodeToolShim.props" />
<Import Project="..\PortabilityLayer.props" />
<Import Project="..\Common.props" />
<Import Project="..\Release.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />

View File

@@ -30,12 +30,13 @@ SOFTWARE.
#include "MacBinary2.h"
#include "MacFileMem.h"
#include "ZipFile.h"
#include "WindowsUnicodeToolShim.h"
#include <string>
using namespace PortabilityLayer;
int main(int argc, const char **argv)
int toolMain(int argc, const char **argv)
{
if (argc != 4)
{
@@ -43,13 +44,7 @@ int main(int argc, const char **argv)
return -1;
}
#ifdef _CRT_INSECURE_DEPRECATE
FILE *f = nullptr;
if (fopen_s(&f, argv[1], "rb"))
f = nullptr;
#else
FILE *f = fopen(argv[1], "rb");
#endif
FILE *f = fopen_utf8(argv[1], "rb");
if (!f)
{
@@ -57,13 +52,7 @@ int main(int argc, const char **argv)
return -1;
}
#ifdef _CRT_INSECURE_DEPRECATE
FILE *tsF = nullptr;
if (fopen_s(&tsF, argv[2], "rb"))
tsF = nullptr;
#else
FILE *tsF = fopen(argv[2], "rb");
#endif
FILE *tsF = fopen_utf8(argv[2], "rb");
if (!tsF)
{
@@ -130,13 +119,7 @@ int main(int argc, const char **argv)
std::string path = fname + extensions[i];
#ifdef _CRT_INSECURE_DEPRECATE
FILE *outF = nullptr;
if (fopen_s(&outF, path.c_str(), "wb"))
outF = nullptr;
#else
FILE *outF = fopen(path.c_str(), "wb");
#endif
FILE *outF = fopen_utf8(path.c_str(), "wb");
if (!outF)
continue;

View File

@@ -41,6 +41,7 @@
<Import Project="..\Common.props" />
<Import Project="..\GpCommon.props" />
<Import Project="..\Debug.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
@@ -48,6 +49,7 @@
<Import Project="..\Common.props" />
<Import Project="..\GpCommon.props" />
<Import Project="..\Release.props" />
<Import Project="..\WindowsUnicodeToolShim.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
@@ -80,6 +82,9 @@
<ProjectReference Include="..\PortabilityLayer\PortabilityLayer.vcxproj">
<Project>{6ec62b0f-9353-40a4-a510-3788f1368b33}</Project>
</ProjectReference>
<ProjectReference Include="..\WindowsUnicodeToolShim\WindowsUnicodeToolShim.vcxproj">
<Project>{15009625-1120-405e-8bba-69a16cd6713d}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">