comparison mercurial/cext/revlog.c @ 39074:acd23830bcd6

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
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 10 Aug 2018 00:14:47 -0400
parents beab6690f202
children b935adb4b041
comparison
equal deleted inserted replaced
39073:beab6690f202 39074:acd23830bcd6
301 301
302 if (PyList_Append(self->added, obj) == -1) 302 if (PyList_Append(self->added, obj) == -1)
303 return NULL; 303 return NULL;
304 304
305 if (self->nt) 305 if (self->nt)
306 nt_insert(self->nt, node, len); 306 nt_insert(self->nt, node, (int)len);
307 307
308 Py_CLEAR(self->headrevs); 308 Py_CLEAR(self->headrevs);
309 Py_RETURN_NONE; 309 Py_RETURN_NONE;
310 } 310 }
311 311
576 goto bail; 576 goto bail;
577 if (((revstates[parents[0] + 1] | 577 if (((revstates[parents[0] + 1] |
578 revstates[parents[1] + 1]) & RS_REACHABLE) 578 revstates[parents[1] + 1]) & RS_REACHABLE)
579 && !(revstates[i + 1] & RS_REACHABLE)) { 579 && !(revstates[i + 1] & RS_REACHABLE)) {
580 revstates[i + 1] |= RS_REACHABLE; 580 revstates[i + 1] |= RS_REACHABLE;
581 val = PyInt_FromLong(i); 581 val = PyInt_FromSsize_t(i);
582 if (val == NULL) 582 if (val == NULL)
583 goto bail; 583 goto bail;
584 r = PyList_Append(reachable, val); 584 r = PyList_Append(reachable, val);
585 Py_DECREF(val); 585 Py_DECREF(val);
586 if (r < 0) 586 if (r < 0)
663 goto release; 663 goto release;
664 set_phase_from_parents(phases, parents[0], parents[1], i); 664 set_phase_from_parents(phases, parents[0], parents[1], i);
665 } 665 }
666 } 666 }
667 /* Transform phase list to a python list */ 667 /* Transform phase list to a python list */
668 phasessize = PyInt_FromLong(len); 668 phasessize = PyInt_FromSsize_t(len);
669 if (phasessize == NULL) 669 if (phasessize == NULL)
670 goto release; 670 goto release;
671 for (i = 0; i < len; i++) { 671 for (i = 0; i < len; i++) {
672 phase = phases[i]; 672 phase = phases[i];
673 /* We only store the sets of phase for non public phase, the public phase 673 /* We only store the sets of phase for non public phase, the public phase
674 * is computed as a difference */ 674 * is computed as a difference */
675 if (phase != 0) { 675 if (phase != 0) {
676 phaseset = PyList_GET_ITEM(phasessetlist, phase); 676 phaseset = PyList_GET_ITEM(phasessetlist, phase);
677 rev = PyInt_FromLong(i); 677 rev = PyInt_FromSsize_t(i);
678 if (rev == NULL) 678 if (rev == NULL)
679 goto release; 679 goto release;
680 PySet_Add(phaseset, rev); 680 PySet_Add(phaseset, rev);
681 Py_XDECREF(rev); 681 Py_XDECREF(rev);
682 } 682 }