summaryrefslogtreecommitdiff
path: root/source/XMPFiles/FormatSupport/Reconcile_Impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/XMPFiles/FormatSupport/Reconcile_Impl.cpp')
-rw-r--r--source/XMPFiles/FormatSupport/Reconcile_Impl.cpp50
1 files changed, 37 insertions, 13 deletions
diff --git a/source/XMPFiles/FormatSupport/Reconcile_Impl.cpp b/source/XMPFiles/FormatSupport/Reconcile_Impl.cpp
index 99339d2..1f06083 100644
--- a/source/XMPFiles/FormatSupport/Reconcile_Impl.cpp
+++ b/source/XMPFiles/FormatSupport/Reconcile_Impl.cpp
@@ -107,10 +107,10 @@ bool ReconcileUtils::IsUTF8 ( const void * utf8Ptr, size_t utf8Len )
LPCWSTR utf16Ptr = (LPCWSTR) utf16.c_str();
size_t utf16Len = utf16.size() / 2;
- int hostLen = WideCharToMultiByte ( codePage, 0, utf16Ptr, utf16Len, 0, 0, 0, 0 );
+ int hostLen = WideCharToMultiByte ( codePage, 0, utf16Ptr, (int)utf16Len, 0, 0, 0, 0 );
host->assign ( hostLen, ' ' ); // Allocate space for the results.
- (void) WideCharToMultiByte ( codePage, 0, utf16Ptr, utf16Len, (LPSTR)host->data(), hostLen, 0, 0 );
+ (void) WideCharToMultiByte ( codePage, 0, utf16Ptr, (int)utf16Len, (LPSTR)host->data(), hostLen, 0, 0 );
XMP_Assert ( hostLen == host->size() );
} // UTF8ToWinEncoding
@@ -167,9 +167,8 @@ bool ReconcileUtils::IsUTF8 ( const void * utf8Ptr, size_t utf8Len )
#elif XMP_UNIXBuild
- #error "UTF8ToHostEncoding is not implemented for UNIX"
- // *** A nice definition of Windows 1252 is at http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx
- // *** We should code our own conversions for this, and use it for UNIX - unless better POSIX routines exist.
+ // ! Does not exist, must not be called, for Generic UNIX builds. It is not clear at this time
+ // ! what notion of local encoding should be used for generic UNIX, especially in a server product.
#endif
@@ -177,6 +176,10 @@ bool ReconcileUtils::IsUTF8 ( const void * utf8Ptr, size_t utf8Len )
// ReconcileUtils::UTF8ToLocal
// ===========================
+#if ! XMP_UNIXBuild
+// ! Does not exist, must not be called, for Generic UNIX builds. It is not clear at this time
+// ! what notion of local encoding should be used for generic UNIX, especially in a server product.
+
void ReconcileUtils::UTF8ToLocal ( const void * _utf8Ptr, size_t utf8Len, std::string * local )
{
const XMP_Uns8* utf8Ptr = (XMP_Uns8*)_utf8Ptr;
@@ -205,18 +208,24 @@ void ReconcileUtils::UTF8ToLocal ( const void * _utf8Ptr, size_t utf8Len, std::s
#elif XMP_UNIXBuild
- #error "UTF8ToLocal is not implemented for UNIX"
+ #error "No generic UNIX implementation"
#endif
} // ReconcileUtils::UTF8ToLocal
+#endif
+
// =================================================================================================
// ReconcileUtils::UTF8ToLatin1
// ============================
//
// Actually to the Windows code page 1252 superset of 8859-1.
+#if ! XMP_UNIXBuild
+// ! Does not exist, must not be called, for Generic UNIX builds. At some point we could consider
+// ! creating our own private implementation. So far only needed for the ID3 legacy in MP3 files.
+
void ReconcileUtils::UTF8ToLatin1 ( const void * _utf8Ptr, size_t utf8Len, std::string * latin1 )
{
const XMP_Uns8* utf8Ptr = (XMP_Uns8*)_utf8Ptr;
@@ -242,12 +251,14 @@ void ReconcileUtils::UTF8ToLatin1 ( const void * _utf8Ptr, size_t utf8Len, std::
#elif XMP_UNIXBuild
- #error "UTF8ToLatin1 is not implemented for UNIX"
+ #error "No generic UNIX implementation"
#endif
} // ReconcileUtils::UTF8ToLatin1
+#endif
+
// =================================================================================================
// HostEncodingToUTF8
// ==================
@@ -258,11 +269,11 @@ void ReconcileUtils::UTF8ToLatin1 ( const void * _utf8Ptr, size_t utf8Len, std::
const XMP_Uns8 * hostPtr, size_t hostLen, std::string * utf8 )
{
- size_t utf16Len = MultiByteToWideChar ( codePage, 0, (LPCSTR)hostPtr, hostLen, 0, 0 );
+ int utf16Len = MultiByteToWideChar ( codePage, 0, (LPCSTR)hostPtr, (int)hostLen, 0, 0 );
std::vector<UTF16Unit> utf16 ( utf16Len, 0 ); // MultiByteToWideChar returns native UTF-16.
- (void) MultiByteToWideChar ( codePage, 0, (LPCSTR)hostPtr, hostLen, (LPWSTR)&utf16[0], utf16Len );
- FromUTF16Native ( &utf16[0], utf16Len, utf8 );
+ (void) MultiByteToWideChar ( codePage, 0, (LPCSTR)hostPtr, (int)hostLen, (LPWSTR)&utf16[0], utf16Len );
+ FromUTF16Native ( &utf16[0], (int)utf16Len, utf8 );
} // WinEncodingToUTF8
@@ -316,7 +327,8 @@ void ReconcileUtils::UTF8ToLatin1 ( const void * _utf8Ptr, size_t utf8Len, std::
#elif XMP_UNIXBuild
- #error "HostEncodingToUTF8 is not implemented for UNIX"
+ // ! Does not exist, must not be called, for Generic UNIX builds. It is not clear at this time
+ // ! what notion of local encoding should be used for generic UNIX, especially in a server product.
#endif
@@ -324,6 +336,10 @@ void ReconcileUtils::UTF8ToLatin1 ( const void * _utf8Ptr, size_t utf8Len, std::
// ReconcileUtils::LocalToUTF8
// ===========================
+#if ! XMP_UNIXBuild
+// ! Does not exist, must not be called, for Generic UNIX builds. It is not clear at this time
+// ! what notion of local encoding should be used for generic UNIX, especially in a server product.
+
void ReconcileUtils::LocalToUTF8 ( const void * _localPtr, size_t localLen, std::string * utf8 )
{
const XMP_Uns8* localPtr = (XMP_Uns8*)_localPtr;
@@ -351,18 +367,24 @@ void ReconcileUtils::LocalToUTF8 ( const void * _localPtr, size_t localLen, std:
#elif XMP_UNIXBuild
- #error "LocalToUTF8 is not implemented for UNIX"
+ #error "No generic UNIX implementation"
#endif
} // ReconcileUtils::LocalToUTF8
+#endif
+
// =================================================================================================
// ReconcileUtils::Latin1ToUTF8
// ============================
//
// Actually from the Windows code page 1252 superset of 8859-1.
+#if ! XMP_UNIXBuild
+// ! Does not exist, must not be called, for Generic UNIX builds. At some point we could consider
+// ! creating our own private implementation. So far only needed for the ID3 legacy in MP3 files.
+
void ReconcileUtils::Latin1ToUTF8 ( const void * _latin1Ptr, size_t latin1Len, std::string * utf8 )
{
const XMP_Uns8* latin1Ptr = (XMP_Uns8*)_latin1Ptr;
@@ -388,8 +410,10 @@ void ReconcileUtils::Latin1ToUTF8 ( const void * _latin1Ptr, size_t latin1Len, s
#elif XMP_UNIXBuild
- #error "Latin1ToUTF8 is not implemented for UNIX"
+ #error "No generic UNIX implementation"
#endif
} // ReconcileUtils::Latin1ToUTF8
+
+#endif