<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 04/17/13 18:18, larmbr zhan wrote:<br>
</div>
<blockquote
cite="mid:CAHz2CGVYPvt674E6hnYzXiHP_AcvFJ0es9d-qbrmiYiPh1OHpg@mail.gmail.com"
type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;"
lang="x-western">
<pre wrap="">+ double tmp;
+ WCHAR trueW[] = {'T','r','u','e','\0'};
+ WCHAR falseW[] = {'F','a','l','s','e','\0'};
+
+ TRACE("%s\n", debugstr_variant(arg));
+
+ assert(args_cnt == 1);
+
+ switch(V_VT(arg)) {
+ case VT_I2:
+ tmp = V_I2(arg);
+ break;
+ case VT_I4:
+ tmp = V_I4(arg);
+ break;</pre>
</div>
</blockquote>
<br>
I don't think converting to double is a good idea here. Why don't
you do conversions directly to BOOL for all cases?<br>
<br>
<blockquote
cite="mid:CAHz2CGVYPvt674E6hnYzXiHP_AcvFJ0es9d-qbrmiYiPh1OHpg@mail.gmail.com"
type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;"
lang="x-western">
<pre wrap="">
+ case VT_R4:
+ tmp = V_R4(arg);
+ break;
+ case VT_R8:
+ tmp = V_R8(arg);
+ break;
+ default:
+ ERR("Not a numeric vaule: %s\n", debugstr_variant(arg));
+ return E_FAIL;
+ }
+
+ if (tmp < 0.0 || tmp > 0.0)
+ str = SysAllocString(trueW);
+ else
+ str = SysAllocString(falseW);
+
+
+ return return_bstr(res, str);</pre>
</div>
</blockquote>
<br>
Are you sure you want to return string type here? I'd expect a bool
value (of type VT_BOOL) here...<br>
<br>
<blockquote
cite="mid:CAHz2CGVYPvt674E6hnYzXiHP_AcvFJ0es9d-qbrmiYiPh1OHpg@mail.gmail.com"
type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;"
lang="x-western">
<pre wrap="">
}
static HRESULT Global_CByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs
index 6bd4065..9b25e87 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -442,4 +442,9 @@ Call ok(CInt(36.50) = 36, "CInt(36.50) = " & CInt(36.50))
Call ok(CInt(36.75) = 37, "CInt(36.75) = " & CInt(36.75))
Call ok(CInt(300) = 300, "CInt(300) = " & CInt(300))
Call ok(CInt(-300) = -300, "CInt(-300) = " & CInt(-300))
+
+Call ok(CBool(5) = "True", "CBool(5) = " & CBool(5))
+Call ok(CBool(0) = "False", "CBool(0) = " & CBool(0))
+Call ok(CBool(-5) = "True", "CBool(-5) = " & CBool(-5))</pre>
</div>
</blockquote>
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 12px;" lang="x-western">
<pre wrap="">
...and that's why getVT(...) test would be nice here.
Thanks,
Jacek
</pre>
</div>
<br>
</body>
</html>