ruby-changes:34784
From: suke <ko1@a...>
Date: Fri, 18 Jul 2014 22:41:01 +0900 (JST)
Subject: [ruby-changes:34784] suke:r46867 (trunk): * ext/win32ole/win32ole.c (folevariant_initialize): WIN32OLE_VARIANT
suke 2014-07-18 22:40:41 +0900 (Fri, 18 Jul 2014) New Revision: 46867 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46867 Log: * ext/win32ole/win32ole.c (folevariant_initialize): WIN32OLE_VARIANT does not support VT_RECORD. VT_RECORD should be supported in WIN32OLE_RECORD. * test/win32ole/test_win32ole_variant.rb (test_s_new_vt_record_exc): ditto. Modified files: trunk/ChangeLog trunk/ext/win32ole/win32ole.c trunk/test/win32ole/test_win32ole_variant.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 46866) +++ ChangeLog (revision 46867) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jul 18 22:34:41 2014 Masaki Suketa <masaki.suketa@n...> + + * ext/win32ole/win32ole.c (folevariant_initialize): WIN32OLE_VARIANT + does not support VT_RECORD. VT_RECORD should be supported in + WIN32OLE_RECORD. + + * test/win32ole/test_win32ole_variant.rb (test_s_new_vt_record_exc): + ditto. + Fri Jul 18 19:54:03 2014 Masaki Suketa <masaki.suketa@n...> * ext/win32ole/win32ole.c (folevariant_initialize): remove unnecessary Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 46866) +++ ext/win32ole/win32ole.c (revision 46867) @@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L143 #define WC2VSTR(x) ole_wc2vstr((x), TRUE) -#define WIN32OLE_VERSION "1.6.0" +#define WIN32OLE_VERSION "1.6.1" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -8892,6 +8892,9 @@ folevariant_initialize(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L8892 } else { vvt = rb_ary_entry(args, 1); vt = NUM2INT(vvt); + if ((vt & VT_TYPEMASK) == VT_RECORD) { + rb_raise(rb_eArgError, "not supported VT_RECORD WIN32OLE_VARIANT object"); + } ole_val2olevariantdata(val, vt, pvar); } return self; Index: test/win32ole/test_win32ole_variant.rb =================================================================== --- test/win32ole/test_win32ole_variant.rb (revision 46866) +++ test/win32ole/test_win32ole_variant.rb (revision 46867) @@ -309,6 +309,13 @@ if defined?(WIN32OLE_VARIANT) https://github.com/ruby/ruby/blob/trunk/test/win32ole/test_win32ole_variant.rb#L309 assert_equal(ar, ar2.value) end + def test_s_new_vt_record_exc + # VT_RECORD (= 36) should not be allowed in WIN32OLE_VARIANT#new + assert_raise(ArgumentError) { + WIN32OLE_VARIANT.new(nil, 36) + } + end + def test_s_array obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_I4) assert_instance_of(WIN32OLE_VARIANT, obj) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/