mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
jscript: Avoid direct access to string buffer in a few more places.
This commit is contained in:
parent
d7f24b0956
commit
9323dc57af
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user