Mercurial > hg
comparison mercurial/parsers.c @ 17356:511dfb34b412
parsers: fix an integer size warning issued by clang
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Mon, 13 Aug 2012 14:04:52 -0700 |
parents | bde1185f406c |
children | 318fb32b980e |
comparison
equal
deleted
inserted
replaced
17355:c25531ed58b0 | 17356:511dfb34b412 |
---|---|
7 the GNU General Public License, incorporated herein by reference. | 7 the GNU General Public License, incorporated herein by reference. |
8 */ | 8 */ |
9 | 9 |
10 #include <Python.h> | 10 #include <Python.h> |
11 #include <ctype.h> | 11 #include <ctype.h> |
12 #include <stddef.h> | |
12 #include <string.h> | 13 #include <string.h> |
13 | 14 |
14 #include "util.h" | 15 #include "util.h" |
15 | 16 |
16 static inline int hexdigit(const char *p, Py_ssize_t off) | 17 static inline int hexdigit(const char *p, Py_ssize_t off) |
70 goto quit; | 71 goto quit; |
71 | 72 |
72 for (start = cur = str, zero = NULL; cur < str + len; cur++) { | 73 for (start = cur = str, zero = NULL; cur < str + len; cur++) { |
73 PyObject *file = NULL, *node = NULL; | 74 PyObject *file = NULL, *node = NULL; |
74 PyObject *flags = NULL; | 75 PyObject *flags = NULL; |
75 int nlen; | 76 ptrdiff_t nlen; |
76 | 77 |
77 if (!*cur) { | 78 if (!*cur) { |
78 zero = cur; | 79 zero = cur; |
79 continue; | 80 continue; |
80 } | 81 } |
92 if (!file) | 93 if (!file) |
93 goto bail; | 94 goto bail; |
94 | 95 |
95 nlen = cur - zero - 1; | 96 nlen = cur - zero - 1; |
96 | 97 |
97 node = unhexlify(zero + 1, nlen > 40 ? 40 : nlen); | 98 node = unhexlify(zero + 1, nlen > 40 ? 40 : (int)nlen); |
98 if (!node) | 99 if (!node) |
99 goto bail; | 100 goto bail; |
100 | 101 |
101 if (nlen > 40) { | 102 if (nlen > 40) { |
102 flags = PyBytes_FromStringAndSize(zero + 41, | 103 flags = PyBytes_FromStringAndSize(zero + 41, |