<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 04/23/14 02:20, Shuai Meng wrote:<br>
</div>
<blockquote cite="mid:53570746.0@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="">--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -557,8 +557,41 @@ static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA
static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
- FIXME("\n");
- return E_NOTIMPL;
+ TRACE("(%s)\n", debugstr_variant(arg));
+
+ assert(args_cnt == 1);
+
+ if(res) {
+ V_VT(res) = VT_BOOL;</pre>
</div>
</blockquote>
<br>
You can't assume that res is non-NULL.<br>
<br>
<blockquote cite="mid:53570746.0@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="">
+ switch(V_VT(arg)) {
+ case VT_UI1:
+ case VT_I2:
+ case VT_I4:
+ case VT_I8:
+ case VT_R4:
+ case VT_R8:
+ case VT_BOOL:
+ case VT_EMPTY:
+ case VT_CY:
+ V_BOOL(res) = VARIANT_TRUE;
+ break;
+ case VT_BSTR: {
+ HRESULT hRet;
+ double d;
+
+ hRet = VarR8FromStr(V_BSTR(arg), LOCALE_USER_DEFAULT, 0, &d);
+ if(SUCCEEDED(hRet))
+ V_BOOL(res) = VARIANT_TRUE;
+ else
+ V_BOOL(res) = VARIANT_FALSE;
+ break;
+ }
+ default:
+ V_BOOL(res) = VARIANT_FALSE;
+ break;</pre>
</div>
</blockquote>
<br>
That's a risky assumption. There are tons of other VT_* types
possible and at least VT_UI2, VT_UI4 and alike should most likely
return true. It's much safer to add explicit list of *tested* cases
to return false and FIXME(); return E_NOTIMPL for other cases.<br>
<br>
<blockquote cite="mid:53570746.0@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="">
+ }
+ }
+ return S_OK;
}
static HRESULT Global_IsArray(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 beee4d4..cf63fb9 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -170,6 +170,25 @@ Call ok(not isNull(4), "isNull(4) is true?")
Call ok(not isNull("x"), "isNull(""x"") is true?")
Call ok(isNull(Null), "isNull(Null) is not true?")
+Call ok(isNumeric(empty), "isNumeric(empty) is not true?")
+Call ok(not isNumeric(Null), "isNumeric(Null) is not true?")
+Call ok(isNumeric(32767), "isNumeric(32767) is true?")
+Call ok(isNumeric(32768), "isNumeric(32768) is true?")
+Call ok(isNumeric(CSng(3242.4)), "isNumeric(CSng(3242.4)) is true?")
+Call ok(isNumeric(32768.4), "isNumeric(32768.4) is true?")
+Call ok(isNumeric(CCur(32768.4)), "isNumeric(CCur(32768.4)) is true?")
+Call ok(not isNumeric(CDate(32)), "isNumeric(CDate(32)) is true?")
+Call ok(isNumeric("44"), "isNumeric(""44"") is true?")
+Call ok(not isNumeric("rwrf"), "isNumeric(""rwrf"") is not true?")
+Call ok(not isNumeric(Nothing), "isNumeric(Nothing) is not true?")
+Call ok(not isNumeric(New EmptyClass), "isNumeric(New EmptyClass) is not true?")
+Call ok(isNumeric(true), "isNumeric(true) is true?")
+Call ok(isNumeric(CByte(32)), "isNumeric(CByte(32)) is true?")
+Dim arr(2)
+arr(0) = 2
+arr(1) = 3
+Call ok(not isNumeric(arr), "isNumeric(arr) is not true?")
+
Call ok(getVT(err) = "VT_DISPATCH", "getVT(err) = " & getVT(err))
</pre>
</div>
</blockquote>
<br>
Your tests depend on your previous patches that were not committed
and I already commented them. Please concentrate on getting them
committed first.<br>
<br>
<br>
Jacek<br>
</body>
</html>