Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
bba7eb58
Commit
bba7eb58
authored
16 years ago
by
Piotr Caban
Committed by
Alexandre Julliard
16 years ago
Browse files
Options
Downloads
Patches
Plain Diff
msxml3: Add error handling.
parent
918a46ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/msxml3/saxreader.c
+64
-26
64 additions, 26 deletions
dlls/msxml3/saxreader.c
with
64 additions
and
26 deletions
dlls/msxml3/saxreader.c
+
64
−
26
View file @
bba7eb58
...
...
@@ -83,6 +83,26 @@ static inline saxlocator *impl_from_ISAXLocator( ISAXLocator *iface )
return
(
saxlocator
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
saxlocator
,
lpSAXLocatorVtbl
));
}
static
void
format_error_message_from_id
(
saxlocator
*
This
,
HRESULT
hr
)
{
xmlStopParser
(
This
->
pParserCtxt
);
This
->
ret
=
hr
;
if
(
This
->
saxreader
->
errorHandler
)
{
WCHAR
msg
[
1024
];
if
(
!
FormatMessageW
(
FORMAT_MESSAGE_FROM_SYSTEM
,
NULL
,
hr
,
0
,
msg
,
sizeof
(
msg
),
NULL
))
{
FIXME
(
"MSXML errors not yet supported.
\n
"
);
msg
[
0
]
=
'\0'
;
}
ISAXErrorHandler_fatalError
(
This
->
saxreader
->
errorHandler
,
(
ISAXLocator
*
)
&
This
->
lpSAXLocatorVtbl
,
msg
,
hr
);
}
}
/*** LibXML callbacks ***/
static
void
libxmlStartDocument
(
void
*
ctx
)
{
...
...
@@ -92,11 +112,8 @@ static void libxmlStartDocument(void *ctx)
if
(
This
->
saxreader
->
contentHandler
)
{
hr
=
ISAXContentHandler_startDocument
(
This
->
saxreader
->
contentHandler
);
if
(
FAILED
(
hr
))
{
xmlStopParser
(
This
->
pParserCtxt
);
This
->
ret
=
hr
;
}
if
(
hr
!=
S_OK
)
format_error_message_from_id
(
This
,
hr
);
}
This
->
lastColumn
=
xmlSAX2GetColumnNumber
(
This
->
pParserCtxt
);
...
...
@@ -116,11 +133,8 @@ static void libxmlEndDocument(void *ctx)
if
(
This
->
saxreader
->
contentHandler
)
{
hr
=
ISAXContentHandler_endDocument
(
This
->
saxreader
->
contentHandler
);
if
(
FAILED
(
hr
))
{
xmlStopParser
(
This
->
pParserCtxt
);
This
->
ret
=
hr
;
}
if
(
hr
!=
S_OK
)
format_error_message_from_id
(
This
,
hr
);
}
}
...
...
@@ -161,11 +175,8 @@ static void libxmlStartElementNS(
SysFreeString
(
LocalName
);
SysFreeString
(
QName
);
if
(
FAILED
(
hr
))
{
xmlStopParser
(
This
->
pParserCtxt
);
This
->
ret
=
hr
;
}
if
(
hr
!=
S_OK
)
format_error_message_from_id
(
This
,
hr
);
}
}
...
...
@@ -198,11 +209,8 @@ static void libxmlEndElementNS(
SysFreeString
(
LocalName
);
SysFreeString
(
QName
);
if
(
FAILED
(
hr
))
{
xmlStopParser
(
This
->
pParserCtxt
);
This
->
ret
=
hr
;
}
if
(
hr
!=
S_OK
)
format_error_message_from_id
(
This
,
hr
);
}
}
...
...
@@ -242,11 +250,8 @@ static void libxmlCharacters(
hr
=
ISAXContentHandler_characters
(
This
->
saxreader
->
contentHandler
,
Chars
,
len
);
SysFreeString
(
Chars
);
if
(
FAILED
(
hr
))
{
xmlStopParser
(
This
->
pParserCtxt
);
This
->
ret
=
hr
;
}
if
(
hr
!=
S_OK
)
format_error_message_from_id
(
This
,
hr
);
}
}
...
...
@@ -261,10 +266,41 @@ static void libxmlSetDocumentLocator(
(
ISAXLocator
*
)
&
This
->
lpSAXLocatorVtbl
);
if
(
FAILED
(
hr
))
format_error_message_from_id
(
This
,
hr
);
}
void
libxmlFatalError
(
void
*
ctx
,
const
char
*
msg
,
...)
{
saxlocator
*
This
=
ctx
;
char
message
[
1024
];
WCHAR
*
wszError
;
DWORD
len
;
va_list
args
;
if
(
!
This
->
saxreader
->
errorHandler
)
{
xmlStopParser
(
This
->
pParserCtxt
);
This
->
ret
=
hr
;
This
->
ret
=
E_FAIL
;
return
;
}
FIXME
(
"Error handling is not compatible.
\n
"
);
va_start
(
args
,
msg
);
vsprintf
(
message
,
msg
,
args
);
va_end
(
args
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
message
,
-
1
,
NULL
,
0
);
wszError
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
message
,
-
1
,
(
LPWSTR
)
wszError
,
len
);
ISAXErrorHandler_fatalError
(
This
->
saxreader
->
errorHandler
,
(
ISAXLocator
*
)
&
This
->
lpSAXLocatorVtbl
,
wszError
,
E_FAIL
);
HeapFree
(
GetProcessHeap
(),
0
,
wszError
);
xmlStopParser
(
This
->
pParserCtxt
);
This
->
ret
=
E_FAIL
;
}
/*** ISAXLocator interface ***/
...
...
@@ -1102,6 +1138,8 @@ HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj)
reader
->
sax
.
endElementNs
=
libxmlEndElementNS
;
reader
->
sax
.
characters
=
libxmlCharacters
;
reader
->
sax
.
setDocumentLocator
=
libxmlSetDocumentLocator
;
reader
->
sax
.
error
=
libxmlFatalError
;
reader
->
sax
.
fatalError
=
libxmlFatalError
;
*
ppObj
=
&
reader
->
lpVtbl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment