Commit df819566 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

jscript: Make String_toUpperCase generic.

parent ab816814
...@@ -1388,33 +1388,46 @@ static HRESULT String_toLowerCase(DispatchEx *dispex, LCID lcid, WORD flags, DIS ...@@ -1388,33 +1388,46 @@ static HRESULT String_toLowerCase(DispatchEx *dispex, LCID lcid, WORD flags, DIS
static HRESULT String_toUpperCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, static HRESULT String_toUpperCase(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
{ {
StringInstance *string;
const WCHAR* str; const WCHAR* str;
DWORD length; DWORD length;
BSTR bstr; BSTR val_str = NULL;
HRESULT hres;
TRACE("\n"); TRACE("\n");
if(is_class(dispex, JSCLASS_STRING)) { if(!is_class(dispex, JSCLASS_STRING)) {
string = (StringInstance*)dispex; VARIANT this;
length = string->length; V_VT(&this) = VT_DISPATCH;
str = string->str; V_DISPATCH(&this) = (IDispatch*)_IDispatchEx_(dispex);
}else {
FIXME("not string this not supported\n"); hres = to_string(dispex->ctx, &this, ei, &val_str);
return E_NOTIMPL; if(FAILED(hres))
return hres;
str = val_str;
length = SysStringLen(val_str);
}
else {
StringInstance *this = (StringInstance*)dispex;
str = this->str;
length = this->length;
} }
if(retv) { if(retv) {
bstr = SysAllocStringLen(str, length); if(!val_str) {
if (!bstr) val_str = SysAllocStringLen(str, length);
if(!val_str)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
struprW(bstr); struprW(val_str);
V_VT(retv) = VT_BSTR; V_VT(retv) = VT_BSTR;
V_BSTR(retv) = bstr; V_BSTR(retv) = val_str;
} }
else SysFreeString(val_str);
return S_OK; return S_OK;
} }
......
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