# HG changeset patch # User Matt Harbison # Date 2018-08-10 04:14:47 # Node ID acd23830bcd62181ebaaae9a838eb9a14d84b995 # Parent beab6690f2027d2ecfa8189110abe6aa27b70e7a cext: fix most truncation warnings in revlog on Windows There's one more, and I'm not sure why it isn't being tripped on other platforms: mercurial/cext/revlog.c(430) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'char', possible loss of data diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -303,7 +303,7 @@ static PyObject *index_append(indexObjec return NULL; if (self->nt) - nt_insert(self->nt, node, len); + nt_insert(self->nt, node, (int)len); Py_CLEAR(self->headrevs); Py_RETURN_NONE; @@ -578,7 +578,7 @@ static PyObject *reachableroots2(indexOb revstates[parents[1] + 1]) & RS_REACHABLE) && !(revstates[i + 1] & RS_REACHABLE)) { revstates[i + 1] |= RS_REACHABLE; - val = PyInt_FromLong(i); + val = PyInt_FromSsize_t(i); if (val == NULL) goto bail; r = PyList_Append(reachable, val); @@ -665,7 +665,7 @@ static PyObject *compute_phases_map_sets } } /* Transform phase list to a python list */ - phasessize = PyInt_FromLong(len); + phasessize = PyInt_FromSsize_t(len); if (phasessize == NULL) goto release; for (i = 0; i < len; i++) { @@ -674,7 +674,7 @@ static PyObject *compute_phases_map_sets * is computed as a difference */ if (phase != 0) { phaseset = PyList_GET_ITEM(phasessetlist, phase); - rev = PyInt_FromLong(i); + rev = PyInt_FromSsize_t(i); if (rev == NULL) goto release; PySet_Add(phaseset, rev);