#include <limits.h>
#include <string.h>
+#include <stddef.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
int misc = 0, precedence1 = 0, precedence2 = 0;
xmlNodePtr miscNode1 = NULL, miscNode2 = NULL;
xmlNodePtr cur, root;
- long l1, l2;
+ ptrdiff_t l1, l2;
if ((node1 == NULL) || (node2 == NULL))
return(-2);
switch (node1->type) {
case XML_ELEMENT_NODE:
if (node2->type == XML_ELEMENT_NODE) {
- if ((0 > (long) node1->content) && /* TODO: Would a != 0 suffice here? */
- (0 > (long) node2->content) &&
+ if ((0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc))
{
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
node1 = node1->parent;
}
if ((node1 == NULL) || (node1->type != XML_ELEMENT_NODE) ||
- (0 <= (long) node1->content)) {
+ (0 <= (ptrdiff_t) node1->content)) {
/*
* Fallback for whatever case.
*/
node2 = node2->parent;
}
if ((node2 == NULL) || (node2->type != XML_ELEMENT_NODE) ||
- (0 <= (long) node2->content))
+ (0 <= (ptrdiff_t) node2->content))
{
node2 = miscNode2;
precedence2 = 0;
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
- (0 > (long) node1->content) &&
- (0 > (long) node2->content) &&
+ (0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc)) {
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
- (0 > (long) node1->content) &&
- (0 > (long) node2->content) &&
+ (0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc)) {
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
*/
long
xmlXPathOrderDocElems(xmlDocPtr doc) {
- long count = 0;
+ ptrdiff_t count = 0;
xmlNodePtr cur;
if (doc == NULL)
}
} while (cur != NULL);
}
- return(count);
+ return((long) count);
}
/**
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
- (0 > (long) node1->content) &&
- (0 > (long) node2->content) &&
+ (0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc)) {
- long l1, l2;
+ ptrdiff_t l1, l2;
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
- (0 > (long) node1->content) &&
- (0 > (long) node2->content) &&
+ (0 > (ptrdiff_t) node1->content) &&
+ (0 > (ptrdiff_t) node2->content) &&
(node1->doc == node2->doc)) {
- long l1, l2;
+ ptrdiff_t l1, l2;
- l1 = -((long) node1->content);
- l2 = -((long) node2->content);
+ l1 = -((ptrdiff_t) node1->content);
+ l2 = -((ptrdiff_t) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
}
while (tmp != NULL) {
switch (tmp->type) {
- case XML_COMMENT_NODE:
- case XML_PI_NODE:
case XML_CDATA_SECTION_NODE:
case XML_TEXT_NODE:
string = tmp->content;
break;
- case XML_NAMESPACE_DECL:
- string = ((xmlNsPtr)tmp)->href;
- break;
default:
+ string = NULL;
break;
}
if ((string != NULL) && (string[0] != 0)) {
valuePush(ctxt, arg2);
xmlXPathNumberFunction(ctxt, 1);
arg2 = valuePop(ctxt);
- /* no break on purpose */
+ /* Falls through. */
case XPATH_NUMBER:
/* Hand check NaN and Infinity equalities */
if (xmlXPathIsNaN(arg1->floatval) ||