For some reason, opencascade developers thought that MINGW doesn't support the windows-specific unicode extensions to fopen and friends and thus use the non-unicode ones, making dealing with non-ASCII filenames impossible. This patch enables unicode fopen on MINGW.
59 lines
2.8 KiB
Diff
59 lines
2.8 KiB
Diff
diff --git a/src/oce-OCE-0.18.3/src/OSD/OSD_OpenFile.cxx b/src-old/oce-OCE-0.18.3/src/OSD/OSD_OpenFile.cxx
|
|
index 32e5ccd..95fde0e 100644
|
|
--- a/src/oce-OCE-0.18.3/src/OSD/OSD_OpenFile.cxx
|
|
+++ b/src-old/oce-OCE-0.18.3/src/OSD/OSD_OpenFile.cxx
|
|
@@ -23,7 +23,7 @@ FILE* OSD_OpenFile(const char* theName,
|
|
const char* theMode)
|
|
{
|
|
FILE* aFile = 0;
|
|
-#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
|
|
+#if defined(_WIN32)
|
|
// file name is treated as UTF-8 string and converted to UTF-16 one
|
|
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
|
|
const TCollection_ExtendedString aFileModeW (theMode, Standard_True);
|
|
@@ -43,7 +43,7 @@ FILE* OSD_OpenFile(const TCollection_ExtendedString& theName,
|
|
const char* theMode)
|
|
{
|
|
FILE* aFile = 0;
|
|
-#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
|
|
+#if defined(_WIN32)
|
|
const TCollection_ExtendedString aFileModeW (theMode, Standard_True);
|
|
aFile = ::_wfopen ((const wchar_t* )theName.ToExtString(),
|
|
(const wchar_t* )aFileModeW.ToExtString());
|
|
@@ -63,7 +63,7 @@ void OSD_OpenFileBuf(std::filebuf& theBuff,
|
|
const char* theName,
|
|
const std::ios_base::openmode theMode)
|
|
{
|
|
-#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
|
|
+#if defined(_WIN32)
|
|
// file name is treated as UTF-8 string and converted to UTF-16 one
|
|
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
|
|
theBuff.open ((const wchar_t* )aFileNameW.ToExtString(), theMode);
|
|
@@ -80,7 +80,7 @@ void OSD_OpenFileBuf(std::filebuf& theBuff,
|
|
const TCollection_ExtendedString& theName,
|
|
const std::ios_base::openmode theMode)
|
|
{
|
|
-#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
|
|
+#if defined(_WIN32)
|
|
theBuff.open ((const wchar_t* )theName.ToExtString(), theMode);
|
|
#else
|
|
// conversion in UTF-8 for linux
|
|
@@ -97,7 +97,7 @@ void OSD_OpenStream(std::ofstream& theStream,
|
|
const char* theName,
|
|
const std::ios_base::openmode theMode)
|
|
{
|
|
-#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
|
|
+#if defined(_WIN32)
|
|
// file name is treated as UTF-8 string and converted to UTF-16 one
|
|
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
|
|
theStream.open ((const wchar_t* )aFileNameW.ToExtString(), theMode);
|
|
@@ -114,7 +114,7 @@ void OSD_OpenStream(std::ofstream& theStream,
|
|
const TCollection_ExtendedString& theName,
|
|
const std::ios_base::openmode theMode)
|
|
{
|
|
-#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
|
|
+#if defined(_WIN32)
|
|
theStream.open ((const wchar_t* )theName.ToExtString(), theMode);
|
|
#else
|
|
// conversion in UTF-8 for linux
|