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

ruby-changes:43931

From: nobu <ko1@a...>
Date: Thu, 25 Aug 2016 00:39:57 +0900 (JST)
Subject: [ruby-changes:43931] nobu:r56004 (trunk): win32/file.c: fix result length

nobu	2016-08-25 00:39:52 +0900 (Thu, 25 Aug 2016)

  New Revision: 56004

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

  Log:
    win32/file.c: fix result length
    
    * win32/file.c (append_wstr): exclude the terminator from the
      result length when input len == -1.

  Modified files:
    trunk/ChangeLog
    trunk/win32/file.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56003)
+++ ChangeLog	(revision 56004)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Aug 25 00:39:50 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* win32/file.c (append_wstr): exclude the terminator from the
+	  result length when input len == -1.
+
 Wed Aug 24 22:41:30 2016  Kouhei Sutou  <kou@c...>
 
 	* gc.c (gc_reset_malloc_info): Remove too much ";".
Index: win32/file.c
===================================================================
--- win32/file.c	(revision 56003)
+++ win32/file.c	(revision 56004)
@@ -280,11 +280,12 @@ user_length_in_path(const wchar_t *wuser https://github.com/ruby/ruby/blob/trunk/win32/file.c#L280
 }
 
 static VALUE
-append_wstr(VALUE dst, const wchar_t *ws, size_t len, UINT cp, UINT path_cp, rb_encoding *path_encoding)
+append_wstr(VALUE dst, const WCHAR *ws, ssize_t len, UINT cp, UINT path_cp, rb_encoding *path_encoding)
 {
     long olen, nlen = (long)len;
 
     if (cp == path_cp) {
+	if (len == -1) len = lstrlenW(ws);
 	nlen = WideCharToMultiByte(cp, 0, ws, len, NULL, 0, NULL, NULL);
 	olen = RSTRING_LEN(dst);
 	rb_str_modify_expand(dst, nlen);

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

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