Author: cwittich
Date: Thu Apr 23 00:40:07 2009
New Revision: 40659

URL: http://svn.reactos.org/svn/reactos?rev=40659&view=rev
Log:
fix some msvcrt string winetests

Modified:
    trunk/reactos/dll/win32/msvcrt/msvcrt.def
    trunk/reactos/lib/sdk/crt/mbstring/jistojms.c
    trunk/reactos/lib/sdk/crt/string/wcs.c

Modified: trunk/reactos/dll/win32/msvcrt/msvcrt.def
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt/msvcrt.def?rev=40659&r1=40658&r2=40659&view=diff
==============================================================================
--- trunk/reactos/dll/win32/msvcrt/msvcrt.def [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msvcrt/msvcrt.def [iso-8859-1] Thu Apr 23 00:40:07 
2009
@@ -848,6 +848,7 @@
   wscanf @842
 
   _mbsnbcpy_s
+  wcscpy_s
   wcsncpy_s
   _ftol2=_ftol
   _ftol2_sse=_ftol

Modified: trunk/reactos/lib/sdk/crt/mbstring/jistojms.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/mbstring/jistojms.c?rev=40659&r1=40658&r2=40659&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/mbstring/jistojms.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/mbstring/jistojms.c [iso-8859-1] Thu Apr 23 
00:40:07 2009
@@ -1,29 +1,60 @@
+/*
+ * MSVCRT string functions
+ *
+ * Copyright 1996,1998 Marcus Meissner
+ * Copyright 1996 Jukka Iivonen
+ * Copyright 1997,2000 Uwe Bonnes
+ * Copyright 2000 Jon Griffiths
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
 
 #include <precomp.h>
 #include <mbstring.h>
+#include <locale.h>
 
 /*
  * @implemented
  */
 unsigned int _mbcjistojms(unsigned int c)
 {
-  int c1, c2;
+ /* Conversion takes place only when codepage is 932.
+     In all other cases, c is returned unchanged */
+  if(MSVCRT___lc_codepage == 932)
+  {
+    if(HIBYTE(c) >= 0x21 && HIBYTE(c) <= 0x7e &&
+       LOBYTE(c) >= 0x21 && LOBYTE(c) <= 0x7e)
+    {
+      if(HIBYTE(c) % 2)
+        c += 0x1f;
+      else
+        c += 0x7d;
 
-  c2 = (unsigned char)c;
-  c1 = c >> 8;
-  if (c1 >= 0x21 && c1 <= 0x7e && c2 >= 0x21 && c2 <= 0x7e) {
-    if (c1 & 0x01) {
-      c2 += 0x1f;
-      if (c2 >= 0x7f)
-        c2 ++;
-    } else {
-      c2 += 0x7e;
+      if(LOBYTE(c) > 0x7F)
+        c += 0x1;
+
+      c = (((HIBYTE(c) - 0x21)/2 + 0x81) << 8) | LOBYTE(c);
+
+      if(HIBYTE(c) > 0x9f)
+        c += 0x4000;
     }
-    c1 += 0xe1;
-    c1 >>= 1;
-    if (c1 >= 0xa0)
-      c1 += 0x40;
-    return ((c1 << 8) | c2);
+    else
+      return 0; /* Codepage is 932, but c can't be converted */
   }
-  return 0;
+
+  return c;
 }
+

Modified: trunk/reactos/lib/sdk/crt/string/wcs.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wcs.c?rev=40659&r1=40658&r2=40659&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/wcs.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/wcs.c [iso-8859-1] Thu Apr 23 00:40:07 2009
@@ -1106,6 +1106,8 @@
     return isxdigitW( wc );
 }
 
+#endif
+
 /*********************************************************************
  *             wcscpy_s (MSVCRT.@)
  */
@@ -1137,7 +1139,6 @@
 
     return 0;
 }
-#endif
 
 /******************************************************************
  *             wcsncpy_s (MSVCRT.@)

Reply via email to