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

ruby-changes:16090

From: naruse <ko1@a...>
Date: Thu, 27 May 2010 23:51:38 +0900 (JST)
Subject: [ruby-changes:16090] Ruby:r28041 (ruby_1_9_2): merge revision(s) 28037:28040:

naruse	2010-05-27 23:51:20 +0900 (Thu, 27 May 2010)

  New Revision: 28041

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

  Log:
    merge revision(s) 28037:28040:
    * file.c (rb_home_dir): set filesystem encoding.
    * file.c (file_expand_path): set encoding as the same of fname
      when _result_ is not filesystem encoding. [ruby-dev:41429]
    * file.c (file_expand_path): use rb_enc_associate_index and
      rb_filesystem_encindex. Strings related FileSystem should
      have filesystem_encoding.
    * file.c (SET_EXTERNAL_ENCODING): removed.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/file.c

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 28040)
+++ ruby_1_9_2/ChangeLog	(revision 28041)
@@ -1,3 +1,20 @@
+Thu May 27 23:51:05 2010  NARUSE, Yui  <naruse@r...>
+
+	* file.c (rb_home_dir): set filesystem encoding.
+
+Thu May 27 23:51:05 2010  NARUSE, Yui  <naruse@r...>
+
+	* file.c (file_expand_path): set encoding as the same of fname
+	  when _result_ is not filesystem encoding. [ruby-dev:41429]
+
+Thu May 27 23:51:05 2010  NARUSE, Yui  <naruse@r...>
+
+	* file.c (file_expand_path): use rb_enc_associate_index and
+	  rb_filesystem_encindex. Strings related FileSystem should
+	  have filesystem_encoding.
+
+	* file.c (SET_EXTERNAL_ENCODING): removed.
+
 Thu May 27 22:39:23 2010  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (rb_w32_read): call ReadFile() with len = 0 before
Index: ruby_1_9_2/file.c
===================================================================
--- ruby_1_9_2/file.c	(revision 28040)
+++ ruby_1_9_2/file.c	(revision 28041)
@@ -2788,10 +2788,6 @@
     buflen = RSTRING_LEN(result),\
     pend = p + buflen)
 
-#define SET_EXTERNAL_ENCODING() (\
-    (void)(extenc || (extenc = rb_default_external_encoding())),\
-    rb_enc_associate(result, extenc))
-
 VALUE
 rb_home_dir(const char *user, VALUE result)
 {
@@ -2832,6 +2828,7 @@
 	}
     }
 #endif
+    rb_enc_associate_index(result, rb_filesystem_encindex());
     return result;
 }
 
@@ -2842,7 +2839,6 @@
     char *buf, *p, *pend, *root;
     size_t buflen, dirlen, bdiff;
     int tainted;
-    rb_encoding *extenc = 0;
 
     s = StringValuePtr(fname);
     BUFINIT();
@@ -2898,8 +2894,9 @@
 		BUFCHECK(dirlen > buflen);
 		strcpy(buf, dir);
 		xfree(dir);
-		SET_EXTERNAL_ENCODING();
+		rb_enc_associate_index(result, rb_filesystem_encindex());
 	    }
+	    else rb_enc_copy(result, fname);
 	    p = chompdirsep(skiproot(buf));
 	    s += 2;
 	}
@@ -2909,6 +2906,7 @@
 	if (!NIL_P(dname)) {
 	    file_expand_path(dname, Qnil, abs_mode, result);
 	    BUFINIT();
+	    rb_enc_copy(result, fname);
 	}
 	else {
 	    char *dir = my_getcwd();
@@ -2918,7 +2916,7 @@
 	    BUFCHECK(dirlen > buflen);
 	    strcpy(buf, dir);
 	    xfree(dir);
-	    SET_EXTERNAL_ENCODING();
+	    rb_enc_associate_index(result, rb_filesystem_encindex());
 	}
 #if defined DOSISH || defined __CYGWIN__
 	if (isdirsep(*s)) {

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

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