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
acfd2b98
Commit
acfd2b98
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_string implementation.
parent
2fc71ab6
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
63 additions
and
109 deletions
+63
-109
activex.c
dlls/jscript/activex.c
+1
-1
array.c
dlls/jscript/array.c
+4
-4
date.c
dlls/jscript/date.c
+1
-1
engine.c
dlls/jscript/engine.c
+6
-6
error.c
dlls/jscript/error.c
+4
-4
function.c
dlls/jscript/function.c
+1
-1
global.c
dlls/jscript/global.c
+8
-8
jscript.h
dlls/jscript/jscript.h
+1
-2
jsutils.c
dlls/jscript/jsutils.c
+17
-38
number.c
dlls/jscript/number.c
+4
-16
object.c
dlls/jscript/object.c
+1
-1
regexp.c
dlls/jscript/regexp.c
+1
-1
string.c
dlls/jscript/string.c
+14
-26
No files found.
dlls/jscript/activex.c
View file @
acfd2b98
...
...
@@ -164,7 +164,7 @@ static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
return
E_NOTIMPL
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
progid
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
progid
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/array.c
View file @
acfd2b98
...
...
@@ -262,7 +262,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
break
;
if
(
!
is_undefined
(
val
)
&&
!
is_null
(
val
))
{
hres
=
to_string
_jsval
(
ctx
,
val
,
ei
,
str_tab
+
i
);
hres
=
to_string
(
ctx
,
val
,
ei
,
str_tab
+
i
);
jsval_release
(
val
);
if
(
FAILED
(
hres
))
break
;
...
...
@@ -348,7 +348,7 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
if
(
argc
)
{
BSTR
sep
;
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
sep
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
sep
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -656,11 +656,11 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, jsval_t v1, jsval
}
else
{
BSTR
x
,
y
;
hres
=
to_string
_jsval
(
ctx
,
v1
,
ei
,
&
x
);
hres
=
to_string
(
ctx
,
v1
,
ei
,
&
x
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
_jsval
(
ctx
,
v2
,
ei
,
&
y
);
hres
=
to_string
(
ctx
,
v2
,
ei
,
&
y
);
if
(
SUCCEEDED
(
hres
))
{
*
cmp
=
strcmpW
(
x
,
y
);
SysFreeString
(
y
);
...
...
dlls/jscript/date.c
View file @
acfd2b98
...
...
@@ -2380,7 +2380,7 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
parse_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
parse_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/engine.c
View file @
acfd2b98
...
...
@@ -812,7 +812,7 @@ static HRESULT interp_array(exec_ctx_t *ctx)
return
hres
;
}
hres
=
to_string
_jsval
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
jsval_release
(
namev
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
obj
);
...
...
@@ -881,7 +881,7 @@ static HRESULT interp_memberid(exec_ctx_t *ctx)
hres
=
to_object_jsval
(
ctx
->
script
,
objv
,
&
obj
);
jsval_release
(
objv
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
to_string
_jsval
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
if
(
FAILED
(
hres
))
IDispatch_Release
(
obj
);
}
...
...
@@ -1380,7 +1380,7 @@ static HRESULT interp_in(exec_ctx_t *ctx)
}
v
=
stack_pop
(
ctx
);
hres
=
to_string
_jsval
(
ctx
->
script
,
v
,
ctx
->
ei
,
&
str
);
hres
=
to_string
(
ctx
->
script
,
v
,
ctx
->
ei
,
&
str
);
jsval_release
(
v
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
get_object
(
obj
));
...
...
@@ -1422,13 +1422,13 @@ static HRESULT add_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexcept_
if
(
is_string
(
l
))
lstr
=
get_string
(
l
);
else
hres
=
to_string
_jsval
(
ctx
,
l
,
ei
,
&
lstr
);
hres
=
to_string
(
ctx
,
l
,
ei
,
&
lstr
);
if
(
SUCCEEDED
(
hres
))
{
if
(
is_string
(
r
))
rstr
=
get_string
(
r
);
else
hres
=
to_string
_jsval
(
ctx
,
r
,
ei
,
&
rstr
);
hres
=
to_string
(
ctx
,
r
,
ei
,
&
rstr
);
}
if
(
SUCCEEDED
(
hres
))
{
...
...
@@ -1585,7 +1585,7 @@ static HRESULT interp_delete(exec_ctx_t *ctx)
return
hres
;
}
hres
=
to_string
_jsval
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
hres
=
to_string
(
ctx
->
script
,
namev
,
ctx
->
ei
,
&
name
);
jsval_release
(
namev
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
obj
);
...
...
dlls/jscript/error.c
View file @
acfd2b98
...
...
@@ -62,7 +62,7 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
return
hres
;
if
(
!
is_undefined
(
v
))
{
hres
=
to_string
_jsval
(
ctx
,
v
,
ei
,
&
name
);
hres
=
to_string
(
ctx
,
v
,
ei
,
&
name
);
jsval_release
(
v
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -75,7 +75,7 @@ static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
hres
=
jsdisp_propget_name
(
jsthis
,
messageW
,
&
v
,
ei
);
if
(
SUCCEEDED
(
hres
))
{
if
(
!
is_undefined
(
v
))
{
hres
=
to_string
_jsval
(
ctx
,
v
,
ei
,
&
msg
);
hres
=
to_string
(
ctx
,
v
,
ei
,
&
msg
);
jsval_release
(
v
);
if
(
SUCCEEDED
(
hres
)
&&
!*
msg
)
{
SysFreeString
(
msg
);
...
...
@@ -235,14 +235,14 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, jsval_
if
(
FAILED
(
hres
))
/* FIXME: really? */
n
=
NAN
;
if
(
isnan
(
n
))
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
msg
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
msg
);
if
(
FAILED
(
hres
))
return
hres
;
num
=
n
;
}
if
(
argc
>
1
&&
!
msg
)
{
hres
=
to_string
_jsval
(
ctx
,
argv
[
1
],
ei
,
&
msg
);
hres
=
to_string
(
ctx
,
argv
[
1
],
ei
,
&
msg
);
if
(
FAILED
(
hres
))
return
hres
;
}
...
...
dlls/jscript/function.c
View file @
acfd2b98
...
...
@@ -711,7 +711,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
if
(
argc
>
2
)
len
=
(
argc
-
2
)
*
2
;
/* separating commas */
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_string
_jsval
(
ctx
,
argv
[
i
],
ei
,
params
+
i
);
hres
=
to_string
(
ctx
,
argv
[
i
],
ei
,
params
+
i
);
if
(
FAILED
(
hres
))
break
;
len
+=
SysStringLen
(
params
[
i
]);
...
...
dlls/jscript/global.c
View file @
acfd2b98
...
...
@@ -297,7 +297,7 @@ static HRESULT JSGlobal_escape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -469,7 +469,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
}
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -536,7 +536,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
val_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -648,7 +648,7 @@ static HRESULT JSGlobal_unescape(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -789,7 +789,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -860,7 +860,7 @@ static HRESULT JSGlobal_decodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -951,7 +951,7 @@ static HRESULT JSGlobal_encodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -1021,7 +1021,7 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/jscript.h
View file @
acfd2b98
...
...
@@ -260,8 +260,7 @@ HRESULT to_number(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_int32
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
INT
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_uint32
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
DWORD
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_string
(
script_ctx_t
*
,
VARIANT
*
,
jsexcept_t
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_string_jsval
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_string
(
script_ctx_t
*
,
jsval_t
,
jsexcept_t
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
to_object
(
script_ctx_t
*
,
VARIANT
*
,
IDispatch
**
)
DECLSPEC_HIDDEN
;
HRESULT
to_object_jsval
(
script_ctx_t
*
,
jsval_t
,
IDispatch
**
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/jsutils.c
View file @
acfd2b98
...
...
@@ -697,6 +697,8 @@ HRESULT double_to_bstr(double n, BSTR *str)
*
str
=
SysAllocString
(
NaNW
);
}
else
if
(
isinf
(
n
))
{
*
str
=
SysAllocString
(
n
<
0
?
InfinityW
:
InfinityW
+
1
);
}
else
if
(
is_int32
(
n
))
{
*
str
=
int_to_bstr
(
n
);
}
else
{
VARIANT
strv
,
v
;
HRESULT
hres
;
...
...
@@ -715,71 +717,48 @@ HRESULT double_to_bstr(double n, BSTR *str)
}
/* ECMA-262 3rd Edition 9.8 */
HRESULT
to_string
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
BSTR
*
str
)
HRESULT
to_string
(
script_ctx_t
*
ctx
,
jsval_t
val
,
jsexcept_t
*
ei
,
BSTR
*
str
)
{
const
WCHAR
undefinedW
[]
=
{
'u'
,
'n'
,
'd'
,
'e'
,
'f'
,
'i'
,
'n'
,
'e'
,
'd'
,
0
};
const
WCHAR
nullW
[]
=
{
'n'
,
'u'
,
'l'
,
'l'
,
0
};
const
WCHAR
trueW
[]
=
{
't'
,
'r'
,
'u'
,
'e'
,
0
};
const
WCHAR
falseW
[]
=
{
'f'
,
'a'
,
'l'
,
's'
,
'e'
,
0
};
switch
(
V_VT
(
v
)
)
{
case
VT_EMPTY
:
switch
(
val
.
type
)
{
case
JSV_UNDEFINED
:
*
str
=
SysAllocString
(
undefinedW
);
break
;
case
VT
_NULL
:
case
JSV
_NULL
:
*
str
=
SysAllocString
(
nullW
);
break
;
case
VT_I4
:
*
str
=
int_to_bstr
(
V_I4
(
v
));
break
;
case
VT_R8
:
return
double_to_bstr
(
V_R8
(
v
),
str
);
case
VT_BSTR
:
*
str
=
SysAllocString
(
V_BSTR
(
v
));
case
JSV_NUMBER
:
return
double_to_bstr
(
get_number
(
val
),
str
);
case
JSV_STRING
:
*
str
=
clone_bstr
(
get_string
(
val
));
break
;
case
VT_DISPATCH
:
{
case
JSV_OBJECT
:
{
jsval_t
prim
;
HRESULT
hres
;
hres
=
to_primitive
(
ctx
,
jsval_disp
(
V_DISPATCH
(
v
))
,
ei
,
&
prim
,
HINT_STRING
);
hres
=
to_primitive
(
ctx
,
val
,
ei
,
&
prim
,
HINT_STRING
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
_jsval
(
ctx
,
prim
,
ei
,
str
);
hres
=
to_string
(
ctx
,
prim
,
ei
,
str
);
jsval_release
(
prim
);
return
hres
;
}
case
VT
_BOOL
:
*
str
=
SysAllocString
(
V_BOOL
(
v
)
?
trueW
:
falseW
);
case
JSV
_BOOL
:
*
str
=
SysAllocString
(
get_bool
(
val
)
?
trueW
:
falseW
);
break
;
default:
FIXME
(
"unsupported
vt %d
\n
"
,
V_VT
(
v
));
FIXME
(
"unsupported
%s
\n
"
,
debugstr_jsval
(
val
));
return
E_NOTIMPL
;
}
return
*
str
?
S_OK
:
E_OUTOFMEMORY
;
}
/* ECMA-262 3rd Edition 9.8 */
HRESULT
to_string_jsval
(
script_ctx_t
*
ctx
,
jsval_t
v
,
jsexcept_t
*
ei
,
BSTR
*
str
)
{
VARIANT
var
;
HRESULT
hres
;
if
(
v
.
type
==
JSV_STRING
)
{
*
str
=
clone_bstr
(
v
.
u
.
str
);
return
*
str
?
S_OK
:
E_OUTOFMEMORY
;
}
hres
=
jsval_to_variant
(
v
,
&
var
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
(
ctx
,
&
var
,
ei
,
str
);
VariantClear
(
&
var
);
return
hres
;
}
/* ECMA-262 3rd Edition 9.9 */
HRESULT
to_object
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
IDispatch
**
disp
)
{
...
...
@@ -909,7 +888,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
case
VT_BSTR
:
{
BSTR
str
;
hres
=
to_string
(
ctx
,
src
,
&
ei
,
&
str
);
hres
=
to_string
(
ctx
,
val
,
&
ei
,
&
str
);
if
(
SUCCEEDED
(
hres
))
V_BSTR
(
dst
)
=
str
;
break
;
...
...
dlls/jscript/number.c
View file @
acfd2b98
...
...
@@ -244,10 +244,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
val
=
number
->
value
;
if
(
radix
==
10
||
isnan
(
val
)
||
isinf
(
val
))
{
VARIANT
v
;
num_set_val
(
&
v
,
val
);
hres
=
to_string
(
ctx
,
&
v
,
ei
,
&
str
);
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -373,10 +370,7 @@ static HRESULT Number_toFixed(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
val
=
number
->
value
;
if
(
isinf
(
val
)
||
isnan
(
val
))
{
VARIANT
v
;
num_set_val
(
&
v
,
val
);
hres
=
to_string
(
ctx
,
&
v
,
ei
,
&
str
);
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -415,10 +409,7 @@ static HRESULT Number_toExponential(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
val
=
number
->
value
;
if
(
isinf
(
val
)
||
isnan
(
val
))
{
VARIANT
v
;
num_set_val
(
&
v
,
val
);
hres
=
to_string
(
ctx
,
&
v
,
ei
,
&
str
);
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -457,10 +448,7 @@ static HRESULT Number_toPrecision(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
val
=
number
->
value
;
if
(
isinf
(
val
)
||
isnan
(
val
)
||
!
prec
)
{
VARIANT
v
;
num_set_val
(
&
v
,
val
);
hres
=
to_string
(
ctx
,
&
v
,
ei
,
&
str
);
hres
=
to_string
(
ctx
,
jsval_number
(
val
),
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
dlls/jscript/object.c
View file @
acfd2b98
...
...
@@ -118,7 +118,7 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
name
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
name
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/regexp.c
View file @
acfd2b98
...
...
@@ -3648,7 +3648,7 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t arg, jsexcep
regexp
=
regexp_from_vdisp
(
jsthis
);
hres
=
to_string
_jsval
(
ctx
,
arg
,
ei
,
&
string
);
hres
=
to_string
(
ctx
,
arg
,
ei
,
&
string
);
if
(
FAILED
(
hres
))
return
hres
;
length
=
SysStringLen
(
string
);
...
...
dlls/jscript/string.c
View file @
acfd2b98
...
...
@@ -81,7 +81,6 @@ static HRESULT get_string_val(script_ctx_t *ctx, vdisp_t *jsthis, jsexcept_t *ei
const
WCHAR
**
str
,
DWORD
*
len
,
BSTR
*
val_str
)
{
StringInstance
*
string
;
VARIANT
this_var
;
HRESULT
hres
;
if
((
string
=
string_this
(
jsthis
)))
{
...
...
@@ -91,9 +90,7 @@ static HRESULT get_string_val(script_ctx_t *ctx, vdisp_t *jsthis, jsexcept_t *ei
return
S_OK
;
}
V_VT
(
&
this_var
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
this_var
)
=
jsthis
->
u
.
disp
;
hres
=
to_string
(
ctx
,
&
this_var
,
ei
,
val_str
);
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
ei
,
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -202,12 +199,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
HRESULT
hres
;
if
(
!
(
string
=
string_this
(
jsthis
)))
{
VARIANT
this
;
V_VT
(
&
this
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
this
)
=
jsthis
->
u
.
disp
;
hres
=
to_string
(
ctx
,
&
this
,
ei
,
&
val_str
);
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
ei
,
&
val_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -220,7 +212,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
}
if
(
argc
)
{
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
attr_value
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
attr_value
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -374,7 +366,6 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
{
BSTR
*
strs
=
NULL
,
ret
=
NULL
;
DWORD
len
=
0
,
i
,
l
,
str_cnt
;
VARIANT
var
;
WCHAR
*
ptr
;
HRESULT
hres
;
...
...
@@ -385,13 +376,10 @@ static HRESULT String_concat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
if
(
!
strs
)
return
E_OUTOFMEMORY
;
V_VT
(
&
var
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
var
)
=
jsthis
->
u
.
disp
;
hres
=
to_string
(
ctx
,
&
var
,
ei
,
strs
);
hres
=
to_string
(
ctx
,
jsval_disp
(
jsthis
->
u
.
disp
),
ei
,
strs
);
if
(
SUCCEEDED
(
hres
))
{
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
hres
=
to_string
_jsval
(
ctx
,
argv
[
i
],
ei
,
strs
+
i
+
1
);
hres
=
to_string
(
ctx
,
argv
[
i
],
ei
,
strs
+
i
+
1
);
if
(
FAILED
(
hres
))
break
;
}
...
...
@@ -471,7 +459,7 @@ static HRESULT String_indexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
search_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
search_str
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -535,7 +523,7 @@ static HRESULT String_lastIndexOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return
S_OK
;
}
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
search_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
search_str
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -612,7 +600,7 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
!
regexp
)
{
BSTR
match_str
;
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
@@ -723,7 +711,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func, const WCHAR *str, mat
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_string
_jsval
(
ctx
,
val
,
ei
,
ret
);
hres
=
to_string
(
ctx
,
val
,
ei
,
ret
);
jsval_release
(
val
);
return
hres
;
}
...
...
@@ -769,7 +757,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
if
(
!
regexp
)
{
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -786,7 +774,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}
if
(
!
rep_func
)
{
hres
=
to_string
_jsval
(
ctx
,
argv
[
1
],
ei
,
&
rep_str
);
hres
=
to_string
(
ctx
,
argv
[
1
],
ei
,
&
rep_str
);
if
(
SUCCEEDED
(
hres
))
{
rep_len
=
SysStringLen
(
rep_str
);
if
(
!
strchrW
(
rep_str
,
'$'
))
...
...
@@ -1130,7 +1118,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
}
if
(
!
use_regexp
)
{
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
match_str
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
...
...
@@ -1559,7 +1547,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
BSTR
str
;
if
(
argc
)
{
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
}
else
{
...
...
@@ -1577,7 +1565,7 @@ static HRESULT StringConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if
(
argc
)
{
BSTR
str
;
hres
=
to_string
_jsval
(
ctx
,
argv
[
0
],
ei
,
&
str
);
hres
=
to_string
(
ctx
,
argv
[
0
],
ei
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
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