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

Jacek Caban jacek at codeweavers.com
Thu Apr 18 05:18:44 CDT 2013


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






More information about the wine-devel mailing list