Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce8e1dc

Browse files
committed
clean up warnings in Win32 build of mmapmodule.c
1 parent 9f754e0 commit ce8e1dc

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Modules/mmapmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ mmap_item(self, i)
568568
int i;
569569
{
570570
CHECK_VALID(NULL);
571-
if (i < 0 || i >= self->size) {
571+
if (i < 0 || (size_t)i >= self->size) {
572572
PyErr_SetString(PyExc_IndexError, "mmap index out of range");
573573
return NULL;
574574
}
@@ -583,13 +583,13 @@ mmap_slice(self, ilow, ihigh)
583583
CHECK_VALID(NULL);
584584
if (ilow < 0)
585585
ilow = 0;
586-
else if (ilow > self->size)
586+
else if ((size_t)ilow > self->size)
587587
ilow = self->size;
588588
if (ihigh < 0)
589589
ihigh = 0;
590590
if (ihigh < ilow)
591591
ihigh = ilow;
592-
else if (ihigh > self->size)
592+
else if ((size_t)ihigh > self->size)
593593
ihigh = self->size;
594594

595595
return PyString_FromStringAndSize(self->data + ilow, ihigh-ilow);
@@ -628,13 +628,13 @@ mmap_ass_slice(self, ilow, ihigh, v)
628628
CHECK_VALID(-1);
629629
if (ilow < 0)
630630
ilow = 0;
631-
else if (ilow > self->size)
631+
else if ((size_t)ilow > self->size)
632632
ilow = self->size;
633633
if (ihigh < 0)
634634
ihigh = 0;
635635
if (ihigh < ilow)
636636
ihigh = ilow;
637-
else if (ihigh > self->size)
637+
else if ((size_t)ihigh > self->size)
638638
ihigh = self->size;
639639

640640
if (! (PyString_Check(v)) ) {
@@ -661,7 +661,7 @@ mmap_ass_item(self, i, v)
661661
const char *buf;
662662

663663
CHECK_VALID(-1);
664-
if (i < 0 || i >= self->size) {
664+
if (i < 0 || (size_t)i >= self->size) {
665665
PyErr_SetString(PyExc_IndexError, "mmap index out of range");
666666
return -1;
667667
}

0 commit comments

Comments
 (0)