1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

win32ole.c: fix long conversion

* ext/win32ole/win32ole.c (ole_val2variant): get rid of repeated
  conversions and fix a compile error due to V_I8 in old VC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-08-13 01:49:16 +00:00
parent ee7993afb4
commit 9e778a8ad5

View file

@ -1269,13 +1269,16 @@ ole_val2variant(VALUE val, VARIANT *var)
V_BSTR(var) = ole_vstr2wc(val);
break;
case T_FIXNUM:
V_I4(var) = NUM2LONG(val);
if (V_I4(var) == NUM2LONG(val)) {
V_VT(var) = VT_I4;
}
else {
V_I8(var) = NUM2LONG(val);
V_VT(var) = VT_I8;
V_VT(var) = VT_I4;
{
long v = NUM2LONG(val);
V_I4(var) = (LONG)v;
#if SIZEOF_LONG > 4
if (V_I4(var) != v) {
V_I8(var) = NUM2LONG(val);
V_VT(var) = VT_I8;
}
#endif
}
break;
case T_BIGNUM: