mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (w32_io_info): get rid of too huge alloca().
[Bug #4313] [ruby-core:34830] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
21931d6aa2
commit
18c11392af
2 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Jan 27 18:34:58 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* file.c (w32_io_info): get rid of too huge alloca().
|
||||||
|
[Bug #4313] [ruby-core:34830]
|
||||||
|
|
||||||
Thu Jan 27 18:19:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Thu Jan 27 18:19:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* win32/win32.c (wstati64): get rid of too huge alloca().
|
* win32/win32.c (wstati64): get rid of too huge alloca().
|
||||||
|
|
5
file.c
5
file.c
|
@ -835,15 +835,18 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st)
|
||||||
VALUE tmp;
|
VALUE tmp;
|
||||||
WCHAR *ptr;
|
WCHAR *ptr;
|
||||||
int len;
|
int len;
|
||||||
|
VALUE v;
|
||||||
|
|
||||||
FilePathValue(*file);
|
FilePathValue(*file);
|
||||||
tmp = rb_str_encode_ospath(*file);
|
tmp = rb_str_encode_ospath(*file);
|
||||||
len = MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, NULL, 0);
|
len = MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, NULL, 0);
|
||||||
ptr = ALLOCA_N(WCHAR, len);
|
ptr = ALLOCV_N(WCHAR, v, len);
|
||||||
MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, ptr, len);
|
MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, ptr, len);
|
||||||
f = CreateFileW(ptr, 0,
|
f = CreateFileW(ptr, 0,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
|
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
|
||||||
rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS,
|
rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS,
|
||||||
NULL);
|
NULL);
|
||||||
|
ALLOCV_END(v);
|
||||||
if (f == INVALID_HANDLE_VALUE) return f;
|
if (f == INVALID_HANDLE_VALUE) return f;
|
||||||
ret = f;
|
ret = f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue