[前][次][番号順一覧][スレッド一覧]

ruby-changes:9859

From: yugui <ko1@a...>
Date: Fri, 9 Jan 2009 11:18:51 +0900 (JST)
Subject: [ruby-changes:9859] Ruby:r21400 (ruby_1_9_1): merges r21110 from trunk into ruby_1_9_1.

yugui	2009-01-09 11:18:30 +0900 (Fri, 09 Jan 2009)

  New Revision: 21400

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21400

  Log:
    merges r21110 from trunk into ruby_1_9_1.
    * encoding.c (rb_filesystem_encoding): use ANSI codepage for file
      system on cygwin.
    * encoding.c (rb_locale_charmap): reverted.  [ruby-core:21110]

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/encoding.c

Index: ruby_1_9_1/encoding.c
===================================================================
--- ruby_1_9_1/encoding.c	(revision 21399)
+++ ruby_1_9_1/encoding.c	(revision 21400)
@@ -14,18 +14,15 @@
 #include "regenc.h"
 #include <ctype.h>
 #ifndef NO_LOCALE_CHARMAP
-#if defined __CYGWIN__
+#ifdef __CYGWIN__
 #include <windows.h>
-#elif defined HAVE_LANGINFO_H
+#endif
+#ifdef HAVE_LANGINFO_H
 #include <langinfo.h>
 #endif
 #endif
 #include "ruby/util.h"
 
-#if defined _WIN32 || defined __CYGWIN__
-#define USE_CODEPAGE_LOCALE 1
-#endif
-
 static ID id_encoding;
 VALUE rb_cEncoding;
 static VALUE rb_encoding_list;
@@ -1033,8 +1030,12 @@
 rb_filesystem_encoding(void)
 {
     rb_encoding *enc;
-#if defined USE_CODEPAGE_LOCALE
-    enc = rb_locale_encoding();
+#if defined NO_LOCALE_CHARMAP
+    enc = rb_default_external_encoding();
+#elif defined _WIN32 || defined __CYGWIN__
+    char cp[sizeof(int) * 8 / 3 + 4];
+    snprintf(cp, sizeof cp, "CP%d", GetACP());
+    enc = rb_enc_find(cp);
 #elif defined __APPLE__
     enc = rb_enc_find("UTF8-MAC");
 #else
@@ -1212,12 +1213,12 @@
 {
 #if defined NO_LOCALE_CHARMAP
     return rb_usascii_str_new2("ASCII-8BIT");
-#elif defined USE_CODEPAGE_LOCALE
-    return rb_sprintf("CP%d", GetACP());
 #elif defined HAVE_LANGINFO_H
     char *codeset;
     codeset = nl_langinfo(CODESET);
     return rb_usascii_str_new2(codeset);
+#elif defined _WIN32
+    return rb_sprintf("CP%d", GetACP());
 #else
     return Qnil;
 #endif
Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 21399)
+++ ruby_1_9_1/ChangeLog	(revision 21400)
@@ -1,3 +1,10 @@
+Mon Jan  5 16:26:48 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* encoding.c (rb_filesystem_encoding): use ANSI codepage for file
+	  system on cygwin.
+
+	* encoding.c (rb_locale_charmap): reverted.  [ruby-core:21110]
+
 Mon Jan  5 16:15:00 2009  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* ext/curses/curses.c (free_window): use xfree instead of free.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]