jscript: Fixed some math API assumption that cause test failures on Solaris.

This commit is contained in:
Jacek Caban 2010-12-30 14:32:43 +01:00 committed by Alexandre Julliard
parent 9a16f796f2
commit 45aee4fd6c
2 changed files with 22 additions and 5 deletions

View File

@ -290,7 +290,7 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
for(ptr=str; *ptr; ptr++) {
if(*ptr > 0xff)
len += 6;
else if(isalnum((char)*ptr) || *ptr=='*' || *ptr=='@' || *ptr=='-'
else if(isalnum((unsigned char)*ptr) || *ptr=='*' || *ptr=='@' || *ptr=='-'
|| *ptr=='_' || *ptr=='+' || *ptr=='.' || *ptr=='/')
len++;
else

View File

@ -100,7 +100,13 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(FAILED(hres))
return hres;
if(retv) num_set_val(retv, acos(num_val(&v)));
if(retv) {
DOUBLE x = num_val(&v);
if(x < -1.0 || x > 1.0)
num_set_nan(retv);
else
num_set_val(retv, acos(x));
}
return S_OK;
}
@ -121,7 +127,13 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(FAILED(hres))
return hres;
if(retv) num_set_val(retv, asin(num_val(&v)));
if(retv) {
DOUBLE x = num_val(&v);
if(x < -1.0 || x > 1.0)
num_set_nan(retv);
else
num_set_val(retv, asin(x));
}
return S_OK;
}
@ -278,8 +290,13 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
if(FAILED(hres))
return hres;
if(retv)
num_set_val(retv, log(num_val(&v)));
if(retv) {
DOUBLE x = num_val(&v);
if(x < -0.0)
num_set_nan(retv);
else
num_set_val(retv, log(x));
}
return S_OK;
}