parsers: correct type of temporary variables for dirstate tuple fields
authorYuya Nishihara <yuya@tcha.org>
Sat, 17 Oct 2015 23:14:13 +0900
changeset 26774 04ab2348efd1
parent 26773 ec7e0dbe56d5
child 26775 3c259710737c
parsers: correct type of temporary variables for dirstate tuple fields These fields are defined as int. This eliminates the following warning spotted by CC=clang CFLAGS='-Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wshorten-64-to-32': mercurial/parsers.c:625:29: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare] if (state == 'n' && mtime == now) {
mercurial/parsers.c
--- a/mercurial/parsers.c	Fri Oct 16 02:53:57 2015 +0100
+++ b/mercurial/parsers.c	Sat Oct 17 23:14:13 2015 +0900
@@ -606,7 +606,7 @@
 	for (pos = 0; PyDict_Next(map, &pos, &k, &v); ) {
 		dirstateTupleObject *tuple;
 		char state;
-		uint32_t mode, size, mtime;
+		int mode, size, mtime;
 		Py_ssize_t len, l;
 		PyObject *o;
 		char *t;
@@ -636,9 +636,9 @@
 			mtime_unset = NULL;
 		}
 		*p++ = state;
-		putbe32(mode, p);
-		putbe32(size, p + 4);
-		putbe32(mtime, p + 8);
+		putbe32((uint32_t)mode, p);
+		putbe32((uint32_t)size, p + 4);
+		putbe32((uint32_t)mtime, p + 8);
 		t = p + 12;
 		p += 16;
 		len = PyString_GET_SIZE(k);