* ext/etc/etc.c (etc_uname): fix for old VC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-05-19 12:32:25 +00:00
Родитель 21190be21c
Коммит e3653bfe6f
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -702,7 +702,11 @@ etc_uname(VALUE obj)
rb_w32_conv_from_wchar(v.szCSDVersion, rb_utf8_encoding())); rb_w32_conv_from_wchar(v.szCSDVersion, rb_utf8_encoding()));
rb_hash_aset(result, ID2SYM(rb_intern("version")), version); rb_hash_aset(result, ID2SYM(rb_intern("version")), version);
# if defined _MSC_VER && _MSC_VER < 1300
# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameW(ptr, plen)
# else
# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameExW(ComputerNameDnsFullyQualified, ptr, len); # define GET_COMPUTER_NAME(ptr, plen) GetComputerNameExW(ComputerNameDnsFullyQualified, ptr, len);
# endif
GET_COMPUTER_NAME(NULL, &len); GET_COMPUTER_NAME(NULL, &len);
buf = ALLOCV_N(WCHAR, vbuf, len); buf = ALLOCV_N(WCHAR, vbuf, len);
if (GET_COMPUTER_NAME(buf, &len)) { if (GET_COMPUTER_NAME(buf, &len)) {
@ -712,6 +716,15 @@ etc_uname(VALUE obj)
if (NIL_P(nodename)) nodename = rb_str_new(0, 0); if (NIL_P(nodename)) nodename = rb_str_new(0, 0);
rb_hash_aset(result, ID2SYM(rb_intern("nodename")), nodename); rb_hash_aset(result, ID2SYM(rb_intern("nodename")), nodename);
# ifndef PROCESSOR_ARCHITECTURE_AMD64
# define PROCESSOR_ARCHITECTURE_AMD64 9
# endif
# ifndef PROCESSOR_ARCHITECTURE_IA64
# define PROCESSOR_ARCHITECTURE_IA64 6
# endif
# ifndef PROCESSOR_ARCHITECTURE_INTEL
# define PROCESSOR_ARCHITECTURE_INTEL 0
# endif
GetSystemInfo(&s); GetSystemInfo(&s);
switch (s.wProcessorArchitecture) { switch (s.wProcessorArchitecture) {
case PROCESSOR_ARCHITECTURE_AMD64: case PROCESSOR_ARCHITECTURE_AMD64: