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
88d82187
Commit
88d82187
authored
Feb 16, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 16, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Simplify ::insertData() for Text, Comment and CDATA nodes.
parent
b8282638
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
124 deletions
+61
-124
cdata.c
dlls/msxml3/cdata.c
+22
-43
comment.c
dlls/msxml3/comment.c
+20
-41
text.c
dlls/msxml3/text.c
+19
-40
No files found.
dlls/msxml3/cdata.c
View file @
88d82187
...
...
@@ -585,10 +585,10 @@ static HRESULT WINAPI domcdata_appendData(
xmlChar
*
pContent
;
HRESULT
hr
=
S_FALSE
;
TRACE
(
"%p
\n
"
,
iface
);
TRACE
(
"%p
%p
\n
"
,
This
,
debugstr_w
(
p
)
);
/* Nothing to do if NULL or an Empty string passed in. */
if
(
p
==
NULL
||
SysStringLen
(
p
)
==
0
)
if
(
SysStringLen
(
p
)
==
0
)
return
S_OK
;
pContent
=
xmlChar_from_wchar
(
p
);
...
...
@@ -611,16 +611,14 @@ static HRESULT WINAPI domcdata_insertData(
LONG
offset
,
BSTR
p
)
{
domcdata
*
This
=
impl_from_IXMLDOMCDATASection
(
iface
);
xmlChar
*
pXmlContent
;
BSTR
sNewString
;
HRESULT
hr
=
S_FALSE
;
LONG
nLength
=
0
,
nLengthP
=
0
;
xmlChar
*
str
=
NULL
;
HRESULT
hr
;
BSTR
data
;
LONG
p_len
;
TRACE
(
"%p
\n
"
,
This
);
TRACE
(
"%p
%d %s
\n
"
,
This
,
offset
,
debugstr_w
(
p
)
);
/* If have a NULL or empty string, don't do anything. */
if
(
SysStringLen
(
p
)
==
0
)
if
(
(
p_len
=
SysStringLen
(
p
)
)
==
0
)
return
S_OK
;
if
(
offset
<
0
)
...
...
@@ -628,48 +626,29 @@ static HRESULT WINAPI domcdata_insertData(
return
E_INVALIDARG
;
}
pXmlContent
=
xmlNodeGetContent
(
This
->
node
.
node
);
if
(
pXmlContent
)
hr
=
IXMLDOMCDATASection_get_data
(
iface
,
&
data
);
if
(
hr
==
S_OK
)
{
BSTR
sContent
=
bstr_from_xmlChar
(
pXmlContent
);
nLength
=
SysStringLen
(
sContent
);
nLengthP
=
SysStringLen
(
p
);
LONG
len
=
SysStringLen
(
data
);
BSTR
str
;
if
(
nLength
<
offset
)
if
(
len
<
offset
)
{
SysFreeString
(
sContent
);
xmlFree
(
pXmlContent
);
SysFreeString
(
data
);
return
E_INVALIDARG
;
}
sNewString
=
SysAllocStringLen
(
NULL
,
nLength
+
nLengthP
+
1
);
if
(
sNewString
)
{
if
(
offset
>
0
)
memcpy
(
sNewString
,
sContent
,
offset
*
sizeof
(
WCHAR
));
memcpy
(
&
sNewString
[
offset
],
p
,
nLengthP
*
sizeof
(
WCHAR
));
if
(
offset
+
nLengthP
<
nLength
)
memcpy
(
&
sNewString
[
offset
+
nLengthP
],
&
sContent
[
offset
],
(
nLength
-
offset
)
*
sizeof
(
WCHAR
));
sNewString
[
nLengthP
+
nLength
]
=
0
;
str
=
xmlChar_from_wchar
(
sNewString
);
if
(
str
)
{
xmlNodeSetContent
(
This
->
node
.
node
,
str
);
hr
=
S_OK
;
}
heap_free
(
str
);
str
=
SysAllocStringLen
(
NULL
,
len
+
p_len
);
/* start part, supplied string and end part */
memcpy
(
str
,
data
,
offset
*
sizeof
(
WCHAR
));
memcpy
(
&
str
[
offset
],
p
,
p_len
*
sizeof
(
WCHAR
));
memcpy
(
&
str
[
offset
+
p_len
],
&
data
[
offset
],
(
len
-
offset
)
*
sizeof
(
WCHAR
));
str
[
len
+
p_len
]
=
0
;
SysFreeString
(
sNewString
);
}
SysFreeString
(
sContent
);
hr
=
IXMLDOMCDATASection_put_data
(
iface
,
str
);
xmlFree
(
pXmlContent
);
SysFreeString
(
str
);
SysFreeString
(
data
);
}
return
hr
;
...
...
dlls/msxml3/comment.c
View file @
88d82187
...
...
@@ -619,16 +619,14 @@ static HRESULT WINAPI domcomment_insertData(
LONG
offset
,
BSTR
p
)
{
domcomment
*
This
=
impl_from_IXMLDOMComment
(
iface
);
xmlChar
*
pXmlContent
;
BSTR
sNewString
;
HRESULT
hr
=
S_FALSE
;
LONG
nLength
=
0
,
nLengthP
=
0
;
xmlChar
*
str
=
NULL
;
HRESULT
hr
;
BSTR
data
;
LONG
p_len
;
TRACE
(
"%p %d %
p
\n
"
,
iface
,
offset
,
p
);
TRACE
(
"%p %d %
s
\n
"
,
This
,
offset
,
debugstr_w
(
p
)
);
/* If have a NULL or empty string, don't do anything. */
if
(
SysStringLen
(
p
)
==
0
)
if
(
(
p_len
=
SysStringLen
(
p
)
)
==
0
)
return
S_OK
;
if
(
offset
<
0
)
...
...
@@ -636,48 +634,29 @@ static HRESULT WINAPI domcomment_insertData(
return
E_INVALIDARG
;
}
pXmlContent
=
xmlNodeGetContent
(
This
->
node
.
node
);
if
(
pXmlContent
)
hr
=
IXMLDOMComment_get_data
(
iface
,
&
data
);
if
(
hr
==
S_OK
)
{
BSTR
sContent
=
bstr_from_xmlChar
(
pXmlContent
);
nLength
=
SysStringLen
(
sContent
);
nLengthP
=
SysStringLen
(
p
);
LONG
len
=
SysStringLen
(
data
);
BSTR
str
;
if
(
nLength
<
offset
)
if
(
len
<
offset
)
{
SysFreeString
(
sContent
);
xmlFree
(
pXmlContent
);
SysFreeString
(
data
);
return
E_INVALIDARG
;
}
sNewString
=
SysAllocStringLen
(
NULL
,
nLength
+
nLengthP
+
1
);
if
(
sNewString
)
{
if
(
offset
>
0
)
memcpy
(
sNewString
,
sContent
,
offset
*
sizeof
(
WCHAR
));
memcpy
(
&
sNewString
[
offset
],
p
,
nLengthP
*
sizeof
(
WCHAR
));
if
(
offset
+
nLengthP
<
nLength
)
memcpy
(
&
sNewString
[
offset
+
nLengthP
],
&
sContent
[
offset
],
(
nLength
-
offset
)
*
sizeof
(
WCHAR
));
str
=
SysAllocStringLen
(
NULL
,
len
+
p_len
);
/* start part, supplied string and end part */
memcpy
(
str
,
data
,
offset
*
sizeof
(
WCHAR
));
memcpy
(
&
str
[
offset
],
p
,
p_len
*
sizeof
(
WCHAR
));
memcpy
(
&
str
[
offset
+
p_len
],
&
data
[
offset
],
(
len
-
offset
)
*
sizeof
(
WCHAR
));
str
[
len
+
p_len
]
=
0
;
sNewString
[
nLengthP
+
nLength
]
=
0
;
str
=
xmlChar_from_wchar
(
sNewString
);
if
(
str
)
{
xmlNodeSetContent
(
This
->
node
.
node
,
str
);
hr
=
S_OK
;
}
HeapFree
(
GetProcessHeap
(),
0
,
str
);
SysFreeString
(
sNewString
);
}
SysFreeString
(
sContent
);
hr
=
IXMLDOMComment_put_data
(
iface
,
str
);
xmlFree
(
pXmlContent
);
SysFreeString
(
str
);
SysFreeString
(
data
);
}
return
hr
;
...
...
dlls/msxml3/text.c
View file @
88d82187
...
...
@@ -612,16 +612,14 @@ static HRESULT WINAPI domtext_insertData(
LONG
offset
,
BSTR
p
)
{
domtext
*
This
=
impl_from_IXMLDOMText
(
iface
);
xmlChar
*
pXmlContent
;
BSTR
sNewString
;
HRESULT
hr
=
S_FALSE
;
LONG
nLength
=
0
,
nLengthP
=
0
;
xmlChar
*
str
=
NULL
;
HRESULT
hr
;
BSTR
data
;
LONG
p_len
;
TRACE
(
"%p %d %s
\n
"
,
This
,
offset
,
debugstr_w
(
p
));
/* If have a NULL or empty string, don't do anything. */
if
(
SysStringLen
(
p
)
==
0
)
if
(
(
p_len
=
SysStringLen
(
p
)
)
==
0
)
return
S_OK
;
if
(
offset
<
0
)
...
...
@@ -629,48 +627,29 @@ static HRESULT WINAPI domtext_insertData(
return
E_INVALIDARG
;
}
pXmlContent
=
xmlNodeGetContent
(
This
->
node
.
node
);
if
(
pXmlContent
)
hr
=
IXMLDOMText_get_data
(
iface
,
&
data
);
if
(
hr
==
S_OK
)
{
BSTR
sContent
=
bstr_from_xmlChar
(
pXmlContent
);
nLength
=
SysStringLen
(
sContent
);
nLengthP
=
SysStringLen
(
p
);
LONG
len
=
SysStringLen
(
data
);
BSTR
str
;
if
(
nLength
<
offset
)
if
(
len
<
offset
)
{
SysFreeString
(
sContent
);
xmlFree
(
pXmlContent
);
SysFreeString
(
data
);
return
E_INVALIDARG
;
}
sNewString
=
SysAllocStringLen
(
NULL
,
nLength
+
nLengthP
+
1
);
if
(
sNewString
)
{
if
(
offset
>
0
)
memcpy
(
sNewString
,
sContent
,
offset
*
sizeof
(
WCHAR
));
memcpy
(
&
sNewString
[
offset
],
p
,
nLengthP
*
sizeof
(
WCHAR
));
if
(
offset
+
nLengthP
<
nLength
)
memcpy
(
&
sNewString
[
offset
+
nLengthP
],
&
sContent
[
offset
],
(
nLength
-
offset
)
*
sizeof
(
WCHAR
));
sNewString
[
nLengthP
+
nLength
]
=
0
;
str
=
xmlChar_from_wchar
(
sNewString
);
if
(
str
)
{
xmlNodeSetContent
(
This
->
node
.
node
,
str
);
hr
=
S_OK
;
}
heap_free
(
str
);
str
=
SysAllocStringLen
(
NULL
,
len
+
p_len
);
/* start part, supplied string and end part */
memcpy
(
str
,
data
,
offset
*
sizeof
(
WCHAR
));
memcpy
(
&
str
[
offset
],
p
,
p_len
*
sizeof
(
WCHAR
));
memcpy
(
&
str
[
offset
+
p_len
],
&
data
[
offset
],
(
len
-
offset
)
*
sizeof
(
WCHAR
));
str
[
len
+
p_len
]
=
0
;
SysFreeString
(
sNewString
);
}
SysFreeString
(
sContent
);
hr
=
IXMLDOMText_put_data
(
iface
,
str
);
xmlFree
(
pXmlContent
);
SysFreeString
(
str
);
SysFreeString
(
data
);
}
return
hr
;
...
...
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