[Python-checkins] r43671 - python/trunk/Modules/_ctypes/cfield.c

thomas.heller python-checkins at python.org
Wed Apr 5 21:51:19 CEST 2006


Author: thomas.heller
Date: Wed Apr  5 21:51:19 2006
New Revision: 43671

Modified:
   python/trunk/Modules/_ctypes/cfield.c
Log:
Explicitely use 'signed char', to avoid problems on platforms with unsigned char type.

Modified: python/trunk/Modules/_ctypes/cfield.c
==============================================================================
--- python/trunk/Modules/_ctypes/cfield.c	(original)
+++ python/trunk/Modules/_ctypes/cfield.c	Wed Apr  5 21:51:19 2006
@@ -499,7 +499,7 @@
 	long val;
 	if (get_long(value, &val) < 0)
 		return NULL;
-	*(char *)ptr = (char)SET(*(char *)ptr, (char)val, size);
+	*(signed char *)ptr = (signed char)SET(*(signed char *)ptr, (signed char)val, size);
 	_RET(value);
 }
 
@@ -507,7 +507,7 @@
 static PyObject *
 b_get(void *ptr, unsigned size)
 {
-	char val = *(char *)ptr;
+	signed char val = *(signed char *)ptr;
 	GET_BITFIELD(val, size);
 	return PyInt_FromLong(val);
 }


More information about the Python-checkins mailing list