ruby-changes:5118
From: usa <ko1@a...>
Date: Mon, 26 May 2008 17:26:00 +0900 (JST)
Subject: [ruby-changes:5118] Ruby:r16613 (trunk): * file.c (file_expand_path): add more space for '/'.
usa 2008-05-26 17:25:44 +0900 (Mon, 26 May 2008) New Revision: 16613 Modified files: trunk/ChangeLog trunk/file.c Log: * file.c (file_expand_path): add more space for '/'. * file.c (file_expand_path): should reset address of p after calling rb_str_resize(). [ruby-dev:34800] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/file.c?r1=16613&r2=16612&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16613&r2=16612&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 16612) +++ ChangeLog (revision 16613) @@ -1,3 +1,10 @@ +Mon May 26 17:23:49 2008 NAKAMURA Usaku <usa@r...> + + * file.c (file_expand_path): add more space for '/'. + + * file.c (file_expand_path): should reset address of p after calling + rb_str_resize(). [ruby-dev:34800] + Mon May 26 16:49:55 2008 Yukihiro Matsumoto <matz@r...> * misc/ruby-mode.el (ruby-mode): use run-hooks if run-mode-hook is Index: file.c =================================================================== --- file.c (revision 16612) +++ file.c (revision 16613) @@ -2730,8 +2730,10 @@ } if (p > buf && p[-1] == '/') --p; - else + else { + BUFCHECK(bdiff >= ++buflen); *p = '/'; + } p[1] = 0; root = skipprefix(buf); @@ -2864,6 +2866,7 @@ #endif HANDLE h = FindFirstFile(b, &wfd); if (h != INVALID_HANDLE_VALUE) { + long bdiff; FindClose(h); p = strrdirsep(buf); len = strlen(wfd.cFileName); @@ -2875,7 +2878,9 @@ #endif if (!p) p = buf; buflen = ++p - buf + len; + bdiff = p - buf; rb_str_resize(result, buflen); + p = RSTRING_PTR(result) + bdiff; memcpy(p, wfd.cFileName, len + 1); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/