mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
fixed the xmlLineNumbersDefault() errors, lesson don't add new functions
* parser.c parserInternals.c: fixed the xmlLineNumbersDefault() errors, lesson don't add new functions at 1am before a release * xpath.c: integrated fix from Bjorn to avoid divide by zero from XPath initialization when possible. Daniel
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
Thu Jul 26 07:16:04 EDT 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* parser.c parserInternals.c: fixed the xmlLineNumbersDefault()
|
||||||
|
errors, lesson don't add new functions at 1am before a release
|
||||||
|
* xpath.c: integrated fix from Bjorn to avoid divide by zero
|
||||||
|
from XPath initialization when possible.
|
||||||
|
|
||||||
Tue Jul 24 15:39:11 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Tue Jul 24 15:39:11 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* result/scripts/base*: removing history/readline changed
|
* result/scripts/base*: removing history/readline changed
|
||||||
|
104
parser.c
104
parser.c
@ -80,21 +80,7 @@
|
|||||||
/*
|
/*
|
||||||
* Various global defaults for parsing
|
* Various global defaults for parsing
|
||||||
*/
|
*/
|
||||||
int xmlGetWarningsDefaultValue = 1;
|
|
||||||
int xmlParserDebugEntities = 0;
|
int xmlParserDebugEntities = 0;
|
||||||
#ifdef VMS
|
|
||||||
int xmlSubstituteEntitiesDefaultVal = 0;
|
|
||||||
#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal
|
|
||||||
int xmlDoValidityCheckingDefaultVal = 0;
|
|
||||||
#define xmlDoValidityCheckingDefaultValue xmlDoValidityCheckingDefaultVal
|
|
||||||
#else
|
|
||||||
int xmlSubstituteEntitiesDefaultValue = 0;
|
|
||||||
int xmlDoValidityCheckingDefaultValue = 0;
|
|
||||||
#endif
|
|
||||||
int xmlLoadExtDtdDefaultValue = 0;
|
|
||||||
int xmlPedanticParserDefaultValue = 0;
|
|
||||||
int xmlLineNumbersDefaultValue = 0;
|
|
||||||
int xmlKeepBlanksDefaultValue = 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of XML prefixed PI allowed by W3C specs
|
* List of XML prefixed PI allowed by W3C specs
|
||||||
@ -10105,93 +10091,3 @@ xmlCleanupParser(void) {
|
|||||||
xmlCleanupPredefinedEntities();
|
xmlCleanupPredefinedEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlPedanticParserDefault:
|
|
||||||
* @val: int 0 or 1
|
|
||||||
*
|
|
||||||
* Set and return the previous value for enabling pedantic warnings.
|
|
||||||
*
|
|
||||||
* Returns the last value for 0 for no substitution, 1 for substitution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
xmlPedanticParserDefault(int val) {
|
|
||||||
int old = xmlPedanticParserDefaultValue;
|
|
||||||
|
|
||||||
xmlPedanticParserDefaultValue = val;
|
|
||||||
return(old);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlLineNumbersDefault:
|
|
||||||
* @val: int 0 or 1
|
|
||||||
*
|
|
||||||
* Set and return the previous value for enabling line numbers in elements
|
|
||||||
* contents. This may break on old application and is turned off by default.
|
|
||||||
*
|
|
||||||
* Returns the last value for 0 for no substitution, 1 for substitution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
xmlLineNumbersDefault(int val) {
|
|
||||||
int old = xmlLineNumbersDefaultValue;
|
|
||||||
|
|
||||||
xmlLineNumbersDefaultValue = val;
|
|
||||||
return(old);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSubstituteEntitiesDefault:
|
|
||||||
* @val: int 0 or 1
|
|
||||||
*
|
|
||||||
* Set and return the previous value for default entity support.
|
|
||||||
* Initially the parser always keep entity references instead of substituting
|
|
||||||
* entity values in the output. This function has to be used to change the
|
|
||||||
* default parser behaviour
|
|
||||||
* SAX::subtituteEntities() has to be used for changing that on a file by
|
|
||||||
* file basis.
|
|
||||||
*
|
|
||||||
* Returns the last value for 0 for no substitution, 1 for substitution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
xmlSubstituteEntitiesDefault(int val) {
|
|
||||||
int old = xmlSubstituteEntitiesDefaultValue;
|
|
||||||
|
|
||||||
xmlSubstituteEntitiesDefaultValue = val;
|
|
||||||
return(old);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlKeepBlanksDefault:
|
|
||||||
* @val: int 0 or 1
|
|
||||||
*
|
|
||||||
* Set and return the previous value for default blanks text nodes support.
|
|
||||||
* The 1.x version of the parser used an heuristic to try to detect
|
|
||||||
* ignorable white spaces. As a result the SAX callback was generating
|
|
||||||
* ignorableWhitespace() callbacks instead of characters() one, and when
|
|
||||||
* using the DOM output text nodes containing those blanks were not generated.
|
|
||||||
* The 2.x and later version will switch to the XML standard way and
|
|
||||||
* ignorableWhitespace() are only generated when running the parser in
|
|
||||||
* validating mode and when the current element doesn't allow CDATA or
|
|
||||||
* mixed content.
|
|
||||||
* This function is provided as a way to force the standard behaviour
|
|
||||||
* on 1.X libs and to switch back to the old mode for compatibility when
|
|
||||||
* running 1.X client code on 2.X . Upgrade of 1.X code should be done
|
|
||||||
* by using xmlIsBlankNode() commodity function to detect the "empty"
|
|
||||||
* nodes generated.
|
|
||||||
* This value also affect autogeneration of indentation when saving code
|
|
||||||
* if blanks sections are kept, indentation is not generated.
|
|
||||||
*
|
|
||||||
* Returns the last value for 0 for no substitution, 1 for substitution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
xmlKeepBlanksDefault(int val) {
|
|
||||||
int old = xmlKeepBlanksDefaultValue;
|
|
||||||
|
|
||||||
xmlKeepBlanksDefaultValue = val;
|
|
||||||
xmlIndentTreeOutput = !val;
|
|
||||||
return(old);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -49,6 +49,24 @@
|
|||||||
|
|
||||||
void xmlUpgradeOldNs(xmlDocPtr doc);
|
void xmlUpgradeOldNs(xmlDocPtr doc);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Various global defaults for parsing
|
||||||
|
*/
|
||||||
|
int xmlGetWarningsDefaultValue = 1;
|
||||||
|
#ifdef VMS
|
||||||
|
int xmlSubstituteEntitiesDefaultVal = 0;
|
||||||
|
#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal
|
||||||
|
int xmlDoValidityCheckingDefaultVal = 0;
|
||||||
|
#define xmlDoValidityCheckingDefaultValue xmlDoValidityCheckingDefaultVal
|
||||||
|
#else
|
||||||
|
int xmlSubstituteEntitiesDefaultValue = 0;
|
||||||
|
int xmlDoValidityCheckingDefaultValue = 0;
|
||||||
|
#endif
|
||||||
|
int xmlLoadExtDtdDefaultValue = 0;
|
||||||
|
int xmlPedanticParserDefaultValue = 0;
|
||||||
|
int xmlLineNumbersDefaultValue = 0;
|
||||||
|
int xmlKeepBlanksDefaultValue = 1;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Version and Features handling *
|
* Version and Features handling *
|
||||||
@ -2230,7 +2248,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
|
|||||||
ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
|
ctxt->loadsubset = xmlLoadExtDtdDefaultValue;
|
||||||
ctxt->validate = xmlDoValidityCheckingDefaultValue;
|
ctxt->validate = xmlDoValidityCheckingDefaultValue;
|
||||||
ctxt->pedantic = xmlPedanticParserDefaultValue;
|
ctxt->pedantic = xmlPedanticParserDefaultValue;
|
||||||
ctxt->linenumbers = xmlPedanticParserDefaultValue;
|
ctxt->linenumbers = xmlLineNumbersDefaultValue;
|
||||||
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
|
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
|
||||||
ctxt->vctxt.userData = ctxt;
|
ctxt->vctxt.userData = ctxt;
|
||||||
if (ctxt->validate) {
|
if (ctxt->validate) {
|
||||||
@ -2488,6 +2506,101 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* *
|
||||||
|
* Defaults settings *
|
||||||
|
* *
|
||||||
|
************************************************************************/
|
||||||
|
/**
|
||||||
|
* xmlPedanticParserDefault:
|
||||||
|
* @val: int 0 or 1
|
||||||
|
*
|
||||||
|
* Set and return the previous value for enabling pedantic warnings.
|
||||||
|
*
|
||||||
|
* Returns the last value for 0 for no substitution, 1 for substitution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
xmlPedanticParserDefault(int val) {
|
||||||
|
int old = xmlPedanticParserDefaultValue;
|
||||||
|
|
||||||
|
xmlPedanticParserDefaultValue = val;
|
||||||
|
return(old);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlLineNumbersDefault:
|
||||||
|
* @val: int 0 or 1
|
||||||
|
*
|
||||||
|
* Set and return the previous value for enabling line numbers in elements
|
||||||
|
* contents. This may break on old application and is turned off by default.
|
||||||
|
*
|
||||||
|
* Returns the last value for 0 for no substitution, 1 for substitution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
xmlLineNumbersDefault(int val) {
|
||||||
|
int old = xmlLineNumbersDefaultValue;
|
||||||
|
|
||||||
|
xmlLineNumbersDefaultValue = val;
|
||||||
|
return(old);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlSubstituteEntitiesDefault:
|
||||||
|
* @val: int 0 or 1
|
||||||
|
*
|
||||||
|
* Set and return the previous value for default entity support.
|
||||||
|
* Initially the parser always keep entity references instead of substituting
|
||||||
|
* entity values in the output. This function has to be used to change the
|
||||||
|
* default parser behaviour
|
||||||
|
* SAX::subtituteEntities() has to be used for changing that on a file by
|
||||||
|
* file basis.
|
||||||
|
*
|
||||||
|
* Returns the last value for 0 for no substitution, 1 for substitution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
xmlSubstituteEntitiesDefault(int val) {
|
||||||
|
int old = xmlSubstituteEntitiesDefaultValue;
|
||||||
|
|
||||||
|
xmlSubstituteEntitiesDefaultValue = val;
|
||||||
|
return(old);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlKeepBlanksDefault:
|
||||||
|
* @val: int 0 or 1
|
||||||
|
*
|
||||||
|
* Set and return the previous value for default blanks text nodes support.
|
||||||
|
* The 1.x version of the parser used an heuristic to try to detect
|
||||||
|
* ignorable white spaces. As a result the SAX callback was generating
|
||||||
|
* ignorableWhitespace() callbacks instead of characters() one, and when
|
||||||
|
* using the DOM output text nodes containing those blanks were not generated.
|
||||||
|
* The 2.x and later version will switch to the XML standard way and
|
||||||
|
* ignorableWhitespace() are only generated when running the parser in
|
||||||
|
* validating mode and when the current element doesn't allow CDATA or
|
||||||
|
* mixed content.
|
||||||
|
* This function is provided as a way to force the standard behaviour
|
||||||
|
* on 1.X libs and to switch back to the old mode for compatibility when
|
||||||
|
* running 1.X client code on 2.X . Upgrade of 1.X code should be done
|
||||||
|
* by using xmlIsBlankNode() commodity function to detect the "empty"
|
||||||
|
* nodes generated.
|
||||||
|
* This value also affect autogeneration of indentation when saving code
|
||||||
|
* if blanks sections are kept, indentation is not generated.
|
||||||
|
*
|
||||||
|
* Returns the last value for 0 for no substitution, 1 for substitution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
xmlKeepBlanksDefault(int val) {
|
||||||
|
int old = xmlKeepBlanksDefaultValue;
|
||||||
|
|
||||||
|
xmlKeepBlanksDefaultValue = val;
|
||||||
|
xmlIndentTreeOutput = !val;
|
||||||
|
return(old);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Deprecated functions kept for compatibility *
|
* Deprecated functions kept for compatibility *
|
||||||
|
7
xpath.c
7
xpath.c
@ -194,9 +194,16 @@ xmlXPathInit(void) {
|
|||||||
|
|
||||||
if (initialized) return;
|
if (initialized) return;
|
||||||
|
|
||||||
|
#if defined(HUGE_VAL) && defined(DBL_MAX)
|
||||||
|
xmlXPathPINF = (HUGE_VAL == DBL_MAX) ?
|
||||||
|
xmlXPathDivideBy(1.0, 0.0) : HUGE_VAL;
|
||||||
|
xmlXPathNINF = -xmlXPathPINF;
|
||||||
|
xmlXPathNAN = xmlXPathDivideBy(xmlXPathPINF, xmlXPathPINF);
|
||||||
|
#else
|
||||||
xmlXPathNAN = xmlXPathDivideBy(0.0, 0.0);
|
xmlXPathNAN = xmlXPathDivideBy(0.0, 0.0);
|
||||||
xmlXPathPINF = xmlXPathDivideBy(1.0, 0.0);
|
xmlXPathPINF = xmlXPathDivideBy(1.0, 0.0);
|
||||||
xmlXPathNINF = xmlXPathDivideBy(-1.0, 0.0);
|
xmlXPathNINF = xmlXPathDivideBy(-1.0, 0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user