##// END OF EJS Templates
cext: fix compiler warning about sign changing...
Kyle Lippincott -
r44559:969527ac default
parent child Browse files
Show More
@@ -42,17 +42,17 b' typedef struct {'
42 #define MANIFEST_TOO_SHORT_LINE -5
42 #define MANIFEST_TOO_SHORT_LINE -5
43
43
44 /* get the length of the path for a line */
44 /* get the length of the path for a line */
45 static size_t pathlen(line *l)
45 static Py_ssize_t pathlen(line *l)
46 {
46 {
47 const char *end = memchr(l->start, '\0', l->len);
47 const char *end = memchr(l->start, '\0', l->len);
48 return (end) ? (size_t)(end - l->start) : l->len;
48 return (end) ? (Py_ssize_t)(end - l->start) : l->len;
49 }
49 }
50
50
51 /* get the node value of a single line */
51 /* get the node value of a single line */
52 static PyObject *nodeof(line *l)
52 static PyObject *nodeof(line *l)
53 {
53 {
54 char *s = l->start;
54 char *s = l->start;
55 ssize_t llen = pathlen(l);
55 Py_ssize_t llen = pathlen(l);
56 PyObject *hash;
56 PyObject *hash;
57 if (llen + 1 + 40 + 1 > l->len) { /* path '\0' hash '\n' */
57 if (llen + 1 + 40 + 1 > l->len) { /* path '\0' hash '\n' */
58 PyErr_SetString(PyExc_ValueError, "manifest line too short");
58 PyErr_SetString(PyExc_ValueError, "manifest line too short");
@@ -76,7 +76,7 b' static PyObject *nodeof(line *l)'
76 static PyObject *hashflags(line *l)
76 static PyObject *hashflags(line *l)
77 {
77 {
78 char *s = l->start;
78 char *s = l->start;
79 size_t plen = pathlen(l);
79 Py_ssize_t plen = pathlen(l);
80 PyObject *hash = nodeof(l);
80 PyObject *hash = nodeof(l);
81
81
82 /* 40 for hash, 1 for null byte, 1 for newline */
82 /* 40 for hash, 1 for null byte, 1 for newline */
@@ -270,7 +270,7 b' static line *lmiter_nextline(lmIter *sel'
270
270
271 static PyObject *lmiter_iterentriesnext(PyObject *o)
271 static PyObject *lmiter_iterentriesnext(PyObject *o)
272 {
272 {
273 size_t pl;
273 Py_ssize_t pl;
274 line *l;
274 line *l;
275 Py_ssize_t consumed;
275 Py_ssize_t consumed;
276 PyObject *ret = NULL, *path = NULL, *hash = NULL, *flags = NULL;
276 PyObject *ret = NULL, *path = NULL, *hash = NULL, *flags = NULL;
@@ -337,7 +337,7 b' static PyTypeObject lazymanifestEntriesI'
337
337
338 static PyObject *lmiter_iterkeysnext(PyObject *o)
338 static PyObject *lmiter_iterkeysnext(PyObject *o)
339 {
339 {
340 size_t pl;
340 Py_ssize_t pl;
341 line *l = lmiter_nextline((lmIter *)o);
341 line *l = lmiter_nextline((lmIter *)o);
342 if (!l) {
342 if (!l) {
343 return NULL;
343 return NULL;
General Comments 0
You need to be logged in to leave comments. Login now