Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
7828df17
Commit
7828df17
authored
Jan 24, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Introduce jsstr_to_bstr helper.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
31c57484
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
27 deletions
+15
-27
jsstr.c
dlls/jscript/jsstr.c
+11
-2
jsstr.h
dlls/jscript/jsstr.h
+1
-1
jsutils.c
dlls/jscript/jsutils.c
+3
-24
No files found.
dlls/jscript/jsstr.c
View file @
7828df17
...
...
@@ -299,9 +299,18 @@ jsstr_t *jsstr_null_bstr(void)
return
jsstr_addref
(
null_bstr_str
);
}
BOOL
is_null_bstr
(
jsstr_t
*
st
r
)
HRESULT
jsstr_to_bstr
(
jsstr_t
*
str
,
BSTR
*
r
)
{
return
str
==
null_bstr_str
;
if
(
str
==
null_bstr_str
)
{
*
r
=
NULL
;
return
S_OK
;
}
if
(
!
(
*
r
=
SysAllocStringLen
(
NULL
,
jsstr_length
(
str
))))
return
E_OUTOFMEMORY
;
jsstr_flush
(
str
,
*
r
);
return
S_OK
;
}
BOOL
init_strings
(
void
)
...
...
dlls/jscript/jsstr.h
View file @
7828df17
...
...
@@ -182,7 +182,7 @@ jsstr_t *jsstr_empty(void) DECLSPEC_HIDDEN;
jsstr_t
*
jsstr_undefined
(
void
)
DECLSPEC_HIDDEN
;
jsstr_t
*
jsstr_null_bstr
(
void
)
DECLSPEC_HIDDEN
;
BOOL
is_null_bstr
(
jsstr_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsstr_to_bstr
(
jsstr_t
*
str
,
BSTR
*
r
)
DECLSPEC_HIDDEN
;
BOOL
init_strings
(
void
)
DECLSPEC_HIDDEN
;
void
free_strings
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/jsutils.c
View file @
7828df17
...
...
@@ -355,21 +355,9 @@ HRESULT jsval_to_variant(jsval_t val, VARIANT *retv)
IDispatch_AddRef
(
get_object
(
val
));
V_DISPATCH
(
retv
)
=
get_object
(
val
);
return
S_OK
;
case
JSV_STRING
:
{
jsstr_t
*
str
=
get_string
(
val
);
case
JSV_STRING
:
V_VT
(
retv
)
=
VT_BSTR
;
if
(
is_null_bstr
(
str
))
{
V_BSTR
(
retv
)
=
NULL
;
}
else
{
V_BSTR
(
retv
)
=
SysAllocStringLen
(
NULL
,
jsstr_length
(
str
));
if
(
V_BSTR
(
retv
))
jsstr_flush
(
str
,
V_BSTR
(
retv
));
else
return
E_OUTOFMEMORY
;
}
return
S_OK
;
}
return
jsstr_to_bstr
(
get_string
(
val
),
&
V_BSTR
(
retv
));
case
JSV_NUMBER
:
{
double
n
=
get_number
(
val
);
...
...
@@ -945,16 +933,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
if
(
FAILED
(
hres
))
break
;
if
(
is_null_bstr
(
str
))
{
V_BSTR
(
dst
)
=
NULL
;
break
;
}
V_BSTR
(
dst
)
=
SysAllocStringLen
(
NULL
,
jsstr_length
(
str
));
if
(
V_BSTR
(
dst
))
jsstr_flush
(
str
,
V_BSTR
(
dst
));
else
hres
=
E_OUTOFMEMORY
;
hres
=
jsstr_to_bstr
(
str
,
&
V_BSTR
(
dst
));
break
;
}
case
VT_EMPTY
:
...
...
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