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
8746e387
Commit
8746e387
authored
Mar 13, 2008
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Mar 13, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Implemented IXMLDOMCDATASection_insertData.
parent
9b3234eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
2 deletions
+104
-2
cdata.c
dlls/msxml3/cdata.c
+63
-2
domdoc.c
dlls/msxml3/tests/domdoc.c
+41
-0
No files found.
dlls/msxml3/cdata.c
View file @
8746e387
...
...
@@ -616,8 +616,69 @@ static HRESULT WINAPI domcdata_insertData(
IXMLDOMCDATASection
*
iface
,
long
offset
,
BSTR
p
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
domcdata
*
This
=
impl_from_IXMLDOMCDATASection
(
iface
);
xmlnode
*
pDOMNode
=
impl_from_IXMLDOMNode
(
(
IXMLDOMNode
*
)
This
->
element
);
xmlChar
*
pXmlContent
;
BSTR
sNewString
;
HRESULT
hr
=
S_FALSE
;
long
nLength
=
0
,
nLengthP
=
0
;
xmlChar
*
str
=
NULL
;
TRACE
(
"%p
\n
"
,
This
);
/* If have a NULL or empty string, dont do anything. */
if
(
SysStringLen
(
p
)
==
0
)
return
S_OK
;
if
(
offset
<
0
)
{
return
E_INVALIDARG
;
}
pXmlContent
=
xmlNodeGetContent
(
pDOMNode
->
node
);
if
(
pXmlContent
)
{
BSTR
sContent
=
bstr_from_xmlChar
(
pXmlContent
);
nLength
=
SysStringLen
(
sContent
);
nLengthP
=
SysStringLen
(
p
);
if
(
nLength
<
offset
)
{
SysFreeString
(
sContent
);
xmlFree
(
pXmlContent
);
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
((
WCHAR
*
)
sNewString
);
if
(
str
)
{
xmlNodeSetContent
(
pDOMNode
->
node
,
str
);
hr
=
S_OK
;
}
SysFreeString
(
sNewString
);
}
SysFreeString
(
sContent
);
xmlFree
(
pXmlContent
);
}
return
hr
;
}
static
HRESULT
WINAPI
domcdata_deleteData
(
...
...
dlls/msxml3/tests/domdoc.c
View file @
8746e387
...
...
@@ -2578,6 +2578,47 @@ static void test_xmlTypes(void)
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"This &is a ; test <>
\\
Append"
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
/* test insertData */
str
=
SysAllocStringLen
(
NULL
,
0
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
-
1
,
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
-
1
,
NULL
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
1000
,
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
1000
,
NULL
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
0
,
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
SysFreeString
(
str
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
-
1
,
_bstr_
(
"Inserting"
));
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
1000
,
_bstr_
(
"Inserting"
));
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
0
,
_bstr_
(
"Begin "
));
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
17
,
_bstr_
(
"Middle"
));
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_insertData
(
pCDataSec
,
39
,
_bstr_
(
" End"
));
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_get_text
(
pCDataSec
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"Begin This &is a Middle; test <>
\\
Append End"
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
IXMLDOMCDATASection_Release
(
pCDataSec
);
}
...
...
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