diff --git a/ChangeLog b/ChangeLog index 61a83a227a..c3859ce954 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Dec 27 23:32:26 2015 Masaki Suketa + + * ext/win32ole/win32ole.c (ole_variant2val): refactoring. + Sun Dec 27 21:14:42 2015 NAKAMURA Usaku * process.c (rb_execarg_parent_start1): need to convert the encoding to diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index ac3c2a6a73..ac02b66a88 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -1574,16 +1574,14 @@ ole_variant2val(VARIANT *pvar) case VT_BSTR: { - if(V_ISBYREF(pvar)) { - obj = (SysStringLen(*V_BSTRREF(pvar)) == 0) - ? rb_str_new2("") - : ole_wc2vstr(*V_BSTRREF(pvar), FALSE); - } - else { - obj = (SysStringLen(V_BSTR(pvar)) == 0) - ? rb_str_new2("") - : ole_wc2vstr(V_BSTR(pvar), FALSE); - } + BSTR bstr; + if(V_ISBYREF(pvar)) + bstr = *V_BSTRREF(pvar); + else + bstr = V_BSTR(pvar); + obj = (SysStringLen(bstr) == 0) + ? rb_str_new2("") + : ole_wc2vstr(bstr, FALSE); break; }