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
5f72a885
Commit
5f72a885
authored
Jan 19, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Implement IXMLDOMComment::deleteData() with tests.
parent
dfc4f8e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
5 deletions
+114
-5
comment.c
dlls/msxml3/comment.c
+44
-5
domdoc.c
dlls/msxml3/tests/domdoc.c
+70
-0
No files found.
dlls/msxml3/comment.c
View file @
5f72a885
...
...
@@ -541,7 +541,7 @@ static HRESULT WINAPI domcomment_substringData(
LONG
nLength
=
0
;
HRESULT
hr
=
S_FALSE
;
TRACE
(
"%p
\n
"
,
iface
);
TRACE
(
"%p
%d %d %p
\n
"
,
iface
,
offset
,
count
,
p
);
if
(
!
p
)
return
E_INVALIDARG
;
...
...
@@ -551,7 +551,7 @@ static HRESULT WINAPI domcomment_substringData(
return
E_INVALIDARG
;
if
(
count
==
0
)
return
hr
;
return
S_FALSE
;
pContent
=
xmlNodeGetContent
(
This
->
node
.
node
);
if
(
pContent
)
...
...
@@ -630,7 +630,7 @@ static HRESULT WINAPI domcomment_insertData(
LONG
nLength
=
0
,
nLengthP
=
0
;
xmlChar
*
str
=
NULL
;
TRACE
(
"%p
\n
"
,
This
);
TRACE
(
"%p
%d %p
\n
"
,
iface
,
offset
,
p
);
/* If have a NULL or empty string, don't do anything. */
if
(
SysStringLen
(
p
)
==
0
)
...
...
@@ -692,8 +692,47 @@ static HRESULT WINAPI domcomment_deleteData(
IXMLDOMComment
*
iface
,
LONG
offset
,
LONG
count
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
HRESULT
hr
;
LONG
len
=
-
1
;
BSTR
str
;
TRACE
(
"%p %d %d
\n
"
,
iface
,
offset
,
count
);
hr
=
IXMLDOMComment_get_length
(
iface
,
&
len
);
if
(
hr
!=
S_OK
)
return
hr
;
if
((
offset
<
0
)
||
(
offset
>
len
)
||
(
count
<
0
))
return
E_INVALIDARG
;
if
(
len
==
0
)
return
S_OK
;
/* cutting start or end */
if
((
offset
==
0
)
||
((
count
+
offset
)
>=
len
))
{
if
(
offset
==
0
)
IXMLDOMComment_substringData
(
iface
,
count
,
len
-
count
,
&
str
);
else
IXMLDOMComment_substringData
(
iface
,
0
,
offset
,
&
str
);
hr
=
IXMLDOMComment_put_data
(
iface
,
str
);
}
else
/* cutting from the inside */
{
BSTR
str_end
;
IXMLDOMComment_substringData
(
iface
,
0
,
offset
,
&
str
);
IXMLDOMComment_substringData
(
iface
,
offset
+
count
,
len
-
count
,
&
str_end
);
hr
=
IXMLDOMComment_put_data
(
iface
,
str
);
if
(
hr
==
S_OK
)
hr
=
IXMLDOMComment_appendData
(
iface
,
str_end
);
SysFreeString
(
str_end
);
}
SysFreeString
(
str
);
return
hr
;
}
static
HRESULT
WINAPI
domcomment_replaceData
(
...
...
dlls/msxml3/tests/domdoc.c
View file @
5f72a885
...
...
@@ -2927,6 +2927,76 @@ static void test_xmlTypes(void)
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"Begin This &is a Middle; test <>
\\
Append End"
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
/* delete data */
/* invalid arguments */
hr
=
IXMLDOMComment_deleteData
(
pComment
,
-
1
,
1
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMComment_deleteData
(
pComment
,
0
,
0
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMComment_deleteData
(
pComment
,
0
,
-
1
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMComment_get_length
(
pComment
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
43
,
"expected 43 got %d
\n
"
,
len
);
hr
=
IXMLDOMComment_deleteData
(
pComment
,
len
,
1
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMComment_deleteData
(
pComment
,
len
+
1
,
1
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
/* delete from start */
hr
=
IXMLDOMComment_deleteData
(
pComment
,
0
,
5
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMComment_get_length
(
pComment
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
38
,
"expected 38 got %d
\n
"
,
len
);
hr
=
IXMLDOMComment_get_text
(
pComment
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
" This &is a Middle; test <>
\\
Append End"
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
/* delete from end */
hr
=
IXMLDOMComment_deleteData
(
pComment
,
35
,
3
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMComment_get_length
(
pComment
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
35
,
"expected 35 got %d
\n
"
,
len
);
hr
=
IXMLDOMComment_get_text
(
pComment
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
" This &is a Middle; test <>
\\
Append "
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
/* delete from inside */
hr
=
IXMLDOMComment_deleteData
(
pComment
,
1
,
33
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMComment_get_length
(
pComment
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
2
,
"expected 2 got %d
\n
"
,
len
);
hr
=
IXMLDOMComment_get_text
(
pComment
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
" "
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
/* delete whole data ... */
hr
=
IXMLDOMComment_get_length
(
pComment
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMComment_deleteData
(
pComment
,
0
,
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
/* ... and try again with empty string */
hr
=
IXMLDOMComment_deleteData
(
pComment
,
0
,
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
IXMLDOMComment_Release
(
pComment
);
}
...
...
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