Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
26576b83
Commit
26576b83
authored
Sep 17, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Always use jsval-based to_boolean.
parent
c1eb4326
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
60 deletions
+37
-60
bool.c
dlls/jscript/bool.c
+1
-1
engine.c
dlls/jscript/engine.c
+4
-4
jscript.h
dlls/jscript/jscript.h
+1
-2
jsutils.c
dlls/jscript/jsutils.c
+31
-53
No files found.
dlls/jscript/bool.c
View file @
26576b83
...
@@ -128,7 +128,7 @@ static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
...
@@ -128,7 +128,7 @@ static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
HRESULT
hres
;
HRESULT
hres
;
if
(
argc
)
{
if
(
argc
)
{
hres
=
to_boolean
_jsval
(
argv
[
0
],
&
value
);
hres
=
to_boolean
(
argv
[
0
],
&
value
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
}
}
...
...
dlls/jscript/engine.c
View file @
26576b83
...
@@ -1212,7 +1212,7 @@ static HRESULT interp_cnd_nz(exec_ctx_t *ctx)
...
@@ -1212,7 +1212,7 @@ static HRESULT interp_cnd_nz(exec_ctx_t *ctx)
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
hres
=
to_boolean
_jsval
(
stack_top
(
ctx
),
&
b
);
hres
=
to_boolean
(
stack_top
(
ctx
),
&
b
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -1234,7 +1234,7 @@ static HRESULT interp_cnd_z(exec_ctx_t *ctx)
...
@@ -1234,7 +1234,7 @@ static HRESULT interp_cnd_z(exec_ctx_t *ctx)
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
hres
=
to_boolean
_jsval
(
stack_top
(
ctx
),
&
b
);
hres
=
to_boolean
(
stack_top
(
ctx
),
&
b
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -2185,7 +2185,7 @@ static HRESULT interp_neg(exec_ctx_t *ctx)
...
@@ -2185,7 +2185,7 @@ static HRESULT interp_neg(exec_ctx_t *ctx)
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
v
=
stack_pop
(
ctx
);
v
=
stack_pop
(
ctx
);
hres
=
to_boolean
_jsval
(
v
,
&
b
);
hres
=
to_boolean
(
v
,
&
b
);
jsval_release
(
v
);
jsval_release
(
v
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
@@ -2325,7 +2325,7 @@ static HRESULT interp_jmp_z(exec_ctx_t *ctx)
...
@@ -2325,7 +2325,7 @@ static HRESULT interp_jmp_z(exec_ctx_t *ctx)
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
v
=
stack_pop
(
ctx
);
v
=
stack_pop
(
ctx
);
hres
=
to_boolean
_jsval
(
v
,
&
b
);
hres
=
to_boolean
(
v
,
&
b
);
jsval_release
(
v
);
jsval_release
(
v
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
...
...
dlls/jscript/jscript.h
View file @
26576b83
...
@@ -255,8 +255,7 @@ typedef enum {
...
@@ -255,8 +255,7 @@ typedef enum {
}
hint_t
;
}
hint_t
;
HRESULT
to_primitive
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
jsval_t
*
,
hint_t
)
DECLSPEC_HIDDEN
;
HRESULT
to_primitive
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
jsval_t
*
,
hint_t
)
DECLSPEC_HIDDEN
;
HRESULT
to_boolean
(
VARIANT
*
,
VARIANT_BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_boolean
(
jsval_t
,
BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_boolean_jsval
(
jsval_t
,
BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number_jsval
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_number_jsval
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_integer
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_integer
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
double
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/jsutils.c
View file @
26576b83
...
@@ -437,60 +437,32 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, jsval_t *re
...
@@ -437,60 +437,32 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, jsval_t *re
}
}
/* ECMA-262 3rd Edition 9.2 */
/* ECMA-262 3rd Edition 9.2 */
HRESULT
to_boolean
(
VARIANT
*
v
,
VARIANT_BOOL
*
b
)
HRESULT
to_boolean
(
jsval_t
val
,
BOOL
*
ret
)
{
{
switch
(
V_VT
(
v
))
{
switch
(
val
.
type
)
{
case
VT_EMPTY
:
case
JSV_UNDEFINED
:
case
VT_NULL
:
case
JSV_NULL
:
*
b
=
VARIANT_FALSE
;
*
ret
=
VARIANT_FALSE
;
break
;
return
S_OK
;
case
VT_I4
:
case
JSV_OBJECT
:
*
b
=
V_I4
(
v
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
*
ret
=
get_object
(
val
)
!=
NULL
;
break
;
return
S_OK
;
case
VT_R8
:
case
JSV_STRING
:
if
(
isnan
(
V_R8
(
v
)))
*
b
=
VARIANT_FALSE
;
*
ret
=
get_string
(
val
)
&&
*
get_string
(
val
);
else
*
b
=
V_R8
(
v
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
break
;
case
VT_BSTR
:
*
b
=
V_BSTR
(
v
)
&&
*
V_BSTR
(
v
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
break
;
case
VT_DISPATCH
:
*
b
=
V_DISPATCH
(
v
)
?
VARIANT_TRUE
:
VARIANT_FALSE
;
break
;
case
VT_BOOL
:
*
b
=
V_BOOL
(
v
);
break
;
default:
FIXME
(
"unimplemented for vt %d
\n
"
,
V_VT
(
v
));
return
E_NOTIMPL
;
}
return
S_OK
;
}
/* ECMA-262 3rd Edition 9.2 */
HRESULT
to_boolean_jsval
(
jsval_t
v
,
BOOL
*
ret
)
{
VARIANT_BOOL
b
;
VARIANT
var
;
HRESULT
hres
;
if
(
v
.
type
==
JSV_BOOL
)
{
*
ret
=
v
.
u
.
b
;
return
S_OK
;
return
S_OK
;
case
JSV_NUMBER
:
*
ret
=
!
isnan
(
get_number
(
val
))
&&
get_number
(
val
);
return
S_OK
;
case
JSV_BOOL
:
*
ret
=
get_bool
(
val
);
return
S_OK
;
case
JSV_VARIANT
:
FIXME
(
"unimplemented for variant %s
\n
"
,
debugstr_variant
(
get_variant
(
val
)));
return
E_NOTIMPL
;
}
}
hres
=
jsval_to_variant
(
v
,
&
var
);
assert
(
0
);
if
(
FAILED
(
hres
))
return
E_FAIL
;
return
hres
;
hres
=
to_boolean
(
&
var
,
&
b
);
VariantClear
(
&
var
);
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
!!
b
;
return
S_OK
;
}
}
static
int
hex_to_int
(
WCHAR
c
)
static
int
hex_to_int
(
WCHAR
c
)
...
@@ -986,11 +958,17 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
...
@@ -986,11 +958,17 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
break
;
break
;
}
}
case
VT_BOOL
:
{
case
VT_BOOL
:
{
VARIANT_BOOL
b
;
jsval_t
val
;
BOOL
b
;
hres
=
variant_to_jsval
(
src
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_boolean
(
src
,
&
b
);
hres
=
to_boolean
(
val
,
&
b
);
jsval_release
(
val
);
if
(
SUCCEEDED
(
hres
))
if
(
SUCCEEDED
(
hres
))
V_BOOL
(
dst
)
=
b
;
V_BOOL
(
dst
)
=
b
?
VARIANT_TRUE
:
VARIANT_FALSE
;
break
;
break
;
}
}
case
VT_BSTR
:
{
case
VT_BSTR
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment