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
df5e40ec
Commit
df5e40ec
authored
Jul 31, 2008
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 01, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Reorganize parse_buffer function (make use of libxml2 parserInternals.h).
parent
7abfbd08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
25 deletions
+18
-25
saxreader.c
dlls/msxml3/saxreader.c
+18
-25
No files found.
dlls/msxml3/saxreader.c
View file @
df5e40ec
...
...
@@ -44,6 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
#ifdef HAVE_LIBXML2
#include <libxml/SAX2.h>
#include <libxml/parserInternals.h>
typedef
struct
_saxreader
{
...
...
@@ -151,6 +152,12 @@ static void update_position(saxlocator *This, xmlChar *end)
This
->
line
=
1
;
This
->
column
=
1
;
}
else
if
(
This
->
lastCur
<
This
->
pParserCtxt
->
input
->
base
)
{
This
->
lastCur
=
(
xmlChar
*
)
This
->
pParserCtxt
->
input
->
base
;
This
->
line
=
1
;
This
->
column
=
1
;
}
if
(
!
end
)
end
=
(
xmlChar
*
)
This
->
pParserCtxt
->
input
->
cur
;
...
...
@@ -1468,7 +1475,7 @@ static HRESULT WINAPI isaxxmlreader_putSecureBaseURL(
return
E_NOTIMPL
;
}
static
HRESULT
parse_buffer
(
saxreader
*
This
,
xmlChar
*
buffer
)
static
HRESULT
parse_buffer
(
saxreader
*
This
,
const
char
*
buffer
,
int
size
)
{
saxlocator
*
locator
;
HRESULT
hr
;
...
...
@@ -1477,7 +1484,7 @@ static HRESULT parse_buffer(saxreader *This, xmlChar *buffer)
if
(
FAILED
(
hr
))
return
E_FAIL
;
locator
->
pParserCtxt
=
xml
NewParserCtxt
(
);
locator
->
pParserCtxt
=
xml
CreateMemoryParserCtxt
(
buffer
,
size
);
if
(
!
locator
->
pParserCtxt
)
{
ISAXLocator_Release
((
ISAXLocator
*
)
&
locator
->
lpSAXLocatorVtbl
);
...
...
@@ -1487,8 +1494,6 @@ static HRESULT parse_buffer(saxreader *This, xmlChar *buffer)
locator
->
pParserCtxt
->
sax
=
&
locator
->
saxreader
->
sax
;
locator
->
pParserCtxt
->
userData
=
locator
;
xmlSetupParserForBuffer
(
locator
->
pParserCtxt
,
buffer
,
NULL
);
if
(
xmlParseDocument
(
locator
->
pParserCtxt
))
hr
=
E_FAIL
;
else
hr
=
locator
->
ret
;
...
...
@@ -1508,7 +1513,6 @@ static HRESULT WINAPI isaxxmlreader_parse(
VARIANT
varInput
)
{
saxreader
*
This
=
impl_from_ISAXXMLReader
(
iface
);
xmlChar
*
data
=
NULL
;
HRESULT
hr
;
TRACE
(
"(%p)
\n
"
,
This
);
...
...
@@ -1517,8 +1521,8 @@ static HRESULT WINAPI isaxxmlreader_parse(
switch
(
V_VT
(
&
varInput
))
{
case
VT_BSTR
:
data
=
xmlChar_from_wchar
(
V_BSTR
(
&
varInput
));
hr
=
parse_buffer
(
This
,
data
);
hr
=
parse_buffer
(
This
,
(
const
char
*
)
V_BSTR
(
&
varInput
),
SysStringByteLen
(
V_BSTR
(
&
varInput
))
);
break
;
case
VT_ARRAY
|
VT_UI1
:
{
void
*
pSAData
;
...
...
@@ -1530,13 +1534,9 @@ static HRESULT WINAPI isaxxmlreader_parse(
hr
=
SafeArrayGetUBound
(
V_ARRAY
(
&
varInput
),
1
,
&
uBound
);
if
(
hr
!=
S_OK
)
break
;
dataRead
=
(
uBound
-
lBound
)
*
SafeArrayGetElemsize
(
V_ARRAY
(
&
varInput
));
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dataRead
+
1
);
if
(
!
data
)
break
;
hr
=
SafeArrayAccessData
(
V_ARRAY
(
&
varInput
),
(
void
**
)
&
pSAData
);
if
(
hr
!=
S_OK
)
break
;
memcpy
(
data
,
pSAData
,
dataRead
);
data
[
dataRead
]
=
'\0'
;
hr
=
parse_buffer
(
This
,
data
);
hr
=
parse_buffer
(
This
,
pSAData
,
dataRead
);
SafeArrayUnaccessData
(
V_ARRAY
(
&
varInput
));
break
;
}
...
...
@@ -1558,6 +1558,7 @@ static HRESULT WINAPI isaxxmlreader_parse(
{
STATSTG
dataInfo
;
ULONG
dataRead
;
char
*
data
;
while
(
1
)
{
...
...
@@ -1566,7 +1567,7 @@ static HRESULT WINAPI isaxxmlreader_parse(
break
;
}
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dataInfo
.
cbSize
.
QuadPart
+
1
);
dataInfo
.
cbSize
.
QuadPart
);
while
(
1
)
{
hr
=
IStream_Read
(
stream
,
data
,
...
...
@@ -1574,8 +1575,8 @@ static HRESULT WINAPI isaxxmlreader_parse(
if
(
hr
==
E_PENDING
)
continue
;
break
;
}
data
[
dataInfo
.
cbSize
.
QuadPart
]
=
'\0'
;
hr
=
parse_buffer
(
This
,
data
);
hr
=
parse_buffer
(
This
,
data
,
dataInfo
.
cbSize
.
QuadPart
)
;
HeapFree
(
GetProcessHeap
(),
0
,
data
);
IStream_Release
(
stream
);
break
;
}
...
...
@@ -1585,8 +1586,7 @@ static HRESULT WINAPI isaxxmlreader_parse(
BSTR
bstrData
;
IXMLDOMDocument_get_xml
(
xmlDoc
,
&
bstrData
);
data
=
xmlChar_from_wchar
(
bstrData
);
hr
=
parse_buffer
(
This
,
data
);
hr
=
parse_buffer
(
This
,
(
const
char
*
)
bstrData
,
SysStringByteLen
(
bstrData
));
IXMLDOMDocument_Release
(
xmlDoc
);
hr
=
E_NOTIMPL
;
break
;
...
...
@@ -1597,23 +1597,16 @@ static HRESULT WINAPI isaxxmlreader_parse(
hr
=
E_INVALIDARG
;
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
hr
;
}
static
HRESULT
saxreader_onDataAvailable
(
void
*
obj
,
char
*
ptr
,
DWORD
len
)
{
saxreader
*
This
=
obj
;
xmlChar
*
data
;
HRESULT
hr
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
);
memcpy
(
data
,
ptr
,
len
);
data
[
len
]
=
0
;
hr
=
parse_buffer
(
This
,
data
);
hr
=
parse_buffer
(
This
,
ptr
,
len
);
HeapFree
(
GetProcessHeap
(),
0
,
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