[前][次][番号順一覧][スレッド一覧]

ruby-changes:34915

From: suke <ko1@a...>
Date: Tue, 29 Jul 2014 22:25:14 +0900 (JST)
Subject: [ruby-changes:34915] suke:r46998 (trunk): * ext/win32ole/win32ole.c (hash2olerec): ignore WIN32OLE_RECORD

suke	2014-07-29 22:25:02 +0900 (Tue, 29 Jul 2014)

  New Revision: 46998

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46998

  Log:
    * ext/win32ole/win32ole.c (hash2olerec): ignore WIN32OLE_RECORD
      instance variable if the variable is nil.

  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/win32ole.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46997)
+++ ChangeLog	(revision 46998)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul 29 22:21:37 2014  Masaki Suketa <masaki.suketa@n...>
+
+	* 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@n...>
 
 	* ext/win32ole/win32ole.c (folerecord_method_missing): refactoring.
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 46997)
+++ ext/win32ole/win32ole.c	(revision 46998)
@@ -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.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 https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1677
     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;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]