jscript: Use jsstr_flush in String_concat.

This commit is contained in:
Jacek Caban 2013-03-05 11:50:18 +01:00 committed by Alexandre Julliard
parent 88e78eb16e
commit 895d059ebe
1 changed files with 3 additions and 6 deletions

View File

@ -331,8 +331,8 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) jsval_t *r)
{ {
unsigned len = 0, i, str_cnt;
jsstr_t **strs, *ret = NULL; jsstr_t **strs, *ret = NULL;
DWORD len = 0, i, l, str_cnt;
WCHAR *ptr; WCHAR *ptr;
HRESULT hres; HRESULT hres;
@ -364,11 +364,8 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
ret = jsstr_alloc_buf(len); ret = jsstr_alloc_buf(len);
if(ret) { if(ret) {
ptr = ret->str; ptr = ret->str;
for(i=0; i < str_cnt; i++) { for(i=0; i < str_cnt; i++)
l = jsstr_length(strs[i]); ptr += jsstr_flush(strs[i], ptr);
memcpy(ptr, strs[i]->str, l*sizeof(WCHAR));
ptr += l;
}
}else { }else {
hres = E_OUTOFMEMORY; hres = E_OUTOFMEMORY;
} }