Commit 3bf7255d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added to_flat_string helper and use it to access string buffer in activex.c.

parent 343122a4
...@@ -143,7 +143,8 @@ static IUnknown *create_activex_object(script_ctx_t *ctx, const WCHAR *progid) ...@@ -143,7 +143,8 @@ static IUnknown *create_activex_object(script_ctx_t *ctx, const WCHAR *progid)
static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) jsval_t *r)
{ {
jsstr_t * progid; jsstr_t * progid_str;
const WCHAR *progid;
IDispatch *disp; IDispatch *disp;
IUnknown *obj; IUnknown *obj;
HRESULT hres; HRESULT hres;
...@@ -166,12 +167,12 @@ static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag ...@@ -166,12 +167,12 @@ static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
return E_NOTIMPL; return E_NOTIMPL;
} }
hres = to_string(ctx, argv[0], &progid); hres = to_flat_string(ctx, argv[0], &progid_str, &progid);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
obj = create_activex_object(ctx, progid->str); obj = create_activex_object(ctx, progid);
jsstr_release(progid); jsstr_release(progid_str);
if(!obj) if(!obj)
return throw_generic_error(ctx, JS_E_CANNOT_CREATE_OBJ, NULL); return throw_generic_error(ctx, JS_E_CANNOT_CREATE_OBJ, NULL);
......
...@@ -322,6 +322,7 @@ HRESULT to_integer(script_ctx_t*,jsval_t,double*) DECLSPEC_HIDDEN; ...@@ -322,6 +322,7 @@ HRESULT to_integer(script_ctx_t*,jsval_t,double*) DECLSPEC_HIDDEN;
HRESULT to_int32(script_ctx_t*,jsval_t,INT*) DECLSPEC_HIDDEN; HRESULT to_int32(script_ctx_t*,jsval_t,INT*) DECLSPEC_HIDDEN;
HRESULT to_uint32(script_ctx_t*,jsval_t,UINT32*) DECLSPEC_HIDDEN; HRESULT to_uint32(script_ctx_t*,jsval_t,UINT32*) DECLSPEC_HIDDEN;
HRESULT to_string(script_ctx_t*,jsval_t,jsstr_t**) DECLSPEC_HIDDEN; HRESULT to_string(script_ctx_t*,jsval_t,jsstr_t**) DECLSPEC_HIDDEN;
HRESULT to_flat_string(script_ctx_t*,jsval_t,jsstr_t**,const WCHAR**) DECLSPEC_HIDDEN;
HRESULT to_object(script_ctx_t*,jsval_t,IDispatch**) DECLSPEC_HIDDEN; HRESULT to_object(script_ctx_t*,jsval_t,IDispatch**) DECLSPEC_HIDDEN;
HRESULT variant_change_type(script_ctx_t*,VARIANT*,VARIANT*,VARTYPE) DECLSPEC_HIDDEN; HRESULT variant_change_type(script_ctx_t*,VARIANT*,VARIANT*,VARTYPE) DECLSPEC_HIDDEN;
......
...@@ -776,6 +776,23 @@ HRESULT to_string(script_ctx_t *ctx, jsval_t val, jsstr_t **str) ...@@ -776,6 +776,23 @@ HRESULT to_string(script_ctx_t *ctx, jsval_t val, jsstr_t **str)
return *str ? S_OK : E_OUTOFMEMORY; return *str ? S_OK : E_OUTOFMEMORY;
} }
HRESULT to_flat_string(script_ctx_t *ctx, jsval_t val, jsstr_t **str, const WCHAR **ret_str)
{
HRESULT hres;
hres = to_string(ctx, val, str);
if(FAILED(hres))
return hres;
*ret_str = jsstr_flatten(*str);
if(!*ret_str) {
jsstr_release(*str);
return E_OUTOFMEMORY;
}
return S_OK;
}
/* ECMA-262 3rd Edition 9.9 */ /* ECMA-262 3rd Edition 9.9 */
HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp) HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp)
{ {
......
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