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

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2014-07-18 13:40:41 +00:00
parent d738e3e155
commit d89c763528
3 changed files with 20 additions and 1 deletions

View file

@ -1,3 +1,12 @@
Fri Jul 18 22:34:41 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* 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@nifty.ne.jp> Fri Jul 18 19:54:03 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (folevariant_initialize): remove unnecessary * ext/win32ole/win32ole.c (folevariant_initialize): remove unnecessary

View file

@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00,
#define WC2VSTR(x) ole_wc2vstr((x), TRUE) #define WC2VSTR(x) ole_wc2vstr((x), TRUE)
#define WIN32OLE_VERSION "1.6.0" #define WIN32OLE_VERSION "1.6.1"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@ -8892,6 +8892,9 @@ folevariant_initialize(VALUE self, VALUE args)
} else { } else {
vvt = rb_ary_entry(args, 1); vvt = rb_ary_entry(args, 1);
vt = NUM2INT(vvt); 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); ole_val2olevariantdata(val, vt, pvar);
} }
return self; return self;

View file

@ -309,6 +309,13 @@ if defined?(WIN32OLE_VARIANT)
assert_equal(ar, ar2.value) assert_equal(ar, ar2.value)
end 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 def test_s_array
obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_I4) obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_I4)
assert_instance_of(WIN32OLE_VARIANT, obj) assert_instance_of(WIN32OLE_VARIANT, obj)