diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-06-17 08:11:07 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-06-17 08:11:07 (GMT) |
commit | 85e6635edf4c56064fddd09f5350936dcd650389 (patch) | |
tree | a9d8467f74fb3b554acefbbcf901f3acf3784b7c /Modules | |
parent | ec721f3305c04b5d136e2d21cb73c5bdfdd81684 (diff) | |
download | cpython-85e6635edf4c56064fddd09f5350936dcd650389.zip cpython-85e6635edf4c56064fddd09f5350936dcd650389.tar.gz cpython-85e6635edf4c56064fddd09f5350936dcd650389.tar.bz2 |
ctypes: the type of b_size is Py_ssize_t.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index c49abf0..311fb5d 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1124,7 +1124,7 @@ CharArray_get_raw(CDataObject *self) static PyObject * CharArray_get_value(CDataObject *self) { - int i; + Py_ssize_t i; char *ptr = self->b_ptr; for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') @@ -1180,9 +1180,9 @@ static PyGetSetDef CharArray_getsets[] = { static PyObject * WCharArray_get_value(CDataObject *self) { - unsigned int i; + Py_ssize_t i; wchar_t *ptr = (wchar_t *)self->b_ptr; - for (i = 0; i < self->b_size/sizeof(wchar_t); ++i) + for (i = 0; i < self->b_size/(Py_ssize_t)sizeof(wchar_t); ++i) if (*ptr++ == (wchar_t)0) break; return PyUnicode_FromWideChar((wchar_t *)self->b_ptr, i); @@ -1211,7 +1211,7 @@ WCharArray_set_value(CDataObject *self, PyObject *value) wstr = PyUnicode_AsUnicodeAndSize(value, &len); if (wstr == NULL) return -1; - if ((unsigned)len > self->b_size/sizeof(wchar_t)) { + if ((size_t)len > self->b_size/sizeof(wchar_t)) { PyErr_SetString(PyExc_ValueError, "string too long"); result = -1; |