[PATCH in crew] parsers: fix an integer size warning issued by clang

Bryan O'Sullivan bos at serpentine.com
Mon Aug 13 16:07:46 CDT 2012


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1344891892 25200
# Node ID 511dfb34b4122268617c05c13d0809f3b5507feb
# Parent  c25531ed58b0b92814fbe3a7ac542ac7b4c28a23
parsers: fix an integer size warning issued by clang

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -9,6 +9,7 @@
 
 #include <Python.h>
 #include <ctype.h>
+#include <stddef.h>
 #include <string.h>
 
 #include "util.h"
@@ -72,7 +73,7 @@ static PyObject *parse_manifest(PyObject
 	for (start = cur = str, zero = NULL; cur < str + len; cur++) {
 		PyObject *file = NULL, *node = NULL;
 		PyObject *flags = NULL;
-		int nlen;
+		ptrdiff_t nlen;
 
 		if (!*cur) {
 			zero = cur;
@@ -94,7 +95,7 @@ static PyObject *parse_manifest(PyObject
 
 		nlen = cur - zero - 1;
 
-		node = unhexlify(zero + 1, nlen > 40 ? 40 : nlen);
+		node = unhexlify(zero + 1, nlen > 40 ? 40 : (int)nlen);
 		if (!node)
 			goto bail;
 


More information about the Mercurial-devel mailing list