[libxml2] Various cleanups to avoid compiler warnings



commit 7651606f316c366a6d66358b72b3527a829fb7fe
Author: Daniel Veillard <veillard redhat com>
Date:   Tue Sep 11 14:02:08 2012 +0800

    Various cleanups to avoid compiler warnings

 SAX2.c     |    2 +-
 entities.c |    5 ++++-
 timsort.h  |   15 ++++++++-------
 xpath.c    |    5 ++---
 4 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/SAX2.c b/SAX2.c
index 90ba5da..a24abc8 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -1889,7 +1889,7 @@ skip:
 	    else {
 	        ret->line = 65535;
 		if (ctxt->options & XML_PARSE_BIG_LINES)
-		    ret->psvi = (void *) ctxt->input->line;
+		    ret->psvi = (void *) (long) ctxt->input->line;
 	    }
 	}
     }
diff --git a/entities.c b/entities.c
index ffaa1d7..5e786a1 100644
--- a/entities.c
+++ b/entities.c
@@ -22,6 +22,8 @@
 #include <libxml/globals.h>
 #include <libxml/dict.h>
 
+#include "save.h"
+
 /*
  * The XML predefined entities.
  */
@@ -620,7 +622,8 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
 	     * Special handling of &{...} construct from HTML 4, see
 	     * http://www.w3.org/TR/html401/appendix/notes.html#h-B.7.1
 	     */
-	    if (html && attr && (cur[1] == '{') && (strchr(cur, '}'))) {
+	    if (html && attr && (cur[1] == '{') &&
+	        (strchr((const char *) cur, '}'))) {
 	        while (*cur != '}') {
 		    *out++ = *cur++;
 		    indx = out - buffer;
diff --git a/timsort.h b/timsort.h
index 26ebe86..95f412b 100644
--- a/timsort.h
+++ b/timsort.h
@@ -172,7 +172,7 @@ static int64_t BINARY_INSERTION_FIND(SORT_TYPE *dst, const SORT_TYPE x, const si
 static void BINARY_INSERTION_SORT_START(SORT_TYPE *dst, const size_t start, const size_t size)
 {
   int64_t i;
-  for (i = start; i < size; i++)
+  for (i = start; i < (int64_t) size; i++)
   {
     int64_t j;
     SORT_TYPE x;
@@ -214,7 +214,7 @@ static int64_t COUNT_RUN(SORT_TYPE *dst, const int64_t start, const size_t size)
 {
   int64_t curr;
   if (size - start == 1) return 1;
-  if (start >= size - 2)
+  if (start >= (int64_t) size - 2)
   {
     if (SORT_CMP(dst[size - 2], dst[size - 1]) > 0)
       SORT_SWAP(dst[size - 2], dst[size - 1]);
@@ -228,7 +228,7 @@ static int64_t COUNT_RUN(SORT_TYPE *dst, const int64_t start, const size_t size)
     /* increasing run */
     while (1)
     {
-      if (curr == size - 1) break;
+      if (curr == (int64_t) size - 1) break;
       if (SORT_CMP(dst[curr - 1], dst[curr]) > 0) break;
       curr++;
     }
@@ -239,7 +239,7 @@ static int64_t COUNT_RUN(SORT_TYPE *dst, const int64_t start, const size_t size)
     /* decreasing run */
     while (1)
     {
-      if (curr == size - 1) break;
+      if (curr == (int64_t) size - 1) break;
       if (SORT_CMP(dst[curr - 1], dst[curr]) <= 0) break;
       curr++;
     }
@@ -253,7 +253,7 @@ static int64_t COUNT_RUN(SORT_TYPE *dst, const int64_t start, const size_t size)
 len = COUNT_RUN(dst, curr, size);\
 run = minrun;\
 if (run < minrun) run = minrun;\
-if (run > size - curr) run = size - curr;\
+if (run > (int64_t) size - curr) run = size - curr;\
 if (run > len)\
 {\
   BINARY_INSERTION_SORT_START(&dst[curr], len, run);\
@@ -265,7 +265,7 @@ run_stack[stack_curr].length = len;\
 stack_curr++;\
 }\
 curr += len;\
-if (curr == size)\
+if (curr == (int64_t) size)\
 {\
   /* finish up */ \
   while (stack_curr > 1) \
@@ -390,7 +390,8 @@ static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_cu
     /* if the stack only has one thing on it, we are done with the collapse */
     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;
diff --git a/xpath.c b/xpath.c
index c3236ed..9a82e90 100644
--- a/xpath.c
+++ b/xpath.c
@@ -7771,6 +7771,7 @@ xmlXPathNextChildElement(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
     return(NULL);
 }
 
+#if 0
 /**
  * xmlXPathNextDescendantOrSelfElemParent:
  * @ctxt:  the XPath Parser context
@@ -7846,6 +7847,7 @@ next_sibling:
     }
     return(NULL);
 }
+#endif
 
 /**
  * xmlXPathNextDescendant:
@@ -12111,8 +12113,6 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
     xmlNodeSetPtr contextSeq;
     int contextIdx;
     xmlNodePtr contextNode;
-    /* The context node for a compound traversal */
-    xmlNodePtr outerContextNode;
     /* The final resulting node set wrt to all context nodes */
     xmlNodeSetPtr outSeq;
     /*
@@ -12306,7 +12306,6 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
     addNode = xmlXPathNodeSetAddUnique;
     outSeq = NULL;
     seq = NULL;
-    outerContextNode = NULL;
     contextNode = NULL;
     contextIdx = 0;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]