From 0cbf2c57852d64855b88305dfa7d77f84936a674 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Fri, 26 May 2006 16:23:28 +0000 Subject: [PATCH] fix signed/unsigned mismatch in struct --- Modules/_struct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_struct.c b/Modules/_struct.c index 95b5e0bb05..a114216918 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -763,7 +763,7 @@ bp_uint(char *p, PyObject *v, const formatdef *f) 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 @@ lp_uint(char *p, PyObject *v, const formatdef *f) 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 { -- 2.40.0