vbscript: Use to_int in InStr implementation.

This commit is contained in:
Jacek Caban 2012-03-29 12:06:20 +02:00 committed by Alexandre Julliard
parent 4b00511c64
commit 81fe4bd8a5
1 changed files with 4 additions and 12 deletions

View File

@ -603,6 +603,7 @@ static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VA
VARIANT *startv, *str1v, *str2v; VARIANT *startv, *str1v, *str2v;
BSTR str1, str2; BSTR str1, str2;
int start, ret; int start, ret;
HRESULT hres;
TRACE("\n"); TRACE("\n");
@ -625,18 +626,9 @@ static HRESULT Global_InStr(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VA
} }
if(startv) { if(startv) {
/* FIXME: Move to helper */ hres = to_int(startv, &start);
switch(V_VT(startv)) { if(FAILED(hres))
case VT_I2: return hres;
start = V_I2(startv);
break;
case VT_I4:
start = V_I4(startv);
break;
default:
FIXME("unsupported start %s\n", debugstr_variant(startv));
return E_NOTIMPL;
}
if(--start < 0) { if(--start < 0) {
FIXME("start %d\n", start); FIXME("start %d\n", start);
return E_FAIL; return E_FAIL;