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

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 785
Date       : Thu Apr  6 17:52:30 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/unicdman.cpp

A fix for seg. fault when entering text, surprised no-one else saw it


Diff:
Index: Trunk/XaraLX/wxOil/unicdman.cpp
===================================================================
--- Trunk/XaraLX/wxOil/unicdman.cpp	(revision 784)
+++ Trunk/XaraLX/wxOil/unicdman.cpp	(revision 785)
@@ -240,6 +240,7 @@
 {
 	CHAR				MBArray[3];
 	WCHAR				ReturnArray[4];
+	size_t				cch;
 
 	// Convert UINT32 to DBCS
 	if( IsDBCSLeadByte( ( MBChar >> 8 ) & 0xFF ) )
@@ -247,11 +248,13 @@
 		MBArray[0] = (MBChar>>8) & 0xFF;
 		MBArray[1] = MBChar & 0xFF;
 		MBArray[2] = 0;
+		cch = 2;
 	}
 	else
 	{
 		MBArray[0] = MBChar & 0xFF;
 		MBArray[1] = 0;
+		cch = 1;
 	}
 	
 #if defined(__WXMSW__)
@@ -276,8 +279,7 @@
 		return 128;
 	}
 #else
-	mbstate_t			state;
-	mbrtowc( ReturnArray, MBArray, 2, &state );
+	mbrtowc( ReturnArray, MBArray, cch, NULL );
 	return ReturnArray[0];
 #endif
 }


Xara