mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-10 08:58:16 +03:00
aligned xmlSAXUserParseMemory() to match xmlSAXUserParseFile() logic based
* parser.c: aligned xmlSAXUserParseMemory() to match xmlSAXUserParseFile() logic based on Ashwin post, and ifdef cleanup Daniel svn path=/trunk/; revision=3649
This commit is contained in:
parent
f779da3172
commit
3dcd319a46
@ -1,3 +1,9 @@
|
||||
Tue Aug 14 15:51:05 CEST 2007 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c: aligned xmlSAXUserParseMemory() to match
|
||||
xmlSAXUserParseFile() logic based on Ashwin post, and ifdef
|
||||
cleanup
|
||||
|
||||
Tue Aug 14 11:42:27 CEST 2007 Rob Richards <rrichards@ctindustries.net>
|
||||
|
||||
* xmlIO.c: fixed windows path determination (patch from
|
||||
|
11
parser.c
11
parser.c
@ -12487,9 +12487,7 @@ xmlSAXUserParseFile(xmlSAXHandlerPtr sax, void *user_data,
|
||||
|
||||
ctxt = xmlCreateFileParserCtxt(filename);
|
||||
if (ctxt == NULL) return -1;
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
xmlFree(ctxt->sax);
|
||||
ctxt->sax = sax;
|
||||
xmlDetectSAX2(ctxt);
|
||||
@ -12693,14 +12691,14 @@ int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
|
||||
const char *buffer, int size) {
|
||||
int ret = 0;
|
||||
xmlParserCtxtPtr ctxt;
|
||||
xmlSAXHandlerPtr oldsax = NULL;
|
||||
|
||||
if (sax == NULL) return -1;
|
||||
ctxt = xmlCreateMemoryParserCtxt(buffer, size);
|
||||
if (ctxt == NULL) return -1;
|
||||
oldsax = ctxt->sax;
|
||||
if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
|
||||
xmlFree(ctxt->sax);
|
||||
ctxt->sax = sax;
|
||||
xmlDetectSAX2(ctxt);
|
||||
|
||||
if (user_data != NULL)
|
||||
ctxt->userData = user_data;
|
||||
|
||||
@ -12714,7 +12712,8 @@ int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
|
||||
else
|
||||
ret = -1;
|
||||
}
|
||||
ctxt->sax = oldsax;
|
||||
if (sax != NULL)
|
||||
ctxt->sax = NULL;
|
||||
if (ctxt->myDoc != NULL) {
|
||||
xmlFreeDoc(ctxt->myDoc);
|
||||
ctxt->myDoc = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user