mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
win32/file.c: fix result length
* win32/file.c (append_wstr): exclude the terminator from the result length when input len == -1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8ddc191df4
commit
b34321a221
2 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Aug 25 00:39:50 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@cozmixng.org>
|
Wed Aug 24 22:41:30 2016 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* gc.c (gc_reset_malloc_info): Remove too much ";".
|
* gc.c (gc_reset_malloc_info): Remove too much ";".
|
||||||
|
|
|
@ -280,11 +280,12 @@ user_length_in_path(const wchar_t *wuser, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
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;
|
long olen, nlen = (long)len;
|
||||||
|
|
||||||
if (cp == path_cp) {
|
if (cp == path_cp) {
|
||||||
|
if (len == -1) len = lstrlenW(ws);
|
||||||
nlen = WideCharToMultiByte(cp, 0, ws, len, NULL, 0, NULL, NULL);
|
nlen = WideCharToMultiByte(cp, 0, ws, len, NULL, 0, NULL, NULL);
|
||||||
olen = RSTRING_LEN(dst);
|
olen = RSTRING_LEN(dst);
|
||||||
rb_str_modify_expand(dst, nlen);
|
rb_str_modify_expand(dst, nlen);
|
||||||
|
|
Loading…
Reference in a new issue