summaryrefslogtreecommitdiff
path: root/databases/pgadmin3-12/files/patch-src-utils-utffile.cpp
blob: 464d0abae817ea653b405f2b8dea20312ea54cab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- src/utils/utffile.cpp.orig	Thu May 26 19:54:45 2005
+++ src/utils/utffile.cpp	Sun Oct 16 23:42:59 2005
@@ -16,10 +16,6 @@
 extern wxMBConvUTF32BE wxConvUTF32BE;
 extern wxMBConvUTF32LE wxConvUTF32LE;
 
-#if !wxUSE_UNICODE
-#error utffile.cpp is implemented for unicode only.
-#endif
-
 
 // these are the magic characters identifying an Unicode file
 #define BOM_UTF8    "\357\273\277"
@@ -87,7 +83,12 @@
             if (decr)
                 Seek(-decr, wxFromCurrent);
 
-            m_conversion->MB2WC((wchar_t*)(wxChar*)wxStringBuffer(str, nLen+1), (const char*)buffer, (size_t)(nLen+1));
+#if wxUSE_UNICODE
+            size_t buf_len = nLen + 1;
+#else
+            size_t buf_len = (nLen + 1) * sizeof(wchar_t);
+#endif
+            m_conversion->MB2WC((wchar_t*)(wxChar*)wxStringBuffer(str, buf_len), (const char*)buffer, (size_t)(nLen+1));
         }
         else
             str = (wxChar*)buffer;