# HG changeset patch # User Yuya Nishihara # Date 2015-10-17 14:14:13 # Node ID 04ab2348efd1e0f06a52ade2398f9f6d6d8b60be # Parent ec7e0dbe56d5d50b76bbdf1e7429fcd6d8827b78 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) { diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -606,7 +606,7 @@ static PyObject *pack_dirstate(PyObject 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 @@ static PyObject *pack_dirstate(PyObject 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);