[PATCH] vbscript: Fixed CBool

Shuai Meng mengshuaicalendr at gmail.com
Wed Apr 30 09:21:24 CDT 2014


Thank you, I got it. And I'll correct it.


2014-04-30 16:05 GMT+08:00 Jacek Caban <jacek at codeweavers.com>:

>  On 04/30/14 02:42, Shuai Meng wrote:
>
> Thank you.
>
>
> 2014-04-30 1:13 GMT+08:00 Piotr Caban <piotr.caban at gmail.com>:
>
>> On 04/29/14 17:25, Shuai Meng wrote:
>>
>>>  2014-04-29 22:25 GMT+08:00 Piotr Caban <piotr.caban at gmail.com
>>>  <mailto:piotr.caban at gmail.com>>:
>>>
>>>     No, I mean that you should do something like this:
>>>     VARIANT v;
>>>     ...
>>>     V_VT(&v) = VT_EMPTY;
>>>     hr = VariantChangeType(..., &v);
>>>     if(FAILED(hr))
>>>          return hr;
>>>     ...
>>>
>>>     if(res)
>>>          *res = v;
>>>     else
>>>          VariantClear(&v);
>>>
>>>   what will be returned after  *res =  v; or VariantClear(&v); ?
>>>
>> S_OK, because the function has succeeded.
>>
>>
> Then I think this the same as return  VariantChangeType directly. How
> about writing like this:
>
>  if(res)
> {
>     V_VT(res) = VT_EMPTY;
>     return VariantChangeType(res, arg, 0, VT_BOOL);
> }
> return S_OK;
>
>  Because whether the change succeed or not, VariantChangeType will return
> a value indicating the situation.
>
>
> Even if res is NULL (meaning that the return value is not used by the
> script), the semantic of the code needs to be the same as if it was used.
> It's just an optimization and optimizations can't change semantics. For
> example:
>
> call CBool("blah")
>
> needs to return an error and you need to perform the conversion to
> recognize the error. An other example why this is wrong is if you try to
> convert an object. In such case, default value getter needs to be called
> (and it's called by VariantChangeType in this case).
>
> Jacek
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20140430/e17f000c/attachment.html>


More information about the wine-devel mailing list