summaryrefslogtreecommitdiff
path: root/src/KM_fileio.cpp
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2019-02-12 09:13:35 -0800
committerjhurst <jhurst@cinecert.com>2019-02-12 09:13:35 -0800
commit260692554632887d4e978775001081add386b909 (patch)
treed306055c36bcb6839c5e0ea6bd62ef83440c2abd /src/KM_fileio.cpp
parent94933bbbea5bdb424f1b2d1aa21e5e69805358cd (diff)
o Fixed ISXD bugs:
o Incorrect UTF_8_Text_DataEssenceCoding UL o Incorrect ISXDDataEssenceDescriptor_NamespaceURI UL o Incorrect use of FrameWrappedISXDData UL o Incorrect use of FrameWrappedISXDContainer UL o Added KM_WIN32_UTF8 macro to protect old users from new ideas
Diffstat (limited to 'src/KM_fileio.cpp')
-rw-r--r--src/KM_fileio.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/KM_fileio.cpp b/src/KM_fileio.cpp
index 0dfa473..07c649f 100644
--- a/src/KM_fileio.cpp
+++ b/src/KM_fileio.cpp
@@ -762,6 +762,7 @@ Kumu::FileWriter::Writev(const byte_t* buf, ui32_t buf_len)
#ifdef KM_WIN32
+#ifdef KM_WIN32_UTF8
//
Kumu::Result_t
@@ -808,6 +809,7 @@ Kumu::utf8_to_wbstr(const std::string& in, Kumu::ByteString& out)
return RESULT_OK;
}
+#endif // KM_WIN32_UTF8
//------------------------------------------------------------------------------------------
//
@@ -816,6 +818,7 @@ Kumu::Result_t
Kumu::FileReader::OpenRead(const std::string& filename) const
{
const_cast<FileReader*>(this)->m_Filename = filename;
+#ifdef KM_WIN32_UTF8
ByteString wb_filename;
Result_t result = utf8_to_wbstr(m_Filename, wb_filename);
@@ -823,12 +826,17 @@ Kumu::FileReader::OpenRead(const std::string& filename) const
{
return result;
}
+#endif
// suppress popup window on error
UINT prev = ::SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
+#ifdef KM_WIN32_UTF8
const_cast<FileReader*>(this)->m_Handle =
::CreateFileW((wchar_t*)wb_filename.RoData(),
+#else
+ const_cast<FileReader*>(this)->m_Handle = ::CreateFileA(filename.c_str(),
+#endif
(GENERIC_READ), // open for reading
FILE_SHARE_READ, // share for reading
NULL, // no security
@@ -949,6 +957,7 @@ Kumu::Result_t
Kumu::FileWriter::OpenWrite(const std::string& filename)
{
m_Filename = filename;
+#ifdef KM_WIN32_UTF8
ByteString wb_filename;
Result_t result = utf8_to_wbstr(m_Filename, wb_filename);
@@ -956,11 +965,16 @@ Kumu::FileWriter::OpenWrite(const std::string& filename)
{
return result;
}
+#endif
// suppress popup window on error
UINT prev = ::SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
+#ifdef KM_WIN32_UTF8
m_Handle = ::CreateFileW((wchar_t*)wb_filename.RoData(),
+#else
+ m_Handle = ::CreateFileA(filename.c_str(),
+#endif
(GENERIC_WRITE|GENERIC_READ), // open for reading
FILE_SHARE_READ, // share for reading
NULL, // no security