[Python-checkins] python/dist/src/Python ceval.c, 2.423, 2.424 compile.c, 2.349, 2.350 marshal.c, 1.86, 1.87

bcannon@users.sourceforge.net bcannon at users.sourceforge.net
Sat Jun 25 10:23:44 CEST 2005


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2413/Python

Modified Files:
	ceval.c compile.c marshal.c 
Log Message:
Fix signedness of various char variables to stop causing a warning under gcc 4.


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.423
retrieving revision 2.424
diff -u -d -r2.423 -r2.424
--- ceval.c	25 Jun 2005 07:07:35 -0000	2.423
+++ ceval.c	25 Jun 2005 08:23:40 -0000	2.424
@@ -721,7 +721,7 @@
 	consts = co->co_consts;
 	fastlocals = f->f_localsplus;
 	freevars = f->f_localsplus + f->f_nlocals;
-	first_instr = PyString_AS_STRING(co->co_code);
+	first_instr = (unsigned char*) PyString_AS_STRING(co->co_code);
 	/* An explanation is in order for the next line.
 
 	   f->f_lasti now refers to the index of the last instruction

Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.349
retrieving revision 2.350
diff -u -d -r2.349 -r2.350
--- compile.c	5 Mar 2005 06:47:57 -0000	2.349
+++ compile.c	25 Jun 2005 08:23:41 -0000	2.350
@@ -662,7 +662,7 @@
 
 	/* Bypass optimization when the lineno table is too complex */
 	assert(PyString_Check(lineno_obj));
-	lineno = PyString_AS_STRING(lineno_obj);
+	lineno = (unsigned char*)PyString_AS_STRING(lineno_obj);
 	tabsiz = PyString_GET_SIZE(lineno_obj);
 	if (memchr(lineno, 255, tabsiz) != NULL)
 		goto exitUnchanged;

Index: marshal.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- marshal.c	13 Jun 2005 18:28:46 -0000	1.86
+++ marshal.c	25 Jun 2005 08:23:41 -0000	1.87
@@ -169,14 +169,14 @@
 	}
 	else if (PyFloat_Check(v)) {
 		if (p->version > 1) {
-			char buf[8];
+			unsigned char buf[8];
 			if (_PyFloat_Pack8(PyFloat_AsDouble(v), 
 					   buf, 1) < 0) {
 				p->error = 1;
 				return;
 			}
 			w_byte(TYPE_BINARY_FLOAT, p);
-			w_string(buf, 8, p);
+			w_string((char*)buf, 8, p);
 		}
 		else {
 			char buf[256]; /* Plenty to format any double */
@@ -190,20 +190,20 @@
 #ifndef WITHOUT_COMPLEX
 	else if (PyComplex_Check(v)) {
 		if (p->version > 1) {
-			char buf[8];
+			unsigned char buf[8];
 			if (_PyFloat_Pack8(PyComplex_RealAsDouble(v),
 					   buf, 1) < 0) {
 				p->error = 1;
 				return;
 			}
 			w_byte(TYPE_BINARY_COMPLEX, p);
-			w_string(buf, 8, p);
+			w_string((char*)buf, 8, p);
 			if (_PyFloat_Pack8(PyComplex_ImagAsDouble(v), 
 					   buf, 1) < 0) {
 				p->error = 1;
 				return;
 			}
-			w_string(buf, 8, p);
+			w_string((char*)buf, 8, p);
 		}
 		else {
 			char buf[256]; /* Plenty to format any double */
@@ -556,9 +556,9 @@
 
 	case TYPE_BINARY_FLOAT:
 		{
-			char buf[8];
+			unsigned char buf[8];
 			double x;
-			if (r_string(buf, 8, p) != 8) {
+			if (r_string((char*)buf, 8, p) != 8) {
 				PyErr_SetString(PyExc_EOFError,
 					"EOF read where object expected");
 				return NULL;
@@ -600,9 +600,9 @@
 
 	case TYPE_BINARY_COMPLEX:
 		{
-			char buf[8];
+			unsigned char buf[8];
 			Py_complex c;
-			if (r_string(buf, 8, p) != 8) {
+			if (r_string((char*)buf, 8, p) != 8) {
 				PyErr_SetString(PyExc_EOFError,
 					"EOF read where object expected");
 				return NULL;
@@ -611,7 +611,7 @@
 			if (c.real == -1.0 && PyErr_Occurred()) {
 				return NULL;
 			}
-			if (r_string(buf, 8, p) != 8) {
+			if (r_string((char*)buf, 8, p) != 8) {
 				PyErr_SetString(PyExc_EOFError,
 					"EOF read where object expected");
 				return NULL;



More information about the Python-checkins mailing list