# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1533874487 14400
#      Fri Aug 10 00:14:47 2018 -0400
# Node ID eb3d685ec313b5d5bca7824e5e3e577509a486de
# Parent  87d4715a29768208e0345cc6314ad267c8711df6
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
@@ -304,7 +304,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;
@@ -579,7 +579,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);
@@ -666,7 +666,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++) {
@@ -675,7 +675,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);
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to