* 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
Родитель d738e3e155
Коммит d89c763528
3 изменённых файлов: 20 добавлений и 1 удалений

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

@ -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>
* ext/win32ole/win32ole.c (folevariant_initialize): remove unnecessary

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

@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00,
#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 args)
} 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;

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

@ -309,6 +309,13 @@ if defined?(WIN32OLE_VARIANT)
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)