[Common-cvs] runtime hlxosstr.cpp,1.25.2.10.2.2,1.25.2.10.2.3

[Common-cvs] runtime hlxosstr.cpp,1.25.2.10.2.2,1.25.2.10.2.3

ching_li at helixcommunity.org ching_li at helixcommunity.org
Thu Apr 21 04:36:38 UTC 2011


Update of /cvsroot/common/runtime
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv12040

Modified Files:
      Tag: hxclient_3_6_1_atlas
	hlxosstr.cpp 
Log Message:
wide-string functions have been supported in Android 2.3


Index: hlxosstr.cpp
===================================================================
RCS file: /cvsroot/common/runtime/hlxosstr.cpp,v
retrieving revision 1.25.2.10.2.2
retrieving revision 1.25.2.10.2.3
diff -u -d -r1.25.2.10.2.2 -r1.25.2.10.2.3
--- hlxosstr.cpp	4 Nov 2009 01:34:38 -0000	1.25.2.10.2.2
+++ hlxosstr.cpp	21 Apr 2011 04:36:35 -0000	1.25.2.10.2.3
@@ -77,7 +77,7 @@
 
 #if defined(_FREEBSD) || defined(_OPENBSD) || defined(_NETBSD) || \
     (defined(_MACINTOSH) && defined(_MAC_MACHO)) || defined(_MAC_UNIX) || \
-    defined(_OPENWAVE_ARMULATOR) || defined(ANDROID)
+    defined(_OPENWAVE_ARMULATOR) || defined(ANDROID) && !defined(ANDROID_2_3)
 int wcslen(const wchar_t* pStr)
 {
     assert(!"wcslen() Not Implemented\n");
@@ -613,11 +613,15 @@
 
 void HLXOsStrW::Init(const char* ascii, size_t length)
 {
-    m_size = ((length != (size_t)-1) ? length : ((ascii) ? strlen((const char*) ascii) + 1 : 0));
-
     if (ascii)
     {
+        m_size = (length != (size_t)-1) ? length : strlen(ascii) + 1;
 	m_outsize = MultiByteToWideChar(CP_UTF8, 0, (const char*) ascii, length, NULL, 0);
+        if (m_outsize <= 0)
+        {
+            m_outsize = 0;
+            return;
+        }
 	if ((length != (size_t)-1) && (length != 0))
 	  m_outsize = ((size_t)m_outsize < length)?length:m_outsize;
 	m_uni = ((wchar_t*) malloc(m_outsize * sizeof(wchar_t)));
@@ -635,14 +639,20 @@
 HLXOsStrW::HLXOsStrW(const wchar_t* uni, size_t length) : 
     m_isMutable(FALSE), 
     m_toAscii(FALSE),
-    m_size((length != (size_t)-1) ? length : ((uni) ? wcslen(uni) + 1 : 0)),
+    m_size(0),
+    m_outsize(0),
     m_uni(0),
     m_ascii(0)
 { 
     if (uni)
     {
-
+        m_size = (length != (size_t)-1) ? length : wcslen(uni) + 1;
 	m_outsize = WideCharToMultiByte(CP_UTF8, 0, uni, length, NULL, 0, NULL, NULL);
+        if (m_outsize <= 0)
+        {
+            m_outsize = 0;
+            return;
+        }
 	if ((length != (size_t)-1) && (length != 0))
 	  m_outsize = ((size_t)m_outsize < length)?length:m_outsize;
 	m_ascii = ((char*) malloc(m_outsize));
@@ -660,6 +670,8 @@
 HLXOsStrW::HLXOsStrW(BYTE* uni, size_t length, int nUnitSize, ENCODING_TYPE eUtf16Type) : 
     m_isMutable(FALSE), 
     m_toAscii(FALSE),
+    m_size(0),
+    m_outsize(0),
     m_uni(0),
     m_ascii(0)
 {




More information about the Common-cvs mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.