Re: [PATCH 2/3]vbscript: Implemented builtin function CInt

2013-04-18 Thread Jacek Caban
On 04/17/13 18:17, larmbr zhan wrote:
> +static HRESULT to_int_banker_rounding(VARIANT *v, int *ret)
> +{

I wonder if this conversion is used in any other place as well. I think
this does not need a helper function until we find other use cases as
well, esp. since you could simplify that to:

if(V_VT(v) == VT_R8) {
//... your conversion
}else {
hres = to_int(v);
}


+case VT_R8: {
+double n = rint(V_R8(v));


rint is not portable. Please avoid using it.

@@ -424,4 +424,22 @@ Call ok(getVT(vbYes) = "VT_I2", "getVT(vbYes) = " & 
getVT(vbYes))
 Call ok(vbNo = 7, "vbNo = " & vbNo)
 Call ok(getVT(vbNo) = "VT_I2", "getVT(vbNo) = " & getVT(vbNo))
 
+Call ok(CInt(-36.75) = -37, "CInt(-36.75) = " & CInt(-36.75))
+Call ok(CInt(-36.50) = -36, "CInt(-36.50) = " & CInt(-36.50))
+Call ok(CInt(-36.25) = -36, "CInt(-36.25) = " & CInt(-36.25))


Please add some tests using getVT to verify underlying types.


Thanks,
Jacek







Re: [PATCH 2/3]vbscript: Implemented builtin function CInt

2013-04-17 Thread Dmitry Timoshkov
larmbr zhan  wrote:

> +case VT_BOOL:
> +*ret = V_BOOL(v) ? -1 : 0;
> +break;

Shouldn't this be VARIANT_TRUE/VARIANT_FALSE instead of -1/0?

-- 
Dmitry.




Re: [PATCH 2/3]vbscript: Implemented builtin function CInt

2013-04-17 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=25138

Your paranoid android.


=== W2KPROSP4 (32 bit) ===
No test summary line found

=== WXPPROSP2 (32 bit) ===
No test summary line found

=== WXPX64 (32 bit) ===
No test summary line found

=== W2K3R2SESP2 (32 bit) ===
No test summary line found

=== WVISTAX64 (32 bit) ===
No test summary line found

=== W2K8SE (32 bit) ===
No test summary line found

=== W7PROX64 (32 bit) ===
No test summary line found

=== TEST64_W7SP1 (32 bit) ===
No test summary line found

=== WXPX64 (64 bit) ===
No test summary line found

=== WVISTAX64 (64 bit) ===
No test summary line found

=== W7PROX64 (64 bit) ===
No test summary line found

=== TEST64_W7SP1 (64 bit) ===
No test summary line found