* ext/win32ole/win32ole.c (hash2olerec): ignore WIN32OLE_RECORD

instance variable if the variable is nil.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2014-07-29 13:25:02 +00:00
Родитель ce4325f354
Коммит db91d29f7c
2 изменённых файлов: 18 добавлений и 12 удалений

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

@ -1,3 +1,8 @@
Tue Jul 29 22:21:37 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (hash2olerec): ignore WIN32OLE_RECORD
instance variable if the variable is nil.
Tue Jul 29 19:43:27 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (folerecord_method_missing): refactoring.

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

@ -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.5"
#define WIN32OLE_VERSION "1.6.6"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@ -1677,17 +1677,18 @@ hash2olerec(VALUE key, VALUE val, VALUE rec)
IRecordInfo *pri;
HRESULT hr;
Data_Get_Struct(rec, struct olerecorddata, prec);
pri = prec->pri;
VariantInit(&var);
ole_val2variant(val, &var);
pbuf = ole_vstr2wc(key);
hr = pri->lpVtbl->PutField(pri, INVOKE_PROPERTYPUT, prec->pdata, pbuf, &var);
SysFreeString(pbuf);
VariantClear(&var);
if (FAILED(hr)) {
ole_raise(hr, eWIN32OLERuntimeError, "failed to putfield of `%s`", StringValuePtr(key));
if (val != Qnil) {
Data_Get_Struct(rec, struct olerecorddata, prec);
pri = prec->pri;
VariantInit(&var);
ole_val2variant(val, &var);
pbuf = ole_vstr2wc(key);
hr = pri->lpVtbl->PutField(pri, INVOKE_PROPERTYPUT, prec->pdata, pbuf, &var);
SysFreeString(pbuf);
VariantClear(&var);
if (FAILED(hr)) {
ole_raise(hr, eWIN32OLERuntimeError, "failed to putfield of `%s`", StringValuePtr(key));
}
}
return ST_CONTINUE;
}