Commit 7308be6c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Added Space() implementation.

parent ff349394
...@@ -672,8 +672,34 @@ static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI ...@@ -672,8 +672,34 @@ static HRESULT Global_Trim(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
static HRESULT Global_Space(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) static HRESULT Global_Space(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{ {
FIXME("\n"); BSTR str;
return E_NOTIMPL; int n, i;
HRESULT hres;
TRACE("%s\n", debugstr_variant(arg));
hres = to_int(arg, &n);
if(FAILED(hres))
return hres;
if(n < 0) {
FIXME("n = %d\n", n);
return E_NOTIMPL;
}
if(!res)
return S_OK;
str = SysAllocStringLen(NULL, n);
if(!str)
return E_OUTOFMEMORY;
for(i=0; i<n; i++)
str[i] = ' ';
V_VT(res) = VT_BSTR;
V_BSTR(res) = str;
return S_OK;
} }
static HRESULT Global_String(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) static HRESULT Global_String(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
......
...@@ -179,4 +179,8 @@ Call ok(Len(1) = 1, "Len(1) = " & Len(1)) ...@@ -179,4 +179,8 @@ Call ok(Len(1) = 1, "Len(1) = " & Len(1))
Call ok(isNull(Len(null)), "Len(null) = " & Len(null)) Call ok(isNull(Len(null)), "Len(null) = " & Len(null))
Call ok(Len(empty) = 0, "Len(empty) = " & Len(empty)) Call ok(Len(empty) = 0, "Len(empty) = " & Len(empty))
Call ok(Space(1) = " ", "Space(1) = " & Space(1) & """")
Call ok(Space(0) = "", "Space(0) = " & Space(0) & """")
Call ok(Space(5) = " ", "Space(5) = " & Space(5) & """")
Call reportSuccess() Call reportSuccess()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment