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
03695384
Commit
03695384
authored
Mar 10, 2008
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Mar 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Implemented IXMLDOMText_insertData.
parent
b77af270
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
2 deletions
+105
-2
domdoc.c
dlls/msxml3/tests/domdoc.c
+41
-0
text.c
dlls/msxml3/text.c
+64
-2
No files found.
dlls/msxml3/tests/domdoc.c
View file @
03695384
...
...
@@ -653,6 +653,47 @@ static void test_domdoc( void )
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"This &is a ; test <>
\\
Append"
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
/* test insertData */
str
=
SysAllocStringLen
(
NULL
,
0
);
r
=
IXMLDOMText_insertData
(
nodetext
,
-
1
,
str
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
-
1
,
NULL
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
1000
,
str
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
1000
,
NULL
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
0
,
NULL
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
0
,
str
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
SysFreeString
(
str
);
r
=
IXMLDOMText_insertData
(
nodetext
,
-
1
,
_bstr_
(
"Inserting"
));
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
1000
,
_bstr_
(
"Inserting"
));
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
0
,
_bstr_
(
"Begin "
));
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
17
,
_bstr_
(
"Middle"
));
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_insertData
(
nodetext
,
39
,
_bstr_
(
" End"
));
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMText_get_text
(
nodetext
,
&
str
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"Begin This &is a Middle; test <>
\\
Append End"
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
IXMLDOMText_Release
(
nodetext
);
}
SysFreeString
(
str
);
...
...
dlls/msxml3/text.c
View file @
03695384
...
...
@@ -2,6 +2,7 @@
* DOM text node implementation
*
* Copyright 2006 Huw Davies
* Copyright 2007-2008 Alistair Leslie-Hughes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -617,8 +618,69 @@ static HRESULT WINAPI domtext_insertData(
IXMLDOMText
*
iface
,
long
offset
,
BSTR
p
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
domtext
*
This
=
impl_from_IXMLDOMText
(
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
domtext_deleteData
(
...
...
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