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
6eaef96d
Commit
6eaef96d
authored
Mar 06, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Reimplemented do_attribute_tag_format without direct access to object's string buffer.
parent
25dbf32b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
string.c
dlls/jscript/string.c
+31
-8
No files found.
dlls/jscript/string.c
View file @
6eaef96d
...
...
@@ -186,14 +186,11 @@ static HRESULT do_attributeless_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, j
}
static
HRESULT
do_attribute_tag_format
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
,
const
WCHAR
*
tagname
,
const
WCHAR
*
attr
)
const
WCHAR
*
tagname
,
const
WCHAR
*
attr
name
)
{
static
const
WCHAR
tagfmtW
[]
=
{
'<'
,
'%'
,
's'
,
' '
,
'%'
,
's'
,
'='
,
'\"'
,
'%'
,
's'
,
'\"'
,
'>'
,
'%'
,
's'
,
'<'
,
'/'
,
'%'
,
's'
,
'>'
,
0
};
static
const
WCHAR
undefinedW
[]
=
{
'u'
,
'n'
,
'd'
,
'e'
,
'f'
,
'i'
,
'n'
,
'e'
,
'd'
,
0
};
jsstr_t
*
str
,
*
attr_value
=
NULL
;
const
WCHAR
*
attr_str
;
unsigned
attr_len
;
HRESULT
hres
;
...
...
@@ -207,19 +204,45 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, unsig
jsstr_release
(
str
);
return
hres
;
}
attr_str
=
attr_value
->
str
;
attr_len
=
jsstr_length
(
attr_value
);
}
else
{
attr_str
=
undefinedW
;
attr_len
=
sizeof
(
undefinedW
)
/
sizeof
(
WCHAR
)
-
1
;
}
if
(
r
)
{
unsigned
attrname_len
=
strlenW
(
attrname
);
unsigned
tagname_len
=
strlenW
(
tagname
);
jsstr_t
*
ret
;
ret
=
jsstr_alloc_buf
(
2
*
strlenW
(
tagname
)
+
strlenW
(
attr
)
+
attr_len
+
jsstr_length
(
str
)
+
9
);
ret
=
jsstr_alloc_buf
(
2
*
tagname_len
+
attrname_len
+
attr_len
+
jsstr_length
(
str
)
+
9
);
if
(
ret
)
{
sprintfW
(
ret
->
str
,
tagfmtW
,
tagname
,
attr
,
attr_str
,
str
->
str
,
tagname
);
WCHAR
*
ptr
=
ret
->
str
;
*
ptr
++
=
'<'
;
memcpy
(
ptr
,
tagname
,
tagname_len
*
sizeof
(
WCHAR
));
ptr
+=
tagname_len
;
*
ptr
++
=
' '
;
memcpy
(
ptr
,
attrname
,
attrname_len
*
sizeof
(
WCHAR
));
ptr
+=
attrname_len
;
*
ptr
++
=
'='
;
*
ptr
++
=
'"'
;
if
(
attr_value
)
jsstr_flush
(
attr_value
,
ptr
);
else
memcpy
(
ptr
,
undefinedW
,
attr_len
*
sizeof
(
WCHAR
));
ptr
+=
attr_len
;
*
ptr
++
=
'"'
;
*
ptr
++
=
'>'
;
ptr
+=
jsstr_flush
(
str
,
ptr
);
*
ptr
++
=
'<'
;
*
ptr
++
=
'/'
;
memcpy
(
ptr
,
tagname
,
tagname_len
*
sizeof
(
WCHAR
));
ptr
+=
tagname_len
;
*
ptr
=
'>'
;
*
r
=
jsval_string
(
ret
);
}
else
{
hres
=
E_OUTOFMEMORY
;
...
...
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