1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-21 17:57:22 +03:00

A few serious bugfixes:

- parser.[ch] parserInternals.c: applied the conditional
  section processing fix from Jonathan P Springer
  <jonathan.springer2@gte.net>
- xmlversion.h.in win32/libxml2/libxml2.dsp : Updated MS
  project file, fixed iconv default non support
- xpath.c: fixed the problem of evaluating relative expressions
  when a node context is provided.
Daniel
This commit is contained in:
Daniel Veillard 2000-11-13 11:47:47 +00:00
parent bf43275dd1
commit 41e065130b
9 changed files with 69 additions and 35 deletions

View File

@ -1,3 +1,13 @@
Mon Nov 13 12:39:38 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* parser.[ch] parserInternals.c: applied the conditional
section processing fix from Jonathan P Springer
<jonathan.springer2@gte.net>
* xmlversion.h.in win32/libxml2/libxml2.dsp : Updated MS
project file, fixed iconv default non support
* xpath.c: fixed the problem of evaluating relative expressions
when a node context is provided.
Sun Nov 12 16:31:19 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org> Sun Nov 12 16:31:19 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* nanoftp.c: fixed gcc 2.95 new warnings * nanoftp.c: fixed gcc 2.95 new warnings

View File

@ -99,7 +99,8 @@ typedef enum {
XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
XML_PARSER_EPILOG /* the Misc* after the last end tag */ XML_PARSER_EPILOG, /* the Misc* after the last end tag */
XML_PARSER_IGNORE /* within an IGNORED section */
} xmlParserInputState; } xmlParserInputState;
/** /**

View File

@ -89,11 +89,13 @@ extern void xmlCheckVersion(int version);
/* /*
* Whether iconv support is available * Whether iconv support is available
*/ */
#ifndef WIN32
#if @WITH_ICONV@ #if @WITH_ICONV@
#define LIBXML_ICONV_ENABLED #define LIBXML_ICONV_ENABLED
#else #else
#define LIBXML_ICONV_DISABLED #define LIBXML_ICONV_DISABLED
#endif #endif
#endif
/* /*
* Whether Debugging module is configured in * Whether Debugging module is configured in

View File

@ -661,6 +661,9 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
*/ */
if ((ctxt->external == 0) && (ctxt->inputNr == 1)) if ((ctxt->external == 0) && (ctxt->inputNr == 1))
return; return;
break;
case XML_PARSER_IGNORE:
return;
} }
NEXT; NEXT;
@ -4501,6 +4504,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
} else if ((RAW == 'I') && (NXT(1) == 'G') && (NXT(2) == 'N') && } else if ((RAW == 'I') && (NXT(1) == 'G') && (NXT(2) == 'N') &&
(NXT(3) == 'O') && (NXT(4) == 'R') && (NXT(5) == 'E')) { (NXT(3) == 'O') && (NXT(4) == 'R') && (NXT(5) == 'E')) {
int state; int state;
int instate;
int depth = 0;
SKIP(6); SKIP(6);
SKIP_BLANKS; SKIP_BLANKS;
@ -4528,40 +4533,27 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
* But disable SAX event generating DTD building in the meantime * But disable SAX event generating DTD building in the meantime
*/ */
state = ctxt->disableSAX; state = ctxt->disableSAX;
instate = ctxt->instate;
ctxt->disableSAX = 1; ctxt->disableSAX = 1;
while ((RAW != 0) && ((RAW != ']') || (NXT(1) != ']') || ctxt->instate = XML_PARSER_IGNORE;
(NXT(2) != '>'))) {
const xmlChar *check = CUR_PTR;
int cons = ctxt->input->consumed;
int tok = ctxt->token;
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) { while (depth >= 0) {
xmlParseConditionalSections(ctxt); if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
} else if (IS_BLANK(CUR)) { depth++;
NEXT; SKIP(3);
} else if (RAW == '%') { continue;
xmlParsePEReference(ctxt); }
} else if ((RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) {
xmlParseMarkupDecl(ctxt); if (--depth >= 0) SKIP(3);
continue;
/* }
* Pop-up of finished entities. NEXT;
*/ continue;
while ((RAW == 0) && (ctxt->inputNr > 1))
xmlPopInput(ctxt);
if ((CUR_PTR == check) && (cons == ctxt->input->consumed) &&
(tok == ctxt->token)) {
ctxt->errNo = XML_ERR_EXT_SUBSET_NOT_FINISHED;
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
"Content error in the external subset\n");
ctxt->wellFormed = 0;
ctxt->disableSAX = 1;
break;
}
} }
ctxt->disableSAX = state; ctxt->disableSAX = state;
ctxt->instate = instate;
if (xmlParserDebugEntities) { if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename)) if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
@ -7379,6 +7371,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
case XML_PARSER_PI: case XML_PARSER_PI:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: try PI\n");break; "PP: try PI\n");break;
case XML_PARSER_IGNORE:
xmlGenericError(xmlGenericErrorContext,
"PP: try IGNORE\n");break;
} }
#endif #endif
@ -7590,6 +7585,15 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
#endif #endif
} }
break; break;
case XML_PARSER_IGNORE:
xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == IGNORE");
ctxt->instate = XML_PARSER_DTD;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
break;
case XML_PARSER_PROLOG: case XML_PARSER_PROLOG:
SKIP_BLANKS; SKIP_BLANKS;
if (ctxt->input->buf == NULL) if (ctxt->input->buf == NULL)

View File

@ -99,7 +99,8 @@ typedef enum {
XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
XML_PARSER_EPILOG /* the Misc* after the last end tag */ XML_PARSER_EPILOG, /* the Misc* after the last end tag */
XML_PARSER_IGNORE /* within an IGNORED section */
} xmlParserInputState; } xmlParserInputState;
/** /**

View File

@ -3196,6 +3196,8 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) {
case XML_PARSER_ATTRIBUTE_VALUE: case XML_PARSER_ATTRIBUTE_VALUE:
/* ctxt->token = xmlParseCharRef(ctxt); */ /* ctxt->token = xmlParseCharRef(ctxt); */
return; return;
case XML_PARSER_IGNORE:
return;
} }
return; return;
} }
@ -3268,6 +3270,8 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) {
ctxt->wellFormed = 0; ctxt->wellFormed = 0;
ctxt->disableSAX = 1; ctxt->disableSAX = 1;
return; return;
case XML_PARSER_IGNORE:
return;
} }
/* TODO: this seems not reached anymore .... Verify ... */ /* TODO: this seems not reached anymore .... Verify ... */

View File

@ -26,7 +26,6 @@ CFG=libxml2 - Win32 Debug
# PROP Scc_ProjName "" # PROP Scc_ProjName ""
# PROP Scc_LocalPath "" # PROP Scc_LocalPath ""
CPP=cl.exe CPP=cl.exe
F90=df.exe
RSC=rc.exe RSC=rc.exe
!IF "$(CFG)" == "libxml2 - Win32 Release" !IF "$(CFG)" == "libxml2 - Win32 Release"
@ -41,6 +40,7 @@ RSC=rc.exe
# PROP Output_Dir "Release" # PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
F90=df.exe
# ADD BASE F90 /include:"Release/" # ADD BASE F90 /include:"Release/"
# ADD F90 /include:"Release/" # ADD F90 /include:"Release/"
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
@ -66,6 +66,7 @@ LIB32=link.exe -lib
# PROP Output_Dir "Debug" # PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
F90=df.exe
# ADD BASE F90 /include:"Debug/" # ADD BASE F90 /include:"Debug/"
# ADD F90 /include:"Debug/" # ADD F90 /include:"Debug/"
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
@ -106,6 +107,10 @@ SOURCE=..\..\error.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\hash.c
# End Source File
# Begin Source File
SOURCE=..\..\HTMLparser.c SOURCE=..\..\HTMLparser.c
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -89,11 +89,13 @@ extern void xmlCheckVersion(int version);
/* /*
* Whether iconv support is available * Whether iconv support is available
*/ */
#ifndef WIN32
#if @WITH_ICONV@ #if @WITH_ICONV@
#define LIBXML_ICONV_ENABLED #define LIBXML_ICONV_ENABLED
#else #else
#define LIBXML_ICONV_DISABLED #define LIBXML_ICONV_DISABLED
#endif #endif
#endif
/* /*
* Whether Debugging module is configured in * Whether Debugging module is configured in

View File

@ -5520,7 +5520,7 @@ xmlXPathEvalLocationPath(xmlXPathParserContextPtr ctxt) {
xmlXPathObjectPtr xmlXPathObjectPtr
xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) { xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
xmlXPathParserContextPtr ctxt; xmlXPathParserContextPtr ctxt;
xmlXPathObjectPtr res = NULL, tmp; xmlXPathObjectPtr res = NULL, tmp, init = NULL;
int stack = 0; int stack = 0;
xmlXPathInit(); xmlXPathInit();
@ -5528,6 +5528,10 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
CHECK_CONTEXT(ctx) CHECK_CONTEXT(ctx)
ctxt = xmlXPathNewParserContext(str, ctx); ctxt = xmlXPathNewParserContext(str, ctx);
if (ctx->node != NULL) {
init = xmlXPathNewNodeSet(ctx->node);
valuePush(ctxt, init);
}
xmlXPathEvalExpr(ctxt); xmlXPathEvalExpr(ctxt);
if (ctxt->value == NULL) { if (ctxt->value == NULL) {
@ -5540,8 +5544,9 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {
do { do {
tmp = valuePop(ctxt); tmp = valuePop(ctxt);
if (tmp != NULL) { if (tmp != NULL) {
if (tmp != init)
stack++;
xmlXPathFreeObject(tmp); xmlXPathFreeObject(tmp);
stack++;
} }
} while (tmp != NULL); } while (tmp != NULL);
if (stack != 0) { if (stack != 0) {