OSDN Git Service

2010-04-27 Danny Smith <dannysmith@users.sourceforge.net>
authorironhead <ironhead>
Wed, 19 May 2010 11:59:46 +0000 (11:59 +0000)
committerironhead <ironhead>
Wed, 19 May 2010 11:59:46 +0000 (11:59 +0000)
        * mingwex/mb_wc_common.h (get_codepage): Revert change of 2006-09-19.

winsup/mingw/ChangeLog
winsup/mingw/mingwex/mb_wc_common.h

index 8c671f7..95debcd 100644 (file)
@@ -1,3 +1,7 @@
+2010-04-27 Danny Smith <dannysmith@users.sourceforge.net>
+
+       * mingwex/mb_wc_common.h (get_codepage): Revert change of 2006-09-19.
+
 2010-03-06 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
 
        * include/_mingw.h: Increment version to 3.18.
index 40028d6..d1c2f9d 100755 (executable)
@@ -1,7 +1,13 @@
-__declspec(dllimport) unsigned int __lc_codepage;
+#include <locale.h>
+#include <string.h>
+#include <stdlib.h>
 
 static inline
 unsigned int get_codepage (void)
 {
-  return __lc_codepage;
+  /* locale :: "lang[_country[.code_page]]" | ".code_page"  */
+  char * cp_string;
+  if ((cp_string = strchr (setlocale(LC_CTYPE, NULL), '.')))
+    return  ((unsigned) atoi (cp_string + 1));
+  return 0;
 }