On 04/29/14 16:04, Shuai Meng wrote:
<mailto:piotr.caban@gmail.com>>:No, I mean that you should do something like this:
�� �� On 04/29/14 15:06, Shuai Meng wrote:
�� �� �� �� + �� ��if(!res)
�� �� �� �� + �� �� �� ��return S_OK;
�� �� You can't return early if res is NULL. You still need to do the
�� �� conversion and return error if it fails.
I ��don't quite get it, do you mean I should do like this:
if(res)
{
....
}
return S_OK;
VARIANT v;
...
V_VT(&v) = VT_EMPTY;
hr = VariantChangeType(..., &v);
if(FAILED(hr))
�� �� return hr;
...
if(res)
�� �� *res = v;
else
�� �� VariantClear(&v);
You must have done something else incorrectly. Here's a run that succeeded: https://testbot.winehq.org/JobDetails.pl?Key=6665. It shows that CBool("True") returns true.�� �� It would be nice to add following tests (these are the tests Jacek/expression/ can't be interpreted as a numeric value, a run-time error
�� �� was asking for):
�� �� Call ok(CBool("True") = true, "CBool(""True"") = " & CBool("True"))
�� �� Call ok(CBool("fAlSe") = false, "CBool(""fAlSe"") = " & CBool("fAlSe"))
�� I do notice it, but they failed in testbot. Just as MSDN says, If
occurs.
It's meant to handle error returned by CBool("#FALSE#"). Other invalid parameters may be tested in the same way.
�� �� sub testCBoolError
�� �� �� �� ��on error resume next
�� �� �� �� ��call Err.clear()
�� �� �� �� ��call CBool("#FALSE#")
�� �� �� �� ��call ok(Err.number = 458, "Err.number = " & Err.number)
�� �� end sub
�� �� Call testCBoolError
Is this function written to provoke an error on purpose in order to test
CBool("#FALSE#")?
Cheers,
Piot
r