diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2017-10-09 13:37:42 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2017-10-09 13:47:49 +0200 |
commit | d422b954be178afca1abeded9054ee6e39272904 (patch) | |
tree | 77bd0a2732bbdb9fe7939ed4767165b200db1c99 /tree.c | |
parent | 41c0a13fe7455bbdd3aa785a67ded91058f81333 (diff) | |
download | libxml2-d422b954be178afca1abeded9054ee6e39272904.tar.gz |
Fix pointer/int cast warnings on 64-bit Windows
On 64-bit Windows, `long` is 32 bits wide and can't hold a pointer.
Switch to ptrdiff_t instead which should be the same size as a pointer
on every somewhat sane platform without requiring C99 types like
intptr_t.
Fixes bug 788312.
Thanks to J. Peter Mugaas for the report and initial patch.
Diffstat (limited to 'tree.c')
-rw-r--r-- | tree.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -19,6 +19,7 @@ #include "libxml.h" #include <string.h> /* for memset() only ! */ +#include <stddef.h> #include <limits.h> #ifdef HAVE_CTYPE_H #include <ctype.h> @@ -4605,7 +4606,7 @@ xmlGetLineNoInternal(const xmlNode *node, int depth) (node->type == XML_PI_NODE)) { if (node->line == 65535) { if ((node->type == XML_TEXT_NODE) && (node->psvi != NULL)) - result = (long) node->psvi; + result = (long) (ptrdiff_t) node->psvi; else if ((node->type == XML_ELEMENT_NODE) && (node->children != NULL)) result = xmlGetLineNoInternal(node->children, depth + 1); |