Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
6df49d57
Commit
6df49d57
authored
Jul 30, 2008
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 31, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Initialize ISAXAttribute structure.
parent
6d337982
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
14 deletions
+97
-14
saxreader.c
dlls/msxml3/saxreader.c
+97
-14
No files found.
dlls/msxml3/saxreader.c
View file @
6df49d57
...
...
@@ -73,6 +73,11 @@ typedef struct _saxattributes
{
const
struct
ISAXAttributesVtbl
*
lpSAXAttributesVtbl
;
LONG
ref
;
int
nb_attributes
;
BSTR
*
szLocalname
;
BSTR
*
szPrefix
;
BSTR
*
szURI
;
BSTR
*
szValue
;
}
saxattributes
;
static
inline
saxreader
*
impl_from_IVBSAXXMLReader
(
IVBSAXXMLReader
*
iface
)
...
...
@@ -96,6 +101,28 @@ static inline saxattributes *impl_from_ISAXAttributes( ISAXAttributes *iface )
}
BSTR
bstr_from_xmlCharN
(
const
xmlChar
*
buf
,
int
len
)
{
DWORD
dLen
;
LPWSTR
str
;
BSTR
bstr
;
if
(
!
buf
)
return
NULL
;
dLen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
(
LPCSTR
)
buf
,
len
,
NULL
,
0
);
if
(
len
!=
-
1
)
dLen
++
;
str
=
(
LPWSTR
)
HeapAlloc
(
GetProcessHeap
(),
0
,
dLen
*
sizeof
(
WCHAR
));
if
(
!
str
)
return
NULL
;
MultiByteToWideChar
(
CP_UTF8
,
0
,
(
LPCSTR
)
buf
,
len
,
str
,
dLen
);
if
(
len
!=
-
1
)
str
[
dLen
-
1
]
=
'\0'
;
bstr
=
SysAllocString
(
str
);
HeapFree
(
GetProcessHeap
(),
0
,
str
);
return
bstr
;
}
static
void
format_error_message_from_id
(
saxlocator
*
This
,
HRESULT
hr
)
{
xmlStopParser
(
This
->
pParserCtxt
);
...
...
@@ -191,6 +218,20 @@ static ULONG WINAPI isaxattributes_Release(ISAXAttributes* iface)
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
{
int
index
;
for
(
index
=
0
;
index
<
This
->
nb_attributes
;
index
++
)
{
SysFreeString
(
This
->
szLocalname
[
index
]);
SysFreeString
(
This
->
szPrefix
[
index
]);
SysFreeString
(
This
->
szURI
[
index
]);
SysFreeString
(
This
->
szValue
[
index
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
szLocalname
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
szPrefix
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
szURI
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
szValue
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -389,9 +430,11 @@ static const struct ISAXAttributesVtbl isaxattributes_vtbl =
isaxattributes_getValueFromQName
};
static
HRESULT
SAXAttributes_create
(
IUnknown
*
pUnkOuter
,
LPVOID
*
ppObj
)
static
HRESULT
SAXAttributes_create
(
saxattributes
**
attr
,
int
nb_attributes
,
const
xmlChar
**
xmlAttributes
)
{
saxattributes
*
attributes
;
int
index
;
attributes
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
attributes
));
if
(
!
attributes
)
...
...
@@ -400,9 +443,47 @@ static HRESULT SAXAttributes_create(IUnknown *pUnkOuter, LPVOID *ppObj)
attributes
->
lpSAXAttributesVtbl
=
&
isaxattributes_vtbl
;
attributes
->
ref
=
1
;
*
ppObj
=
attributes
;
attributes
->
nb_attributes
=
nb_attributes
;
attributes
->
szLocalname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BSTR
)
*
nb_attributes
);
attributes
->
szPrefix
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BSTR
)
*
nb_attributes
);
attributes
->
szURI
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BSTR
)
*
nb_attributes
);
attributes
->
szValue
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BSTR
)
*
nb_attributes
);
if
(
!
attributes
->
szLocalname
||
!
attributes
->
szPrefix
||
!
attributes
->
szURI
||
!
attributes
->
szValue
)
{
if
(
attributes
->
szLocalname
)
HeapFree
(
GetProcessHeap
(),
0
,
attributes
->
szLocalname
);
if
(
attributes
->
szPrefix
)
HeapFree
(
GetProcessHeap
(),
0
,
attributes
->
szPrefix
);
if
(
attributes
->
szURI
)
HeapFree
(
GetProcessHeap
(),
0
,
attributes
->
szURI
);
if
(
attributes
->
szValue
)
HeapFree
(
GetProcessHeap
(),
0
,
attributes
->
szValue
);
return
E_FAIL
;
}
for
(
index
=
0
;
index
<
nb_attributes
;
index
++
)
{
attributes
->
szLocalname
[
index
]
=
bstr_from_xmlChar
(
xmlAttributes
[
index
*
5
]);
attributes
->
szPrefix
[
index
]
=
bstr_from_xmlChar
(
xmlAttributes
[
index
*
5
+
1
]);
attributes
->
szURI
[
index
]
=
bstr_from_xmlChar
(
xmlAttributes
[
index
*
5
+
2
]);
attributes
->
szValue
[
index
]
=
bstr_from_xmlCharN
(
xmlAttributes
[
index
*
5
+
3
],
xmlAttributes
[
index
*
5
+
4
]
-
xmlAttributes
[
index
*
5
+
3
]);
}
*
attr
=
attributes
;
TRACE
(
"returning %p
\n
"
,
*
ppObj
);
TRACE
(
"returning %p
\n
"
,
*
attr
);
return
S_OK
;
}
...
...
@@ -455,7 +536,7 @@ static void libxmlStartElementNS(
BSTR
NamespaceUri
,
LocalName
,
QName
;
saxlocator
*
This
=
ctx
;
HRESULT
hr
;
ISAXA
ttributes
*
attr
;
saxa
ttributes
*
attr
;
FIXME
(
"Arguments processing not yet implemented.
\n
"
);
...
...
@@ -467,21 +548,23 @@ static void libxmlStartElementNS(
LocalName
=
bstr_from_xmlChar
(
localname
);
QName
=
bstr_from_xmlChar
(
localname
);
SAXAttributes_create
(
NULL
,
(
void
*
)
&
attr
);
hr
=
ISAXContentHandler_startElement
(
This
->
saxreader
->
contentHandler
,
NamespaceUri
,
SysStringLen
(
NamespaceUri
),
LocalName
,
SysStringLen
(
LocalName
),
QName
,
SysStringLen
(
QName
),
attr
);
hr
=
SAXAttributes_create
(
&
attr
,
nb_attributes
,
attributes
);
if
(
hr
==
S_OK
)
{
hr
=
ISAXContentHandler_startElement
(
This
->
saxreader
->
contentHandler
,
NamespaceUri
,
SysStringLen
(
NamespaceUri
),
LocalName
,
SysStringLen
(
LocalName
),
QName
,
SysStringLen
(
QName
),
(
ISAXAttributes
*
)
&
attr
->
lpSAXAttributesVtbl
);
ISAXAttributes_Release
((
ISAXAttributes
*
)
&
attr
->
lpSAXAttributesVtbl
);
}
SysFreeString
(
NamespaceUri
);
SysFreeString
(
LocalName
);
SysFreeString
(
QName
);
ISAXAttributes_Release
(
attr
);
if
(
hr
!=
S_OK
)
format_error_message_from_id
(
This
,
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