[Python-checkins] CVS: python/dist/src/Modules mmapmodule.c,2.30,2.31

Tim Peters tim_one@users.sourceforge.net
2001年5月14日 16:19:14 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv27951/python/dist/src/Modules
Modified Files:
	mmapmodule.c 
Log Message:
Fix new compiler warnings. Also boost "start" from (C) int to long and
return a (C) long: PyArg_ParseTuple and Py_BuildValue may not let us get
at the size_t we really want, but C int is clearly too small for a 64-bit
box, and both the start parameter and the return value should work for
large mapped files even on 32-bit boxes. The code really needs to be
rethought from scratch (not by me, though ...).
Index: mmapmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v
retrieving revision 2.30
retrieving revision 2.31
diff -C2 -r2.30 -r2.31
*** mmapmodule.c	2001年05月14日 09:32:26	2.30
--- mmapmodule.c	2001年05月14日 23:19:12	2.31
***************
*** 225,234 ****
 		 PyObject *args)
 {
! 	int start = self->pos;
 	char *needle;
 	int len;
 
 	CHECK_VALID(NULL);
! 	if (!PyArg_ParseTuple (args, "s#|i:find", &needle, &len, &start)) {
 		return NULL;
 	} else {
--- 225,234 ----
 		 PyObject *args)
 {
! 	long start = self->pos;
 	char *needle;
 	int len;
 
 	CHECK_VALID(NULL);
! 	if (!PyArg_ParseTuple (args, "s#|l:find", &needle, &len, &start)) {
 		return NULL;
 	} else {
***************
*** 240,244 ****
 if (start < 0)
 start = 0;
! else if (start > self->size)
 start = self->size;
 p = self->data + start;
--- 240,244 ----
 if (start < 0)
 start = 0;
! else if ((size_t)start > self->size)
 start = self->size;
 p = self->data + start;
***************
*** 252,257 ****
 			if (!*n) {
 				return Py_BuildValue (
! 					"i",
! 					(int) (p - self->data));
 			}
 			p++;
--- 252,257 ----
 			if (!*n) {
 				return Py_BuildValue (
! 					"l",
! 					(long) (p - self->data));
 			}
 			p++;

AltStyle によって変換されたページ (->オリジナル) /