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

ruby-changes:38038

From: nobu <ko1@a...>
Date: Mon, 30 Mar 2015 14:27:37 +0900 (JST)
Subject: [ruby-changes:38038] nobu:r50119 (trunk): file.c: include terminator

nobu	2015-03-30 14:27:21 +0900 (Mon, 30 Mar 2015)

  New Revision: 50119

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

  Log:
    file.c: include terminator
    
    * win32/file.c (rb_readlink): include the terminator, since
      rb_w32_mbstr_to_wstr appends a terminator only when the length
      is not given explicitly.

  Modified files:
    trunk/win32/file.c
Index: win32/file.c
===================================================================
--- win32/file.c	(revision 50118)
+++ win32/file.c	(revision 50119)
@@ -671,7 +671,8 @@ rb_readlink(VALUE path) https://github.com/ruby/ruby/blob/trunk/win32/file.c#L671
 	path = fix_string_encoding(path, enc);
 	cp = CP_UTF8;
     }
-    wpath = mbstr_to_wstr(cp, RSTRING_PTR(path), RSTRING_LEN(path), NULL);
+    wpath = mbstr_to_wstr(cp, RSTRING_PTR(path),
+			  RSTRING_LEN(path)+rb_enc_mbminlen(enc), NULL);
     if (!wpath) rb_memerror();
     len = rb_w32_wreadlink(wpath, wbuf, numberof(wbuf));
     free(wpath);

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

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