[Python-checkins] r46354 - python/trunk/Modules/_struct.c

bob.ippolito python-checkins at python.org
Fri May 26 18:23:29 CEST 2006


Author: bob.ippolito
Date: Fri May 26 18:23:28 2006
New Revision: 46354

Modified:
   python/trunk/Modules/_struct.c
Log:
fix signed/unsigned mismatch in struct

Modified: python/trunk/Modules/_struct.c
==============================================================================
--- python/trunk/Modules/_struct.c	(original)
+++ python/trunk/Modules/_struct.c	Fri May 26 18:23:28 2006
@@ -763,7 +763,7 @@
 		return -1;
 	i = f->size;
 #ifdef PY_STRUCT_RANGE_CHECKING
-	if (i != SIZEOF_LONG && x >= (1 << (i * 8)))
+	if (i != SIZEOF_LONG && x >= (1 << (((unsigned int)i) * 8)))
 		return _range_error(f->format, f->size, 1);
 #endif
 	do {
@@ -975,7 +975,7 @@
 		return -1;
 	i = f->size;
 #ifdef PY_STRUCT_RANGE_CHECKING
-	if (i != SIZEOF_LONG && x >= (1 << (i * 8)))
+	if (i != SIZEOF_LONG && x >= (1 << (((unsigned int)i) * 8)))
 		return _range_error(f->format, f->size, 1);
 #endif
 	do {


More information about the Python-checkins mailing list