Avoid damaging the msvcrt locale

Bill Medland billmedland at mercuryspeed.com
Fri Nov 19 14:06:46 CST 2004


Bill Medland (billmedland at mercuryspeed.com)
Don't mess up the msvcrt codepage on e.g. _MB_CP_ANSI

Index: wine/dlls/msvcrt/locale.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/locale.c,v
retrieving revision 1.24
diff -u -r1.24 locale.c
--- wine/dlls/msvcrt/locale.c	1 Sep 2004 04:58:21 -0000	1.24
+++ wine/dlls/msvcrt/locale.c	19 Nov 2004 21:03:38 -0000
@@ -515,8 +515,13 @@
 /*********************************************************************
  *		_setmbcp (MSVCRT.@)
  */
-void _setmbcp(int cp)
+int _setmbcp(int cp)
 {
+  if (cp < 0)
+  {
+      FIXME ("Unreal codepages (e.g. %d) not implemented\n", cp);
+      return 0; /* Let's not confuse the caller by returning -1 */
+  }
   LOCK_LOCALE;
   if (msvcrt_current_lc_all_cp != cp)
   {
@@ -524,6 +529,7 @@
     msvcrt_current_lc_all_cp = cp;
   }
   UNLOCK_LOCALE;
+  return 0;
 }
 
 /*********************************************************************





More information about the wine-patches mailing list