jscript: Avoid direct access to string buffer in a few more places.

This commit is contained in:
Jacek Caban 2013-03-08 11:38:11 +01:00 committed by Alexandre Julliard
parent d7f24b0956
commit 9323dc57af

View File

@ -1338,12 +1338,13 @@ static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if(r) {
jsstr_t *ret;
ret = jsstr_alloc_len(str->str, jsstr_length(str));
ret = jsstr_alloc_buf(jsstr_length(str));
if(!ret) {
jsstr_release(str);
return E_OUTOFMEMORY;
}
jsstr_flush(str, ret->str);
strlwrW(ret->str);
*r = jsval_string(ret);
}
@ -1366,12 +1367,13 @@ static HRESULT String_toUpperCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if(r) {
jsstr_t *ret;
ret = jsstr_alloc_len(str->str, jsstr_length(str));
ret = jsstr_alloc_buf(jsstr_length(str));
if(!ret) {
jsstr_release(str);
return E_OUTOFMEMORY;
}
jsstr_flush(str, ret->str);
struprW(ret->str);
*r = jsval_string(ret);
}
@ -1449,12 +1451,12 @@ static HRESULT String_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r)
StringInstance *string = (StringInstance*)jsdisp;
jsstr_t *ret;
TRACE("%p[%u] = %s\n", string, idx, debugstr_wn(string->str->str+idx, 1));
ret = jsstr_substr(string->str, idx, 1);
if(!ret)
return E_OUTOFMEMORY;
TRACE("%p[%u] = %s\n", string, idx, debugstr_jsstr(ret));
*r = jsval_string(ret);
return S_OK;
}