eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot/dic encoding.cpp


From: Olivier Teulière
Subject: [Eliot-dev] eliot/dic encoding.cpp
Date: Fri, 29 Jan 2010 21:46:14 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>       10/01/29 21:46:14

Modified files:
        dic            : encoding.cpp 

Log message:
        Fixed an encoding bug on Windows, when trying to convert empty strings

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/encoding.cpp?cvsroot=eliot&r1=1.12&r2=1.13

Patches:
Index: encoding.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/encoding.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- encoding.cpp        29 Nov 2009 16:01:31 -0000      1.12
+++ encoding.cpp        29 Jan 2010 21:46:13 -0000      1.13
@@ -354,6 +354,10 @@
                           const string &iContext)
 {
 #ifdef WIN32
+    if (iBuffer == NULL || *iBuffer == '\0')
+    {
+        return 0;
+    }
     int res = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, iBuffer,
                                   iBufSize, oString, iWideSize);
     if (res == 0)
@@ -414,6 +418,11 @@
                          unsigned int iBufSize, const string &iContext)
 {
 #ifdef WIN32
+    if (iWString.empty())
+    {
+        *oBuffer = '\0';
+        return 0;
+    }
     int res = WideCharToMultiByte(CP_UTF8, 0, iWString.c_str(), 
iWString.size(),
                                   oBuffer, iBufSize, NULL, NULL);
     if (res == 0)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]