XML was developed by an XML Working Group (orisable over the
-Internet.
-XML documents shou
\ No newline at end of file
diff --git a/test/errors/759573-2.xml b/test/errors/759573-2.xml
deleted file mode 100644
index 5ad655f..0000000
--- a/test/errors/759573-2.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-' >
-%xx;ÿggKENSMYNT#MENTDŴzz;'>
-r.B"/>
-e
\ No newline at end of file
diff --git a/test/errors/759573.xml b/test/errors/759573.xml
deleted file mode 100644
index 69ebb57..0000000
--- a/test/errors/759573.xml
+++ /dev/null
@@ -1 +0,0 @@
-%xx;
\ No newline at end of file
diff --git a/test/relaxng/565219.rng b/test/relaxng/565219.rng
deleted file mode 100644
index 087ed95..0000000
--- a/test/relaxng/565219.rng
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/relaxng/565219_0.xml b/test/relaxng/565219_0.xml
deleted file mode 100644
index a964a07..0000000
--- a/test/relaxng/565219_0.xml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/test/relaxng/565219_1.xml b/test/relaxng/565219_1.xml
deleted file mode 100644
index f1999f8..0000000
--- a/test/relaxng/565219_1.xml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/test/relaxng/565219_2.xml b/test/relaxng/565219_2.xml
deleted file mode 100644
index a964a07..0000000
--- a/test/relaxng/565219_2.xml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/test/relaxng/pattern3.rng b/test/relaxng/pattern3.rng
deleted file mode 100644
index fa4434f..0000000
--- a/test/relaxng/pattern3.rng
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
- [a-z]+
-
-
-
-
diff --git a/test/relaxng/pattern3_1.xml b/test/relaxng/pattern3_1.xml
deleted file mode 100644
index f559cd3..0000000
--- a/test/relaxng/pattern3_1.xml
+++ /dev/null
@@ -1 +0,0 @@
- ooo
diff --git a/test/valid/737840.xml b/test/valid/737840.xml
deleted file mode 100644
index 2d27b73..0000000
--- a/test/valid/737840.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-]>
-
-
- ⌖
-
diff --git a/test/valid/dtds/737840.ent b/test/valid/dtds/737840.ent
deleted file mode 100644
index e972132..0000000
--- a/test/valid/dtds/737840.ent
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/testModule.c b/testModule.c
index 77b7ba1..e399f5c 100644
--- a/testModule.c
+++ b/testModule.c
@@ -47,7 +47,7 @@ int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
/* build the module filename, and confirm the module exists */
xmlStrPrintf(filename, sizeof(filename),
- "%s/testdso%s",
+ (const xmlChar*) "%s/testdso%s",
(const xmlChar*)MODULE_PATH,
(const xmlChar*)LIBXML_MODULE_EXTENSION);
diff --git a/testapi.c b/testapi.c
index 60f4bdd..0367ffd 100644
--- a/testapi.c
+++ b/testapi.c
@@ -1034,10 +1034,10 @@ static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val A
#define gen_nb_xmlBufferAllocationScheme 4
static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
- if (no == 1) return(XML_BUFFER_ALLOC_BOUNDED);
- if (no == 2) return(XML_BUFFER_ALLOC_DOUBLEIT);
- if (no == 3) return(XML_BUFFER_ALLOC_EXACT);
- if (no == 4) return(XML_BUFFER_ALLOC_HYBRID);
+ if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
+ if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
+ if (no == 3) return(XML_BUFFER_ALLOC_HYBRID);
+ if (no == 4) return(XML_BUFFER_ALLOC_IMMUTABLE);
return(0);
}
@@ -8175,7 +8175,7 @@ test_xmlDictCreateSub(void) {
int mem_base;
xmlDictPtr ret_val;
- xmlDictPtr sub; /* an existing dictionary */
+ xmlDictPtr sub; /* an existing dictionnary */
int n_sub;
for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
@@ -8207,7 +8207,7 @@ test_xmlDictExists(void) {
int mem_base;
const xmlChar * ret_val;
- xmlDictPtr dict; /* the dictionary */
+ xmlDictPtr dict; /* the dictionnary */
int n_dict;
xmlChar * name; /* the name of the userdata */
int n_name;
@@ -8263,7 +8263,7 @@ test_xmlDictLookup(void) {
int mem_base;
const xmlChar * ret_val;
- xmlDictPtr dict; /* the dictionary */
+ xmlDictPtr dict; /* the dictionnary */
int n_dict;
xmlChar * name; /* the name of the userdata */
int n_name;
@@ -8309,7 +8309,7 @@ test_xmlDictOwns(void) {
int mem_base;
int ret_val;
- xmlDictPtr dict; /* the dictionary */
+ xmlDictPtr dict; /* the dictionnary */
int n_dict;
xmlChar * str; /* the string */
int n_str;
@@ -8348,7 +8348,7 @@ test_xmlDictQLookup(void) {
int mem_base;
const xmlChar * ret_val;
- xmlDictPtr dict; /* the dictionary */
+ xmlDictPtr dict; /* the dictionnary */
int n_dict;
xmlChar * prefix; /* the prefix */
int n_prefix;
@@ -8394,7 +8394,7 @@ test_xmlDictReference(void) {
int mem_base;
int ret_val;
- xmlDictPtr dict; /* the dictionary */
+ xmlDictPtr dict; /* the dictionnary */
int n_dict;
for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
@@ -8437,7 +8437,7 @@ test_xmlDictSize(void) {
int mem_base;
int ret_val;
- xmlDictPtr dict; /* the dictionary */
+ xmlDictPtr dict; /* the dictionnary */
int n_dict;
for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
diff --git a/testdict.c b/testdict.c
index 40bebd0..4e8581f 100644
--- a/testdict.c
+++ b/testdict.c
@@ -277,7 +277,7 @@ static int run_test2(xmlDictPtr parent) {
cur++;
*pref = 0;
tmp = xmlDictQLookup(dict, &prefix[0], cur);
- if (tmp != test2[i]) {
+ if (xmlDictQLookup(dict, &prefix[0], cur) != test2[i]) {
fprintf(stderr, "Failed lookup check for '%s':'%s'\n",
&prefix[0], cur);
ret = 1;
@@ -408,7 +408,7 @@ static int run_test1(void) {
cur++;
*pref = 0;
tmp = xmlDictQLookup(dict, &prefix[0], cur);
- if (tmp != test1[i]) {
+ if (xmlDictQLookup(dict, &prefix[0], cur) != test1[i]) {
fprintf(stderr, "Failed lookup check for '%s':'%s'\n",
&prefix[0], cur);
ret = 1;
diff --git a/threads.c b/threads.c
index b9d6cae..8921204 100644
--- a/threads.c
+++ b/threads.c
@@ -47,7 +47,7 @@
#ifdef HAVE_PTHREAD_H
static int libxml_is_threaded = -1;
-#if defined(__GNUC__) && defined(__GLIBC__)
+#ifdef __GNUC__
#ifdef linux
#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
extern int pthread_once (pthread_once_t *__once_control,
@@ -89,7 +89,7 @@ extern int pthread_cond_signal ()
__attribute((weak));
#endif
#endif /* linux */
-#endif /* defined(__GNUC__) && defined(__GLIBC__) */
+#endif /* __GNUC__ */
#endif /* HAVE_PTHREAD_H */
/*
@@ -415,8 +415,8 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
if (tok->count > 0) {
- tok->count--;
LeaveCriticalSection(&tok->cs);
+ tok->count--;
}
#elif defined HAVE_BEOS_THREADS
if (tok->lock->tid == find_thread(NULL)) {
diff --git a/timsort.h b/timsort.h
index 795f272..efa3aab 100644
--- a/timsort.h
+++ b/timsort.h
@@ -392,66 +392,62 @@ static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const in
static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_curr, TEMP_STORAGE_T *store, const size_t size)
{
- while (1) {
- int64_t A, B, C, D;
- int ABC, BCD, BD, CD;
-
+ while (1)
+ {
+ int64_t A, B, C;
/* if the stack only has one thing on it, we are done with the collapse */
- if (stack_curr <= 1) {
- break;
- }
-
+ if (stack_curr <= 1) break;
/* if this is the last merge, just do it */
- if ((stack_curr == 2) && (stack[0].length + stack[1].length == size)) {
+ if ((stack_curr == 2) &&
+ (stack[0].length + stack[1].length == (int64_t) size))
+ {
TIM_SORT_MERGE(dst, stack, stack_curr, store);
stack[0].length += stack[1].length;
stack_curr--;
break;
}
/* check if the invariant is off for a stack of 2 elements */
- else if ((stack_curr == 2) && (stack[0].length <= stack[1].length)) {
+ else if ((stack_curr == 2) && (stack[0].length <= stack[1].length))
+ {
TIM_SORT_MERGE(dst, stack, stack_curr, store);
stack[0].length += stack[1].length;
stack_curr--;
break;
- } else if (stack_curr == 2) {
- break;
- }
-
- B = stack[stack_curr - 3].length;
- C = stack[stack_curr - 2].length;
- D = stack[stack_curr - 1].length;
-
- if (stack_curr >= 4) {
- A = stack[stack_curr - 4].length;
- ABC = (A <= B + C);
- } else {
- ABC = 0;
}
+ else if (stack_curr == 2)
+ break;
- BCD = (B <= C + D) || ABC;
- CD = (C <= D);
- BD = (B < D);
+ A = stack[stack_curr - 3].length;
+ B = stack[stack_curr - 2].length;
+ C = stack[stack_curr - 1].length;
- /* Both invariants are good */
- if (!BCD && !CD) {
- break;
+ /* check first invariant */
+ if (A <= B + C)
+ {
+ if (A < C)
+ {
+ TIM_SORT_MERGE(dst, stack, stack_curr - 1, store);
+ stack[stack_curr - 3].length += stack[stack_curr - 2].length;
+ stack[stack_curr - 2] = stack[stack_curr - 1];
+ stack_curr--;
+ }
+ else
+ {
+ TIM_SORT_MERGE(dst, stack, stack_curr, store);
+ stack[stack_curr - 2].length += stack[stack_curr - 1].length;
+ stack_curr--;
+ }
}
-
- /* left merge */
- if (BCD && !CD) {
- TIM_SORT_MERGE(dst, stack, stack_curr - 1, store);
- stack[stack_curr - 3].length += stack[stack_curr - 2].length;
- stack[stack_curr - 2] = stack[stack_curr - 1];
- stack_curr--;
- } else {
- /* right merge */
+ /* check second invariant */
+ else if (B <= C)
+ {
TIM_SORT_MERGE(dst, stack, stack_curr, store);
stack[stack_curr - 2].length += stack[stack_curr - 1].length;
stack_curr--;
}
+ else
+ break;
}
-
return stack_curr;
}
diff --git a/tree.c b/tree.c
index 9d330b8..307782c 100644
--- a/tree.c
+++ b/tree.c
@@ -1044,7 +1044,7 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
* DICT_FREE:
* @str: a string
*
- * Free a string if it is not owned by the "dict" dictionary in the
+ * Free a string if it is not owned by the "dict" dictionnary in the
* current scope
*/
#define DICT_FREE(str) \
@@ -1057,7 +1057,7 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
* DICT_COPY:
* @str: a string
*
- * Copy a string using a "dict" dictionary in the current scope,
+ * Copy a string using a "dict" dictionnary in the current scope,
* if availabe.
*/
#define DICT_COPY(str, cpy) \
@@ -1074,7 +1074,7 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
* DICT_CONST_COPY:
* @str: a string
*
- * Copy a string using a "dict" dictionary in the current scope,
+ * Copy a string using a "dict" dictionnary in the current scope,
* if availabe.
*/
#define DICT_CONST_COPY(str, cpy) \
@@ -1451,9 +1451,9 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
node->content = xmlBufDetach(buf);
if (last == NULL) {
- ret = node;
+ last = ret = node;
} else {
- xmlAddNextSibling(last, node);
+ last = xmlAddNextSibling(last, node);
}
} else if (ret == NULL) {
ret = xmlNewDocText(doc, BAD_CAST "");
@@ -1593,7 +1593,6 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
else if ((ent != NULL) && (ent->children == NULL)) {
xmlNodePtr temp;
- ent->children = (xmlNodePtr) -1;
ent->children = xmlStringGetNodeList(doc,
(const xmlChar*)node->content);
ent->owner = 1;
@@ -1640,9 +1639,9 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
node->content = xmlBufDetach(buf);
if (last == NULL) {
- ret = node;
+ last = ret = node;
} else {
- xmlAddNextSibling(last, node);
+ last = xmlAddNextSibling(last, node);
}
}
@@ -2271,7 +2270,7 @@ xmlNewNodeEatName(xmlNsPtr ns, xmlChar *name) {
cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode));
if (cur == NULL) {
xmlTreeErrMemory("building node");
- /* we can't check here that name comes from the doc dictionary */
+ /* we can't check here that name comes from the doc dictionnary */
return(NULL);
}
memset(cur, 0, sizeof(xmlNode));
@@ -2351,7 +2350,7 @@ xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns,
UPDATE_LAST_CHILD_AND_PARENT(cur)
}
} else {
- /* if name don't come from the doc dictionary free it here */
+ /* if name don't come from the doc dictionnary free it here */
if ((name != NULL) && (doc != NULL) &&
(!(xmlDictOwns(doc->dict, name))))
xmlFree(name);
@@ -2800,27 +2799,8 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
if(tree->type == XML_ELEMENT_NODE) {
prop = tree->properties;
while (prop != NULL) {
- if (prop->atype == XML_ATTRIBUTE_ID) {
- xmlRemoveID(tree->doc, prop);
- }
-
prop->doc = doc;
xmlSetListDoc(prop->children, doc);
-
- /*
- * TODO: ID attributes should be also added to the new
- * document, but this breaks things like xmlReplaceNode.
- * The underlying problem is that xmlRemoveID is only called
- * if a node is destroyed, not if it's unlinked.
- */
-#if 0
- if (xmlIsID(doc, tree, prop)) {
- xmlChar *idVal = xmlNodeListGetString(doc, prop->children,
- 1);
- xmlAddID(NULL, doc, idVal, prop);
- }
-#endif
-
prop = prop->next;
}
}
@@ -3702,7 +3682,7 @@ xmlFreeNodeList(xmlNodePtr cur) {
* When a node is a text node or a comment, it uses a global static
* variable for the name of the node.
* Otherwise the node name might come from the document's
- * dictionary
+ * dictionnary
*/
if ((cur->name != NULL) &&
(cur->type != XML_TEXT_NODE) &&
@@ -3771,7 +3751,7 @@ xmlFreeNode(xmlNodePtr cur) {
/*
* When a node is a text node or a comment, it uses a global static
* variable for the name of the node.
- * Otherwise the node name might come from the document's dictionary
+ * Otherwise the node name might come from the document's dictionnary
*/
if ((cur->name != NULL) &&
(cur->type != XML_TEXT_NODE) &&
diff --git a/uri.c b/uri.c
index 2bd5720..ff47abb 100644
--- a/uri.c
+++ b/uri.c
@@ -314,7 +314,7 @@ xmlParse3986Query(xmlURIPtr uri, const char **str)
* @uri: pointer to an URI structure
* @str: the string to analyze
*
- * Parse a port part and fills in the appropriate fields
+ * Parse a port part and fills in the appropriate fields
* of the @uri structure
*
* port = *DIGIT
@@ -325,16 +325,15 @@ static int
xmlParse3986Port(xmlURIPtr uri, const char **str)
{
const char *cur = *str;
- unsigned port = 0; /* unsigned for defined overflow behavior */
if (ISA_DIGIT(cur)) {
+ if (uri != NULL)
+ uri->port = 0;
while (ISA_DIGIT(cur)) {
- port = port * 10 + (*cur - '0');
-
+ if (uri != NULL)
+ uri->port = uri->port * 10 + (*cur - '0');
cur++;
}
- if (uri != NULL)
- uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */
*str = cur;
return(0);
}
diff --git a/valid.c b/valid.c
index 19f84b8..409aa81 100644
--- a/valid.c
+++ b/valid.c
@@ -93,7 +93,7 @@ xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
*
* Handle a validation error
*/
-static void LIBXML_ATTR_FORMAT(3,0)
+static void
xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
const char *msg, const char *extra)
{
@@ -137,7 +137,7 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
*
* Handle a validation error, provide contextual informations
*/
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlErrValidNode(xmlValidCtxtPtr ctxt,
xmlNodePtr node, xmlParserErrors error,
const char *msg, const xmlChar * str1,
@@ -180,7 +180,7 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt,
*
* Handle a validation error, provide contextual informations
*/
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlErrValidNodeNr(xmlValidCtxtPtr ctxt,
xmlNodePtr node, xmlParserErrors error,
const char *msg, const xmlChar * str1,
@@ -221,7 +221,7 @@ xmlErrValidNodeNr(xmlValidCtxtPtr ctxt,
*
* Handle a validation error, provide contextual information
*/
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlErrValidWarning(xmlValidCtxtPtr ctxt,
xmlNodePtr node, xmlParserErrors error,
const char *msg, const xmlChar * str1,
@@ -2532,7 +2532,7 @@ xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
* DICT_FREE:
* @str: a string
*
- * Free a string if it is not owned by the "dict" dictionary in the
+ * Free a string if it is not owned by the "dict" dictionnary in the
* current scope
*/
#define DICT_FREE(str) \
@@ -2634,10 +2634,8 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
/*
* The id is already defined in this DTD.
*/
- if (ctxt != NULL) {
- xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
- "ID %s already defined\n", value, NULL, NULL);
- }
+ xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
+ "ID %s already defined\n", value, NULL, NULL);
#endif /* LIBXML_VALID_ENABLED */
xmlFreeID(ret);
return(NULL);
diff --git a/win32/VC10/config.h b/win32/VC10/config.h
index 891b57e..8629944 100644
--- a/win32/VC10/config.h
+++ b/win32/VC10/config.h
@@ -96,9 +96,7 @@ static int isnan (double d) {
#if defined(_MSC_VER)
#define mkdir(p,m) _mkdir(p)
-#if _MSC_VER < 1900 // Cannot define this in VS 2015 and above!
#define snprintf _snprintf
-#endif
#if _MSC_VER < 1500
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
#endif
diff --git a/win32/configure.js b/win32/configure.js
index 92b9ba0..edd943a 100644
--- a/win32/configure.js
+++ b/win32/configure.js
@@ -14,7 +14,7 @@ var srcDirUtils = "..";
var baseName = "libxml2";
/* Configure file which contains the version and the output file where
we can store our build configuration. */
-var configFile = srcDirXml + "\\configure.ac";
+var configFile = srcDirXml + "\\configure.in";
var versionFile = ".\\config.msvc";
/* Input and output files regarding the libxml features. */
var optsFileIn = srcDirXml + "\\include\\libxml\\xmlversion.h.in";
diff --git a/xinclude.c b/xinclude.c
index e3bb43e..ff3dafb 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -125,7 +125,7 @@ xmlXIncludeErrMemory(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node,
*
* Handle an XInclude error
*/
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlXIncludeErr(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node, int error,
const char *msg, const xmlChar *extra)
{
@@ -147,7 +147,7 @@ xmlXIncludeErr(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node, int error,
*
* Emit an XInclude warning.
*/
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlXIncludeWarn(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node, int error,
const char *msg, const xmlChar *extra)
{
diff --git a/xmlIO.c b/xmlIO.c
index 1a79c09..e628ab0 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -1334,7 +1334,7 @@ xmlGzfileClose (void * context) {
}
#endif /* HAVE_ZLIB_H */
-#ifdef LIBXML_LZMA_ENABLED
+#ifdef HAVE_LZMA_H
/************************************************************************
* *
* I/O for compressed file accesses *
@@ -1451,7 +1451,7 @@ xmlXzfileClose (void * context) {
if (ret < 0) xmlIOErr(0, "xzclose()");
return(ret);
}
-#endif /* LIBXML_LZMA_ENABLED */
+#endif /* HAVE_LZMA_H */
#ifdef LIBXML_HTTP_ENABLED
/************************************************************************
@@ -1604,7 +1604,7 @@ xmlCreateZMemBuff( int compression ) {
xmlFreeZMemBuff( buff );
buff = NULL;
xmlStrPrintf(msg, 500,
- "xmlCreateZMemBuff: %s %d\n",
+ (const xmlChar *) "xmlCreateZMemBuff: %s %d\n",
"Error initializing compression context. ZLIB error:",
z_err );
xmlIOErr(XML_IO_WRITE, (const char *) msg);
@@ -1672,7 +1672,7 @@ xmlZMemBuffExtend( xmlZMemBuffPtr buff, size_t ext_amt ) {
else {
xmlChar msg[500];
xmlStrPrintf(msg, 500,
- "xmlZMemBuffExtend: %s %lu bytes.\n",
+ (const xmlChar *) "xmlZMemBuffExtend: %s %lu bytes.\n",
"Allocation failure extending output buffer to",
new_size );
xmlIOErr(XML_IO_WRITE, (const char *) msg);
@@ -1718,7 +1718,7 @@ xmlZMemBuffAppend( xmlZMemBuffPtr buff, const char * src, int len ) {
if ( z_err != Z_OK ) {
xmlChar msg[500];
xmlStrPrintf(msg, 500,
- "xmlZMemBuffAppend: %s %d %s - %d",
+ (const xmlChar *) "xmlZMemBuffAppend: %s %d %s - %d",
"Compression error while appending",
len, "bytes to buffer. ZLIB error", z_err );
xmlIOErr(XML_IO_WRITE, (const char *) msg);
@@ -1791,7 +1791,7 @@ xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) {
else {
xmlChar msg[500];
xmlStrPrintf(msg, 500,
- "xmlZMemBuffGetContent: %s - %d\n",
+ (const xmlChar *) "xmlZMemBuffGetContent: %s - %d\n",
"Error flushing zlib buffers. Error code", z_err );
xmlIOErr(XML_IO_WRITE, (const char *) msg);
}
@@ -1996,7 +1996,7 @@ xmlIOHTTPWrite( void * context, const char * buffer, int len ) {
if ( len < 0 ) {
xmlChar msg[500];
xmlStrPrintf(msg, 500,
- "xmlIOHTTPWrite: %s\n%s '%s'.\n",
+ (const xmlChar *) "xmlIOHTTPWrite: %s\n%s '%s'.\n",
"Error appending to internal buffer.",
"Error sending document to URI",
ctxt->uri );
@@ -2068,7 +2068,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
if ( http_content == NULL ) {
xmlChar msg[500];
xmlStrPrintf(msg, 500,
- "xmlIOHTTPCloseWrite: %s '%s' %s '%s'.\n",
+ (const xmlChar *) "xmlIOHTTPCloseWrite: %s '%s' %s '%s'.\n",
"Error retrieving content.\nUnable to",
http_mthd, "data to URI", ctxt->uri );
xmlIOErr(XML_IO_WRITE, (const char *) msg);
@@ -2140,7 +2140,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
else {
xmlChar msg[500];
xmlStrPrintf(msg, 500,
- "xmlIOHTTPCloseWrite: HTTP '%s' of %d %s\n'%s' %s %d\n",
+ (const xmlChar *) "xmlIOHTTPCloseWrite: HTTP '%s' of %d %s\n'%s' %s %d\n",
http_mthd, content_lgth,
"bytes to URI", ctxt->uri,
"failed. HTTP return code:", http_rtn );
@@ -2328,10 +2328,10 @@ xmlRegisterDefaultInputCallbacks(void) {
xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
xmlGzfileRead, xmlGzfileClose);
#endif /* HAVE_ZLIB_H */
-#ifdef LIBXML_LZMA_ENABLED
+#ifdef HAVE_LZMA_H
xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen,
xmlXzfileRead, xmlXzfileClose);
-#endif /* LIBXML_LZMA_ENABLED */
+#endif /* HAVE_ZLIB_H */
#ifdef LIBXML_HTTP_ENABLED
xmlRegisterInputCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen,
@@ -2683,7 +2683,7 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
#endif
}
#endif
-#ifdef LIBXML_LZMA_ENABLED
+#ifdef HAVE_LZMA_H
if ((xmlInputCallbackTable[i].opencallback == xmlXzfileOpen) &&
(strcmp(URI, "-") != 0)) {
ret->compressed = __libxml2_xzcompressed(context);
@@ -3350,7 +3350,7 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
* try to establish compressed status of input if not done already
*/
if (in->compressed == -1) {
-#ifdef LIBXML_LZMA_ENABLED
+#ifdef HAVE_LZMA_H
if (in->readcallback == xmlXzfileRead)
in->compressed = __libxml2_xzcompressed(in->context);
#endif
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 006f0cc..b9ed6a4 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -80,7 +80,6 @@ xmlShellReadline(const char *prompt) {
if (prompt != NULL)
fprintf(stdout, "%s", prompt);
- fflush(stdout);
if (!fgets(line_read, 500, stdin))
return(NULL);
line_read[500] = 0;
diff --git a/xmllint.c b/xmllint.c
index 67f7adb..b297ded 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -449,7 +449,7 @@ startTimer(void)
* message about the timing performed; format is a printf
* type argument
*/
-static void XMLCDECL LIBXML_ATTR_FORMAT(1,2)
+static void XMLCDECL
endTimer(const char *fmt, ...)
{
long msec;
@@ -485,7 +485,7 @@ startTimer(void)
{
begin = clock();
}
-static void XMLCDECL LIBXML_ATTR_FORMAT(1,2)
+static void XMLCDECL
endTimer(const char *fmt, ...)
{
long msec;
@@ -514,7 +514,7 @@ startTimer(void)
* Do nothing
*/
}
-static void XMLCDECL LIBXML_ATTR_FORMAT(1,2)
+static void XMLCDECL
endTimer(char *format, ...)
{
/*
@@ -634,7 +634,7 @@ xmlHTMLPrintFileContext(xmlParserInputPtr input) {
* Display and format an error messages, gives file, line, position and
* extra parameters.
*/
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
xmlHTMLError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -671,7 +671,7 @@ xmlHTMLError(void *ctx, const char *msg, ...)
* Display and format a warning messages, gives file, line, position and
* extra parameters.
*/
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
xmlHTMLWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -709,7 +709,7 @@ xmlHTMLWarning(void *ctx, const char *msg, ...)
* Display and format an validity error messages, gives file,
* line, position and extra parameters.
*/
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
xmlHTMLValidityError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -746,7 +746,7 @@ xmlHTMLValidityError(void *ctx, const char *msg, ...)
* Display and format a validity warning messages, gives file, line,
* position and extra parameters.
*/
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
xmlHTMLValidityWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -809,7 +809,6 @@ xmlShellReadline(char *prompt) {
if (prompt != NULL)
fprintf(stdout, "%s", prompt);
- fflush(stdout);
if (!fgets(line_read, 500, stdin))
return(NULL);
line_read[500] = 0;
@@ -1411,7 +1410,7 @@ commentDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *value)
* Display and format a warning messages, gives file, line, position and
* extra parameters.
*/
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
@@ -1434,7 +1433,7 @@ warningDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
* Display and format a error messages, gives file, line, position and
* extra parameters.
*/
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
@@ -1457,7 +1456,7 @@ errorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
* Display and format a fatalError messages, gives file, line, position and
* extra parameters.
*/
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
fatalErrorDebug(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...)
{
va_list args;
@@ -2002,12 +2001,6 @@ static void walkDoc(xmlDocPtr doc) {
xmlNsPtr ns;
root = xmlDocGetRootElement(doc);
- if (root == NULL ) {
- xmlGenericError(xmlGenericErrorContext,
- "Document does not have a root element");
- progresult = XMLLINT_ERR_UNCLASS;
- return;
- }
for (ns = root->nsDef, i = 0;ns != NULL && i < 20;ns=ns->next) {
namespaces[i++] = ns->href;
namespaces[i++] = ns->prefix;
@@ -2974,7 +2967,6 @@ static void showVersion(const char *name) {
if (xmlHasFeature(XML_WITH_XPTR)) fprintf(stderr, "XPointer ");
if (xmlHasFeature(XML_WITH_XINCLUDE)) fprintf(stderr, "XInclude ");
if (xmlHasFeature(XML_WITH_ICONV)) fprintf(stderr, "Iconv ");
- if (xmlHasFeature(XML_WITH_ICU)) fprintf(stderr, "ICU ");
if (xmlHasFeature(XML_WITH_ISO8859X)) fprintf(stderr, "ISO8859X ");
if (xmlHasFeature(XML_WITH_UNICODE)) fprintf(stderr, "Unicode ");
if (xmlHasFeature(XML_WITH_REGEXP)) fprintf(stderr, "Regexps ");
@@ -3054,7 +3046,7 @@ static void usage(const char *name) {
printf("\t--noblanks : drop (ignorable?) blanks spaces\n");
printf("\t--nocdata : replace cdata section with text nodes\n");
#ifdef LIBXML_OUTPUT_ENABLED
- printf("\t--format : reformat/reindent the output\n");
+ printf("\t--format : reformat/reindent the input\n");
printf("\t--encode encoding : output in the given encoding\n");
printf("\t--dropdtd : remove the DOCTYPE of the input docs\n");
printf("\t--pretty STYLE : pretty-print in a particular style\n");
diff --git a/xmlmemory.c b/xmlmemory.c
index f08c8c3..a3dc737 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -109,7 +109,6 @@ typedef struct memnod {
#define RESERVE_SIZE (((HDR_SIZE + (ALIGN_SIZE-1)) \
/ ALIGN_SIZE ) * ALIGN_SIZE)
-#define MAX_SIZE_T ((size_t)-1)
#define CLIENT_2_HDR(a) ((MEMHDR *) (((char *) (a)) - RESERVE_SIZE))
#define HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE))
@@ -218,7 +217,7 @@ xmlMallocLoc(size_t size, const char * file, int line)
/**
* xmlMallocAtomicLoc:
- * @size: an unsigned int specifying the size in byte to allocate.
+ * @size: an int specifying the size in byte to allocate.
* @file: the file name or NULL
* @line: the line number
*
@@ -241,18 +240,11 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
TEST_POINT
- if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlMallocAtomicLoc : Unsigned overflow prevented\n");
- xmlMemoryDump();
- return(NULL);
- }
-
p = (MEMHDR *) malloc(RESERVE_SIZE+size);
if (!p) {
xmlGenericError(xmlGenericErrorContext,
- "xmlMallocAtomicLoc : Out of free space\n");
+ "xmlMallocLoc : Out of free space\n");
xmlMemoryDump();
return(NULL);
}
@@ -562,12 +554,7 @@ xmlMemoryStrdup(const char *str) {
int
xmlMemUsed(void) {
- int res;
-
- xmlMutexLock(xmlMemMutex);
- res = debugMemSize;
- xmlMutexUnlock(xmlMemMutex);
- return(res);
+ return(debugMemSize);
}
/**
@@ -580,12 +567,7 @@ xmlMemUsed(void) {
int
xmlMemBlocks(void) {
- int res;
-
- xmlMutexLock(xmlMemMutex);
- res = debugMemBlocks;
- xmlMutexUnlock(xmlMemMutex);
- return(res);
+ return(debugMemBlocks);
}
#ifdef MEM_LIST
diff --git a/xmlreader.c b/xmlreader.c
index f285790..f19e123 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -142,7 +142,7 @@ struct _xmlTextReader {
xmlNodePtr faketext;/* fake xmlNs chld */
int preserve;/* preserve the resulting document */
xmlBufPtr buffer; /* used to return const xmlChar * */
- xmlDictPtr dict; /* the context dictionary */
+ xmlDictPtr dict; /* the context dictionnary */
/* entity stack when traversing entities content */
xmlNodePtr ent; /* Current Entity Ref Node */
@@ -210,7 +210,7 @@ static int xmlTextReaderNextTree(xmlTextReaderPtr reader);
* DICT_FREE:
* @str: a string
*
- * Free a string if it is not owned by the "dict" dictionary in the
+ * Free a string if it is not owned by the "dict" dictionnary in the
* current scope
*/
#define DICT_FREE(str) \
@@ -2091,9 +2091,6 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
"xmlNewTextReader : malloc failed\n");
return(NULL);
}
- /* no operation on a reader should require a huge buffer */
- xmlBufSetAllocationScheme(ret->buffer,
- XML_BUFFER_ALLOC_BOUNDED);
ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
if (ret->sax == NULL) {
xmlBufFree(ret->buffer);
@@ -2158,7 +2155,7 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
ret->ctxt->dictNames = 1;
ret->allocs = XML_TEXTREADER_CTXT;
/*
- * use the parser dictionary to allocate all elements and attributes names
+ * use the parser dictionnary to allocate all elements and attributes names
*/
ret->ctxt->docdict = 1;
ret->dict = ret->ctxt->dict;
@@ -3619,7 +3616,6 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
return(((xmlNsPtr) node)->href);
case XML_ATTRIBUTE_NODE:{
xmlAttrPtr attr = (xmlAttrPtr) node;
- const xmlChar *ret;
if ((attr->children != NULL) &&
(attr->children->type == XML_TEXT_NODE) &&
@@ -3633,21 +3629,10 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
"xmlTextReaderSetup : malloc failed\n");
return (NULL);
}
- xmlBufSetAllocationScheme(reader->buffer,
- XML_BUFFER_ALLOC_BOUNDED);
} else
xmlBufEmpty(reader->buffer);
xmlBufGetNodeContent(reader->buffer, node);
- ret = xmlBufContent(reader->buffer);
- if (ret == NULL) {
- /* error on the buffer best to reallocate */
- xmlBufFree(reader->buffer);
- reader->buffer = xmlBufCreateSize(100);
- xmlBufSetAllocationScheme(reader->buffer,
- XML_BUFFER_ALLOC_BOUNDED);
- ret = BAD_CAST "";
- }
- return(ret);
+ return(xmlBufContent(reader->buffer));
}
break;
}
@@ -4050,19 +4035,13 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
}
#ifdef LIBXML_SCHEMAS_ENABLED
-static char *xmlTextReaderBuildMessage(const char *msg, va_list ap) LIBXML_ATTR_FORMAT(1,0);
-
-static void XMLCDECL
-xmlTextReaderValidityError(void *ctxt, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
+static char *xmlTextReaderBuildMessage(const char *msg, va_list ap);
static void XMLCDECL
-xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
+xmlTextReaderValidityError(void *ctxt, const char *msg, ...);
static void XMLCDECL
-xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
-
-static void XMLCDECL
-xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
+xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...);
static void XMLCDECL
xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...)
@@ -4856,7 +4835,7 @@ xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error)
}
}
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
xmlTextReaderError(void *ctxt, const char *msg, ...)
{
va_list ap;
@@ -4869,7 +4848,7 @@ xmlTextReaderError(void *ctxt, const char *msg, ...)
}
-static void XMLCDECL LIBXML_ATTR_FORMAT(2,3)
+static void XMLCDECL
xmlTextReaderWarning(void *ctxt, const char *msg, ...)
{
va_list ap;
@@ -5152,9 +5131,6 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
"xmlTextReaderSetup : malloc failed\n");
return (-1);
}
- /* no operation on a reader should require a huge buffer */
- xmlBufSetAllocationScheme(reader->buffer,
- XML_BUFFER_ALLOC_BOUNDED);
if (reader->sax == NULL)
reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
if (reader->sax == NULL) {
@@ -5255,7 +5231,7 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
reader->ctxt->linenumbers = 1;
reader->ctxt->dictNames = 1;
/*
- * use the parser dictionary to allocate all elements and attributes names
+ * use the parser dictionnary to allocate all elements and attributes names
*/
reader->ctxt->docdict = 1;
reader->ctxt->parseMode = XML_PARSE_READER;
diff --git a/xmlregexp.c b/xmlregexp.c
index ca3b4f4..3e912ab 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -1544,7 +1544,6 @@ static int
xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
xmlRegStatePtr to, xmlRegAtomPtr atom) {
xmlRegStatePtr end;
- int nullable = 0;
if (atom == NULL) {
ERROR("genrate transition: atom == NULL");
@@ -1731,13 +1730,6 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
if (xmlRegAtomPush(ctxt, atom) < 0) {
return(-1);
}
- if ((atom->quant == XML_REGEXP_QUANT_RANGE) &&
- (atom->min == 0) && (atom->max > 0)) {
- nullable = 1;
- atom->min = 1;
- if (atom->max == 1)
- atom->quant = XML_REGEXP_QUANT_OPT;
- }
xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1);
ctxt->state = end;
switch (atom->quant) {
@@ -1755,8 +1747,11 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1);
break;
case XML_REGEXP_QUANT_RANGE:
- if (nullable)
+#if DV_test
+ if (atom->min == 0) {
xmlFAGenerateEpsilonTransition(ctxt, from, to);
+ }
+#endif
break;
default:
break;
@@ -5057,12 +5052,11 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) {
ERROR("Expecting the end of a char range");
return;
}
-
+ NEXTL(len);
/* TODO check that the values are acceptable character ranges for XML */
if (end < start) {
ERROR("End of range is before start of range");
} else {
- NEXTL(len);
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, start, end, NULL);
}
@@ -6351,7 +6345,7 @@ struct _xmlExpCtxt {
/**
* xmlExpNewCtxt:
* @maxNodes: the maximum number of nodes
- * @dict: optional dictionary to use internally
+ * @dict: optional dictionnary to use internally
*
* Creates a new context for manipulating expressions
*
@@ -7210,7 +7204,7 @@ xmlExpStringDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp,
return(NULL);
}
/*
- * check the string is in the dictionary, if yes use an interned
+ * check the string is in the dictionnary, if yes use an interned
* copy, otherwise we know it's not an acceptable input
*/
input = xmlDictExists(ctxt->dict, str, len);
diff --git a/xmlsave.c b/xmlsave.c
index 4a8e3f3..774404b 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -2097,8 +2097,8 @@ xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
xmlBufAdd(buf, BAD_CAST "&", 5);
cur++;
base = cur;
- } else if ((*cur >= 0x80) && (cur[1] != 0) &&
- ((doc == NULL) || (doc->encoding == NULL))) {
+ } else if ((*cur >= 0x80) && ((doc == NULL) ||
+ (doc->encoding == NULL))) {
/*
* We assume we have UTF-8 content.
*/
@@ -2121,14 +2121,14 @@ xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
val <<= 6;
val |= (cur[1]) & 0x3F;
l = 2;
- } else if ((*cur < 0xF0) && (cur [2] != 0)) {
+ } else if (*cur < 0xF0) {
val = (cur[0]) & 0x0F;
val <<= 6;
val |= (cur[1]) & 0x3F;
val <<= 6;
val |= (cur[2]) & 0x3F;
l = 3;
- } else if ((*cur < 0xF8) && (cur [2] != 0) && (cur[3] != 0)) {
+ } else if (*cur < 0xF8) {
val = (cur[0]) & 0x07;
val <<= 6;
val |= (cur[1]) & 0x3F;
diff --git a/xmlschemas.c b/xmlschemas.c
index e1b3a4f..0657b66 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -617,7 +617,7 @@ struct _xmlSchemaParserCtxt {
xmlAutomataStatePtr end;
xmlAutomataStatePtr state;
- xmlDictPtr dict; /* dictionary for interned string names */
+ xmlDictPtr dict; /* dictionnary for interned string names */
xmlSchemaTypePtr ctxtType; /* The current context simple/complex type */
int options;
xmlSchemaValidCtxtPtr vctxt;
@@ -1085,7 +1085,7 @@ xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type);
static void
xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt,
const char *funcName,
- const char *message) LIBXML_ATTR_FORMAT(3,0);
+ const char *message);
static int
xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr ctxt,
xmlSchemaTypePtr type,
@@ -1769,7 +1769,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf,
}
FREE_AND_NULL(str)
- return (xmlEscapeFormatString(buf));
+ return (*buf);
}
/**
@@ -1889,7 +1889,7 @@ xmlSchemaPErrMemory(xmlSchemaParserCtxtPtr ctxt,
*
* Handle a parser error
*/
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlSchemaPErr(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error,
const char *msg, const xmlChar * str1, const xmlChar * str2)
{
@@ -1922,7 +1922,7 @@ xmlSchemaPErr(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error,
*
* Handle a parser error
*/
-static void LIBXML_ATTR_FORMAT(5,0)
+static void
xmlSchemaPErr2(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
xmlNodePtr child, int error,
const char *msg, const xmlChar * str1, const xmlChar * str2)
@@ -1951,7 +1951,7 @@ xmlSchemaPErr2(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
*
* Handle a parser error
*/
-static void LIBXML_ATTR_FORMAT(7,0)
+static void
xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error,
const xmlChar * strData1, const xmlChar * strData2,
const xmlChar * strData3, const char *msg, const xmlChar * str1,
@@ -2002,7 +2002,7 @@ xmlSchemaVErrMemory(xmlSchemaValidCtxtPtr ctxt,
extra);
}
-static void LIBXML_ATTR_FORMAT(2,0)
+static void
xmlSchemaPSimpleInternalErr(xmlNodePtr node,
const char *msg, const xmlChar *str)
{
@@ -2013,21 +2013,18 @@ xmlSchemaPSimpleInternalErr(xmlNodePtr node,
#define WXS_ERROR_TYPE_ERROR 1
#define WXS_ERROR_TYPE_WARNING 2
/**
- * xmlSchemaErr4Line:
+ * xmlSchemaErr3:
* @ctxt: the validation context
- * @errorLevel: the error level
- * @error: the error code
* @node: the context node
- * @line: the line number
+ * @error: the error code
* @msg: the error message
* @str1: extra data
* @str2: extra data
* @str3: extra data
- * @str4: extra data
*
* Handle a validation error
*/
-static void LIBXML_ATTR_FORMAT(6,0)
+static void
xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt,
xmlErrorLevel errorLevel,
int error, xmlNodePtr node, int line, const char *msg,
@@ -2142,7 +2139,7 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt,
*
* Handle a validation error
*/
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt,
int error, xmlNodePtr node, const char *msg,
const xmlChar *str1, const xmlChar *str2, const xmlChar *str3)
@@ -2151,7 +2148,7 @@ xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt,
msg, str1, str2, str3, NULL);
}
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt,
int error, xmlNodePtr node, const char *msg,
const xmlChar *str1, const xmlChar *str2,
@@ -2161,7 +2158,7 @@ xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt,
msg, str1, str2, str3, str4);
}
-static void LIBXML_ATTR_FORMAT(4,0)
+static void
xmlSchemaErr(xmlSchemaAbstractCtxtPtr actxt,
int error, xmlNodePtr node, const char *msg,
const xmlChar *str1, const xmlChar *str2)
@@ -2184,7 +2181,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg,
/*
* Don't try to format other nodes than element and
* attribute nodes.
- * Play safe and return an empty string.
+ * Play save and return an empty string.
*/
*msg = xmlStrdup(BAD_CAST "");
return(*msg);
@@ -2249,13 +2246,6 @@ xmlSchemaFormatNodeForError(xmlChar ** msg,
TODO
return (NULL);
}
-
- /*
- * xmlSchemaFormatItemForReport() also returns an escaped format
- * string, so do this before calling it below (in the future).
- */
- xmlEscapeFormatString(msg);
-
/*
* VAL TODO: The output of the given schema component is currently
* disabled.
@@ -2272,7 +2262,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg,
return (*msg);
}
-static void LIBXML_ATTR_FORMAT(3,0)
+static void
xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt,
const char *funcName,
const char *message,
@@ -2283,21 +2273,24 @@ xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt,
if (actxt == NULL)
return;
- msg = xmlStrdup(BAD_CAST "Internal error: %s, ");
+ msg = xmlStrdup(BAD_CAST "Internal error: ");
+ msg = xmlStrcat(msg, BAD_CAST funcName);
+ msg = xmlStrcat(msg, BAD_CAST ", ");
msg = xmlStrcat(msg, BAD_CAST message);
msg = xmlStrcat(msg, BAD_CAST ".\n");
if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR)
- xmlSchemaErr3(actxt, XML_SCHEMAV_INTERNAL, NULL,
- (const char *) msg, (const xmlChar *) funcName, str1, str2);
+ xmlSchemaErr(actxt, XML_SCHEMAV_INTERNAL, NULL,
+ (const char *) msg, str1, str2);
+
else if (actxt->type == XML_SCHEMA_CTXT_PARSER)
- xmlSchemaErr3(actxt, XML_SCHEMAP_INTERNAL, NULL,
- (const char *) msg, (const xmlChar *) funcName, str1, str2);
+ xmlSchemaErr(actxt, XML_SCHEMAP_INTERNAL, NULL,
+ (const char *) msg, str1, str2);
FREE_AND_NULL(msg)
}
-static void LIBXML_ATTR_FORMAT(3,0)
+static void
xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt,
const char *funcName,
const char *message)
@@ -2306,7 +2299,7 @@ xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt,
}
#if 0
-static void LIBXML_ATTR_FORMAT(3,0)
+static void
xmlSchemaPInternalErr(xmlSchemaParserCtxtPtr pctxt,
const char *funcName,
const char *message,
@@ -2318,7 +2311,7 @@ xmlSchemaPInternalErr(xmlSchemaParserCtxtPtr pctxt,
}
#endif
-static void LIBXML_ATTR_FORMAT(5,0)
+static void
xmlSchemaCustomErr4(xmlSchemaAbstractCtxtPtr actxt,
xmlParserErrors error,
xmlNodePtr node,
@@ -2343,7 +2336,7 @@ xmlSchemaCustomErr4(xmlSchemaAbstractCtxtPtr actxt,
FREE_AND_NULL(msg)
}
-static void LIBXML_ATTR_FORMAT(5,0)
+static void
xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt,
xmlParserErrors error,
xmlNodePtr node,
@@ -2358,7 +2351,7 @@ xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt,
-static void LIBXML_ATTR_FORMAT(5,0)
+static void
xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt,
xmlParserErrors error,
xmlNodePtr node,
@@ -2383,7 +2376,7 @@ xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt,
-static void LIBXML_ATTR_FORMAT(5,0)
+static void
xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt,
xmlParserErrors error,
xmlSchemaPSVIIDCNodePtr idcNode,
@@ -2483,13 +2476,11 @@ xmlSchemaSimpleTypeErr(xmlSchemaAbstractCtxtPtr actxt,
msg = xmlStrcat(msg, BAD_CAST " '");
if (type->builtInType != 0) {
msg = xmlStrcat(msg, BAD_CAST "xs:");
- str = xmlStrdup(type->name);
- } else {
- const xmlChar *qName = xmlSchemaFormatQName(&str, type->targetNamespace, type->name);
- if (!str)
- str = xmlStrdup(qName);
- }
- msg = xmlStrcat(msg, xmlEscapeFormatString(&str));
+ msg = xmlStrcat(msg, type->name);
+ } else
+ msg = xmlStrcat(msg,
+ xmlSchemaFormatQName(&str,
+ type->targetNamespace, type->name));
msg = xmlStrcat(msg, BAD_CAST "'");
FREE_AND_NULL(str);
}
@@ -2534,7 +2525,7 @@ xmlSchemaIllegalAttrErr(xmlSchemaAbstractCtxtPtr actxt,
FREE_AND_NULL(msg)
}
-static void LIBXML_ATTR_FORMAT(5,0)
+static void
xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt,
xmlParserErrors error,
xmlNodePtr node,
@@ -2626,7 +2617,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt,
str = xmlStrcat(str, BAD_CAST ", ");
}
str = xmlStrcat(str, BAD_CAST " ).\n");
- msg = xmlStrcat(msg, xmlEscapeFormatString(&str));
+ msg = xmlStrcat(msg, BAD_CAST str);
FREE_AND_NULL(str)
} else
msg = xmlStrcat(msg, BAD_CAST "\n");
@@ -2634,7 +2625,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt,
xmlFree(msg);
}
-static void LIBXML_ATTR_FORMAT(8,0)
+static void
xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt,
xmlParserErrors error,
xmlNodePtr node,
@@ -2925,7 +2916,7 @@ xmlSchemaPIllegalAttrErr(xmlSchemaParserCtxtPtr ctxt,
*
* Reports an error during parsing.
*/
-static void LIBXML_ATTR_FORMAT(5,0)
+static void
xmlSchemaPCustomErrExt(xmlSchemaParserCtxtPtr ctxt,
xmlParserErrors error,
xmlSchemaBasicItemPtr item,
@@ -2961,7 +2952,7 @@ xmlSchemaPCustomErrExt(xmlSchemaParserCtxtPtr ctxt,
*
* Reports an error during parsing.
*/
-static void LIBXML_ATTR_FORMAT(5,0)
+static void
xmlSchemaPCustomErr(xmlSchemaParserCtxtPtr ctxt,
xmlParserErrors error,
xmlSchemaBasicItemPtr item,
@@ -2986,7 +2977,7 @@ xmlSchemaPCustomErr(xmlSchemaParserCtxtPtr ctxt,
*
* Reports an attribute use error during parsing.
*/
-static void LIBXML_ATTR_FORMAT(6,0)
+static void
xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt,
xmlParserErrors error,
xmlNodePtr node,
@@ -3108,7 +3099,7 @@ xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt,
* Reports a simple type validation error.
* TODO: Should this report the value of an element as well?
*/
-static void LIBXML_ATTR_FORMAT(8,0)
+static void
xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt,
xmlParserErrors error,
xmlSchemaBasicItemPtr ownerItem ATTRIBUTE_UNUSED,
@@ -3150,13 +3141,11 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt,
msg = xmlStrcat(msg, BAD_CAST " '");
if (type->builtInType != 0) {
msg = xmlStrcat(msg, BAD_CAST "xs:");
- str = xmlStrdup(type->name);
- } else {
- const xmlChar *qName = xmlSchemaFormatQName(&str, type->targetNamespace, type->name);
- if (!str)
- str = xmlStrdup(qName);
- }
- msg = xmlStrcat(msg, xmlEscapeFormatString(&str));
+ msg = xmlStrcat(msg, type->name);
+ } else
+ msg = xmlStrcat(msg,
+ xmlSchemaFormatQName(&str,
+ type->targetNamespace, type->name));
msg = xmlStrcat(msg, BAD_CAST "'.");
FREE_AND_NULL(str);
}
@@ -3169,9 +3158,7 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt,
}
if (expected) {
msg = xmlStrcat(msg, BAD_CAST " Expected is '");
- xmlChar *expectedEscaped = xmlCharStrdup(expected);
- msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped));
- FREE_AND_NULL(expectedEscaped);
+ msg = xmlStrcat(msg, BAD_CAST expected);
msg = xmlStrcat(msg, BAD_CAST "'.\n");
} else
msg = xmlStrcat(msg, BAD_CAST "\n");
@@ -24199,7 +24186,6 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt,
else
goto pattern_and_enum;
}
-
/*
* Whitespace handling is only of importance for string-based
* types.
@@ -24210,13 +24196,14 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt,
ws = xmlSchemaGetWhiteSpaceFacetValue(type);
} else
ws = XML_SCHEMA_WHITESPACE_COLLAPSE;
-
/*
* If the value was not computed (for string or
* anySimpleType based types), then use the provided
* type.
*/
- if (val != NULL)
+ if (val == NULL)
+ valType = valType;
+ else
valType = xmlSchemaGetValType(val);
ret = 0;
@@ -25559,7 +25546,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt)
if (xmlNewProp(defAttrOwnerElem,
iattr->localName, value) == NULL) {
VERROR_INT("xmlSchemaVAttributesComplex",
- "calling xmlNewProp()");
+ "callling xmlNewProp()");
if (normValue != NULL)
xmlFree(normValue);
goto internal_error;
@@ -27395,17 +27382,10 @@ xmlSchemaSAXHandleStartElementNs(void *ctx,
for (j = 0, i = 0; i < nb_attributes; i++, j += 5) {
/*
- * Duplicate the value, changing any & to a literal ampersand.
- *
- * libxml2 differs from normal SAX here in that it escapes all ampersands
- * as & instead of delivering the raw converted string. Changing the
- * behavior at this point would break applications that use this API, so
- * we are forced to work around it. There is no danger of accidentally
- * decoding some entity other than & in this step because without
- * unescaped ampersands there can be no other entities in the string.
+ * Duplicate the value.
*/
- value = xmlStringLenDecodeEntities(vctxt->parserCtxt, attributes[j+3],
- attributes[j+4] - attributes[j+3], XML_SUBSTITUTE_REF, 0, 0, 0);
+ value = xmlStrndup(attributes[j+3],
+ attributes[j+4] - attributes[j+3]);
/*
* TODO: Set the node line.
*/
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 5f38599..ff64f50 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -62,7 +62,7 @@ struct _xmlSchemaValDate {
long year;
unsigned int mon :4; /* 1 <= mon <= 12 */
unsigned int day :5; /* 1 <= day <= 31 */
- unsigned int hour :5; /* 0 <= hour <= 24 */
+ unsigned int hour :5; /* 0 <= hour <= 23 */
unsigned int min :6; /* 0 <= min <= 59 */
double sec;
unsigned int tz_flag :1; /* is tzo explicitely set? */
@@ -1139,13 +1139,9 @@ static const unsigned int daysInMonthLeap[12] =
#define VALID_DATE(dt) \
(VALID_YEAR(dt->year) && VALID_MONTH(dt->mon) && VALID_MDAY(dt))
-#define VALID_END_OF_DAY(dt) \
- ((dt)->hour == 24 && (dt)->min == 0 && (dt)->sec == 0)
-
#define VALID_TIME(dt) \
- (((VALID_HOUR(dt->hour) && VALID_MIN(dt->min) && \
- VALID_SEC(dt->sec)) || VALID_END_OF_DAY(dt)) && \
- VALID_TZO(dt->tzo))
+ (VALID_HOUR(dt->hour) && VALID_MIN(dt->min) && \
+ VALID_SEC(dt->sec) && VALID_TZO(dt->tzo))
#define VALID_DATETIME(dt) \
(VALID_DATE(dt) && VALID_TIME(dt))
@@ -1359,7 +1355,7 @@ _xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) {
return ret;
if (*cur != ':')
return 1;
- if (!VALID_HOUR(value) && value != 24 /* Allow end-of-day hour */)
+ if (!VALID_HOUR(value))
return 2;
cur++;
@@ -1381,7 +1377,7 @@ _xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) {
if (ret != 0)
return ret;
- if (!VALID_TIME(dt))
+ if ((!VALID_SEC(dt->sec)) || (!VALID_TZO(dt->tzo)))
return 2;
*str = cur;
@@ -5307,7 +5303,6 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType ws)
{
int ret;
- int stringType;
if (facet == NULL)
return(-1);
@@ -5320,15 +5315,7 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
*/
if (value == NULL)
return(-1);
- /*
- * If string-derived type, regexp must be tested on the value space of
- * the datatype.
- * See https://www.w3.org/TR/xmlschema-2/#rf-pattern
- */
- stringType = val && ((val->type >= XML_SCHEMAS_STRING && val->type <= XML_SCHEMAS_NORMSTRING)
- || (val->type >= XML_SCHEMAS_TOKEN && val->type <= XML_SCHEMAS_NCNAME));
- ret = xmlRegexpExec(facet->regexp,
- (stringType && val->value.str) ? val->value.str : value);
+ ret = xmlRegexpExec(facet->regexp, value);
if (ret == 1)
return(0);
if (ret == 0)
diff --git a/xmlstring.c b/xmlstring.c
index cc85777..a37220d 100644
--- a/xmlstring.c
+++ b/xmlstring.c
@@ -457,8 +457,6 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
return(xmlStrndup(add, len));
size = xmlStrlen(cur);
- if (size < 0)
- return(NULL);
ret = (xmlChar *) xmlRealloc(cur, (size + len + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
@@ -486,19 +484,14 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
int size;
xmlChar *ret;
- if (len < 0) {
+ if (len < 0)
len = xmlStrlen(str2);
- if (len < 0)
- return(NULL);
- }
if ((str2 == NULL) || (len == 0))
return(xmlStrdup(str1));
if (str1 == NULL)
return(xmlStrndup(str2, len));
size = xmlStrlen(str1);
- if (size < 0)
- return(NULL);
ret = (xmlChar *) xmlMalloc((size + len + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
@@ -545,7 +538,7 @@ xmlStrcat(xmlChar *cur, const xmlChar *add) {
* Returns the number of characters written to @buf or -1 if an error occurs.
*/
int XMLCDECL
-xmlStrPrintf(xmlChar *buf, int len, const char *msg, ...) {
+xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) {
va_list args;
int ret;
@@ -573,7 +566,7 @@ xmlStrPrintf(xmlChar *buf, int len, const char *msg, ...) {
* Returns the number of characters written to @buf or -1 if an error occurs.
*/
int
-xmlStrVPrintf(xmlChar *buf, int len, const char *msg, va_list ap) {
+xmlStrVPrintf(xmlChar *buf, int len, const xmlChar *msg, va_list ap) {
int ret;
if((buf == NULL) || (msg == NULL)) {
@@ -844,8 +837,8 @@ xmlUTF8Strsize(const xmlChar *utf, int len) {
break;
if ( (ch = *ptr++) & 0x80)
while ((ch<<=1) & 0x80 ) {
- if (*ptr == 0) break;
ptr++;
+ if (*ptr == 0) break;
}
}
return (ptr - utf);
@@ -987,60 +980,5 @@ xmlUTF8Strsub(const xmlChar *utf, int start, int len) {
return(xmlUTF8Strndup(utf, len));
}
-/**
- * xmlEscapeFormatString:
- * @msg: a pointer to the string in which to escape '%' characters.
- * Must be a heap-allocated buffer created by libxml2 that may be
- * returned, or that may be freed and replaced.
- *
- * Replaces the string pointed to by 'msg' with an escaped string.
- * Returns the same string with all '%' characters escaped.
- */
-xmlChar *
-xmlEscapeFormatString(xmlChar **msg)
-{
- xmlChar *msgPtr = NULL;
- xmlChar *result = NULL;
- xmlChar *resultPtr = NULL;
- size_t count = 0;
- size_t msgLen = 0;
- size_t resultLen = 0;
-
- if (!msg || !*msg)
- return(NULL);
-
- for (msgPtr = *msg; *msgPtr != '\0'; ++msgPtr) {
- ++msgLen;
- if (*msgPtr == '%')
- ++count;
- }
-
- if (count == 0)
- return(*msg);
-
- resultLen = msgLen + count + 1;
- result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
- if (result == NULL) {
- /* Clear *msg to prevent format string vulnerabilities in
- out-of-memory situations. */
- xmlFree(*msg);
- *msg = NULL;
- xmlErrMemory(NULL, NULL);
- return(NULL);
- }
-
- for (msgPtr = *msg, resultPtr = result; *msgPtr != '\0'; ++msgPtr, ++resultPtr) {
- *resultPtr = *msgPtr;
- if (*msgPtr == '%')
- *(++resultPtr) = '%';
- }
- result[resultLen - 1] = '\0';
-
- xmlFree(*msg);
- *msg = result;
-
- return *msg;
-}
-
#define bottom_xmlstring
#include "elfgcchack.h"
diff --git a/xmlwriter.c b/xmlwriter.c
index 69541b8..fac20ac 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -113,7 +113,7 @@ static int xmlTextWriterWriteDocCallback(void *context,
const xmlChar * str, int len);
static int xmlTextWriterCloseDocCallback(void *context);
-static xmlChar *xmlTextWriterVSprintf(const char *format, va_list argptr) LIBXML_ATTR_FORMAT(1,0);
+static xmlChar *xmlTextWriterVSprintf(const char *format, va_list argptr);
static int xmlOutputBufferWriteBase64(xmlOutputBufferPtr out, int len,
const unsigned char *data);
static void xmlTextWriterStartDocumentCallback(void *ctx);
@@ -153,7 +153,7 @@ xmlWriterErrMsg(xmlTextWriterPtr ctxt, xmlParserErrors error,
*
* Handle a writer error
*/
-static void LIBXML_ATTR_FORMAT(3,0)
+static void
xmlWriterErrMsgInt(xmlTextWriterPtr ctxt, xmlParserErrors error,
const char *msg, int val)
{
diff --git a/xpath.c b/xpath.c
index 113bce6..dc41ce6 100644
--- a/xpath.c
+++ b/xpath.c
@@ -361,14 +361,14 @@ turtle_comparison:
/*
* compute depth to root
*/
- for (depth2 = 0, cur = node2; cur->parent != NULL; cur = cur->parent) {
- if (cur->parent == node1)
+ for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) {
+ if (cur == node1)
return(1);
depth2++;
}
root = cur;
- for (depth1 = 0, cur = node1; cur->parent != NULL; cur = cur->parent) {
- if (cur->parent == node2)
+ for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) {
+ if (cur == node2)
return(-1);
depth1++;
}
@@ -639,7 +639,7 @@ xmlXPathErrMemory(xmlXPathContextPtr ctxt, const char *extra)
xmlChar buf[200];
xmlStrPrintf(buf, 200,
- "Memory allocation failed : %s\n",
+ BAD_CAST "Memory allocation failed : %s\n",
extra);
ctxt->lastError.message = (char *) xmlStrdup(buf);
} else {
@@ -945,7 +945,7 @@ struct _xmlXPathCompExpr {
xmlXPathStepOp *steps; /* ops for computation of this expression */
int last; /* index of last step in expression */
xmlChar *expr; /* the expression being computed */
- xmlDictPtr dict; /* the dictionary to use if any */
+ xmlDictPtr dict; /* the dictionnary to use if any */
#ifdef DEBUG_EVAL_COUNTS
int nb;
xmlChar *string;
@@ -3706,7 +3706,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
/* @@ with_ns to check whether namespace nodes should be looked at @@ */
/*
- * prevent duplicates
+ * prevent duplcates
*/
for (i = 0;i < cur->nodeNr;i++)
if (cur->nodeTab[i] == val) return(0);
@@ -7933,14 +7933,14 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
xmlNodePtr
xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
- if (cur == NULL)
+ if (cur == NULL) {
+ if (ctxt->context->node == NULL)
+ return(NULL);
+ if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
+ (ctxt->context->node->type == XML_NAMESPACE_DECL))
+ return(NULL);
return(ctxt->context->node);
-
- if (ctxt->context->node == NULL)
- return(NULL);
- if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
- (ctxt->context->node->type == XML_NAMESPACE_DECL))
- return(NULL);
+ }
return(xmlXPathNextDescendant(ctxt, cur));
}
@@ -8390,7 +8390,7 @@ xmlNodePtr
xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL);
- if (cur == NULL) {
+ if (ctxt->context->tmpNsList == NULL && cur != (xmlNodePtr) xmlXPathXMLNamespace) {
if (ctxt->context->tmpNsList != NULL)
xmlFree(ctxt->context->tmpNsList);
ctxt->context->tmpNsList =
@@ -9996,7 +9996,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) {
(c == '[') || (c == ']') || (c == '@') || /* accelerators */
(c == '*') || /* accelerators */
(!IS_LETTER(c) && (c != '_') &&
- ((!qualified) || (c != ':')))) {
+ ((qualified) && (c != ':')))) {
return(NULL);
}
@@ -12379,6 +12379,11 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
STRANGE
goto error;
case NODE_TEST_TYPE:
+ /*
+ * TODO: Don't we need to use
+ * xmlXPathNodeSetAddNs() for namespace nodes here?
+ * Surprisingly, some c14n tests fail, if we do this.
+ */
if (type == NODE_TYPE_NODE) {
switch (cur->type) {
case XML_DOCUMENT_NODE:
@@ -12392,17 +12397,9 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
case XML_COMMENT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_TEXT_NODE:
+ case XML_NAMESPACE_DECL:
XP_TEST_HIT
break;
- case XML_NAMESPACE_DECL: {
- if (axis == AXIS_NAMESPACE) {
- XP_TEST_HIT_NS
- } else {
- hasNsNodes = 1;
- XP_TEST_HIT
- }
- break;
- }
default:
break;
}
@@ -12694,14 +12691,6 @@ error:
* Reset the context node.
*/
xpctxt->node = oldContextNode;
- /*
- * When traversing the namespace axis in "toBool" mode, it's
- * possible that tmpNsList wasn't freed.
- */
- if (xpctxt->tmpNsList != NULL) {
- xmlFree(xpctxt->tmpNsList);
- xpctxt->tmpNsList = NULL;
- }
#ifdef DEBUG_STEP
xmlGenericError(xmlGenericErrorContext,
@@ -14795,10 +14784,6 @@ xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
}
}
- /* OP_VALUE has invalid ch1. */
- if (op->op == XPATH_OP_VALUE)
- return;
-
/* Recurse */
if (op->ch1 != -1)
xmlXPathOptimizeExpression(comp, &comp->steps[op->ch1]);
diff --git a/xpointer.c b/xpointer.c
index 676c510..4b4ac2e 100644
--- a/xpointer.c
+++ b/xpointer.c
@@ -85,7 +85,7 @@ xmlXPtrErrMemory(const char *extra)
*
* Handle a redefinition of attribute error
*/
-static void LIBXML_ATTR_FORMAT(3,0)
+static void
xmlXPtrErr(xmlXPathParserContextPtr ctxt, int error,
const char * msg, const xmlChar *extra)
{
diff --git a/xstc/Makefile.in b/xstc/Makefile.in
index f33abdf..2a9f034 100644
--- a/xstc/Makefile.in
+++ b/xstc/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.13.4 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -14,17 +14,7 @@
@SET_MAKE@
VPATH = @srcdir@
-am__is_gnu_make = { \
- if test -z '$(MAKELEVEL)'; then \
- false; \
- elif test -n '$(MAKE_HOST)'; then \
- true; \
- elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
- true; \
- else \
- false; \
- fi; \
-}
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@@ -88,6 +78,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = xstc
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -95,7 +86,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -120,7 +110,6 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -162,7 +151,6 @@ HTML_DIR = @HTML_DIR@
HTML_OBJ = @HTML_OBJ@
HTTP_OBJ = @HTTP_OBJ@
ICONV_LIBS = @ICONV_LIBS@
-ICU_CFLAGS = @ICU_CFLAGS@
ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -184,10 +172,8 @@ LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
-LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
LZMA_CFLAGS = @LZMA_CFLAGS@
LZMA_LIBS = @LZMA_LIBS@
-MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
@@ -380,7 +366,7 @@ CLEANFILES = $(PYSCRIPTS) test.log
all: all-am
.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -392,6 +378,7 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu xstc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu xstc/Makefile
+.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -404,9 +391,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
@@ -567,8 +554,6 @@ uninstall-am:
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
-.PRECIOUS: Makefile
-
#
# Nothing is done by make, only make tests and
# only if Python and Schemas are enabled.
diff --git a/xzlib.c b/xzlib.c
index 782957f..0dcb9f4 100644
--- a/xzlib.c
+++ b/xzlib.c
@@ -8,7 +8,7 @@
*/
#define IN_LIBXML
#include "libxml.h"
-#ifdef LIBXML_LZMA_ENABLED
+#ifdef HAVE_LZMA_H
#include
#ifdef HAVE_ERRNO_H
@@ -34,9 +34,7 @@
#ifdef HAVE_ZLIB_H
#include
#endif
-#ifdef HAVE_LZMA_H
#include
-#endif
#include "xzlib.h"
#include
@@ -583,10 +581,6 @@ xz_decomp(xz_statep state)
xz_error(state, LZMA_DATA_ERROR, "compressed data error");
return -1;
}
- if (ret == LZMA_PROG_ERROR) {
- xz_error(state, LZMA_PROG_ERROR, "compression error");
- return -1;
- }
} while (strm->avail_out && ret != LZMA_STREAM_END);
/* update available output and crc check value */
@@ -801,4 +795,4 @@ __libxml2_xzclose(xzFile file)
xmlFree(state);
return ret ? ret : LZMA_OK;
}
-#endif /* LIBXML_LZMA_ENABLED */
+#endif /* HAVE_LZMA_H */
--
2.7.4