[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 1624
Date       : Mon Jul 31 17:55:16 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/cxfrec.cpp

Change 2 UNICODEs ro _UNICODE and make the code in 1 instance a little nicer


Diff:
Index: Trunk/XaraLX/Kernel/cxfrec.cpp
===================================================================
--- Trunk/XaraLX/Kernel/cxfrec.cpp	(revision 1623)
+++ Trunk/XaraLX/Kernel/cxfrec.cpp	(revision 1624)
@@ -961,12 +961,19 @@
 	size_t len = camStrlen(pStr);
 	BOOL ok= TRUE;
 
-#ifdef UNICODE
+#ifdef _UNICODE
 	// Writing a Unicode string at pStr as an ASCII string
 	// Just write out the first byte of each unicode char.
 
-	for (INT32 i=0;ok && i<=len;i++)
-		ok = WriteBYTE(pStr[i*2]);
+	for (size_t i=0;ok && i<=len;i++)
+	{
+PORTNOTE( "record", "UNICODE characters that don't fit into 1 mb character need better handling" )
+		char	acTmp[MB_CUR_MAX];
+		if( 1 == wctomb( acTmp, pStr[i*2] ) )
+			ok = WriteBYTE( acTmp[0] );
+		else
+			ok = WriteBYTE( '.' );
+	}
 
 	LEAVEWRITEFUNCTION;
 	return ok;
@@ -1026,7 +1033,7 @@
 
 BOOL CXaraFileRecord::WriteUTF16STR(const StringVar& pvstr)
 {
-#ifdef UNICODE
+#ifdef _UNICODE
 	BOOL ok = TRUE;
 	WCHAR c = 0;
 	INT32 i = 0;


Xara