ruby-changes:43813
From: nobu <ko1@a...>
Date: Sat, 13 Aug 2016 10:49:20 +0900 (JST)
Subject: [ruby-changes:43813] nobu:r55886 (trunk): win32ole.c: fix long conversion
nobu 2016-08-13 10:49:16 +0900 (Sat, 13 Aug 2016) New Revision: 55886 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55886 Log: 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. Modified files: trunk/ext/win32ole/win32ole.c Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 55885) +++ ext/win32ole/win32ole.c (revision 55886) @@ -1269,13 +1269,16 @@ ole_val2variant(VALUE val, VARIANT *var) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1269 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: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/