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

Skip to content

Commit 36d4f8b

Browse files
committed
Correct fix by Mark Favas for the cast problems.
1 parent e110dcf commit 36d4f8b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Modules/mmapmodule.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ mmap_read_byte_method (mmap_object * self,
116116
PyObject * args)
117117
{
118118
char value;
119-
char * where = (self->data+self->pos);
119+
char * where;
120120
CHECK_VALID(NULL);
121-
if ((where >= (char *)0) && (where < (self->data+self->size))) {
121+
if (self->pos >= 0 && self->pos < self->size) {
122+
where = self->data + self->pos;
122123
value = (char) *(where);
123124
self->pos += 1;
124125
return Py_BuildValue("c", (char) *(where));
@@ -593,7 +594,7 @@ mmap_ass_slice(self, ilow, ihigh, v)
593594
int ilow, ihigh;
594595
PyObject *v;
595596
{
596-
unsigned char *buf;
597+
const char *buf;
597598

598599
CHECK_VALID(-1);
599600
if (ilow < 0)
@@ -628,7 +629,7 @@ mmap_ass_item(self, i, v)
628629
int i;
629630
PyObject *v;
630631
{
631-
unsigned char *buf;
632+
const char *buf;
632633

633634
CHECK_VALID(-1);
634635
if (i < 0 || i >= self->size) {

0 commit comments

Comments
 (0)