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
173c4884
Commit
173c4884
authored
Jan 29, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Implement IXMLDOMCDATASection::deleteData() with tests.
parent
0a866d0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
2 deletions
+112
-2
cdata.c
dlls/msxml3/cdata.c
+41
-2
domdoc.c
dlls/msxml3/tests/domdoc.c
+71
-0
No files found.
dlls/msxml3/cdata.c
View file @
173c4884
...
...
@@ -684,8 +684,47 @@ static HRESULT WINAPI domcdata_deleteData(
IXMLDOMCDATASection
*
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
=
IXMLDOMCDATASection_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
)
IXMLDOMCDATASection_substringData
(
iface
,
count
,
len
-
count
,
&
str
);
else
IXMLDOMCDATASection_substringData
(
iface
,
0
,
offset
,
&
str
);
hr
=
IXMLDOMCDATASection_put_data
(
iface
,
str
);
}
else
/* cutting from the inside */
{
BSTR
str_end
;
IXMLDOMCDATASection_substringData
(
iface
,
0
,
offset
,
&
str
);
IXMLDOMCDATASection_substringData
(
iface
,
offset
+
count
,
len
-
count
,
&
str_end
);
hr
=
IXMLDOMCDATASection_put_data
(
iface
,
str
);
if
(
hr
==
S_OK
)
hr
=
IXMLDOMCDATASection_appendData
(
iface
,
str_end
);
SysFreeString
(
str_end
);
}
SysFreeString
(
str
);
return
hr
;
}
static
HRESULT
WINAPI
domcdata_replaceData
(
...
...
dlls/msxml3/tests/domdoc.c
View file @
173c4884
...
...
@@ -3340,6 +3340,77 @@ 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
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
-
1
,
1
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
0
,
0
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
0
,
-
1
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_get_length
(
pCDataSec
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
43
,
"expected 43 got %d
\n
"
,
len
);
hr
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
len
,
1
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
len
+
1
,
1
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
/* delete from start */
hr
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
0
,
5
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_get_length
(
pCDataSec
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
38
,
"expected 38 got %d
\n
"
,
len
);
hr
=
IXMLDOMCDATASection_get_text
(
pCDataSec
,
&
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
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
35
,
3
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_get_length
(
pCDataSec
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
35
,
"expected 35 got %d
\n
"
,
len
);
hr
=
IXMLDOMCDATASection_get_text
(
pCDataSec
,
&
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
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
1
,
33
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_get_length
(
pCDataSec
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
2
,
"expected 2 got %d
\n
"
,
len
);
hr
=
IXMLDOMCDATASection_get_text
(
pCDataSec
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
" "
)
),
"incorrect get_text string
\n
"
);
SysFreeString
(
str
);
/* delete whole data ... */
hr
=
IXMLDOMCDATASection_get_length
(
pCDataSec
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
0
,
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
/* ... and try again with empty string */
hr
=
IXMLDOMCDATASection_deleteData
(
pCDataSec
,
0
,
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
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