diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 6 | ||||
-rw-r--r-- | Modules/_testcapimodule.c | 2 | ||||
-rw-r--r-- | Modules/audioop.c | 2 | ||||
-rw-r--r-- | Modules/md5module.c | 4 | ||||
-rw-r--r-- | Modules/pyexpat.c | 10 | ||||
-rw-r--r-- | Modules/selectmodule.c | 3 | ||||
-rw-r--r-- | Modules/sha1module.c | 4 | ||||
-rw-r--r-- | Modules/sha256module.c | 4 | ||||
-rw-r--r-- | Modules/sha512module.c | 4 | ||||
-rw-r--r-- | Modules/unicodedata.c | 10 |
10 files changed, 23 insertions, 26 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index ed7c66a..ff35862 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -3925,14 +3925,14 @@ PyTypeObject PyCFuncPtr_Type = { Returns -1 on error, or the index of next argument on success. */ -static int +static Py_ssize_t _init_pos_args(PyObject *self, PyTypeObject *type, PyObject *args, PyObject *kwds, - int index) + Py_ssize_t index) { StgDictObject *dict; PyObject *fields; - int i; + Py_ssize_t i; if (PyType_stgdict((PyObject *)type->tp_base)) { index = _init_pos_args(self, type->tp_base, diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index f0c07ae..587a9f0 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2188,7 +2188,7 @@ argparsing(PyObject *o, PyObject *args) /* argument converter not called? */ return NULL; /* Should be 1 */ - res = PyLong_FromLong(Py_REFCNT(str2)); + res = PyLong_FromSsize_t(Py_REFCNT(str2)); Py_DECREF(str2); PyErr_Clear(); return res; diff --git a/Modules/audioop.c b/Modules/audioop.c index 38e3e7a..a031d42 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -309,7 +309,7 @@ audioop_check_size(int size) } static int -audioop_check_parameters(int len, int size) +audioop_check_parameters(Py_ssize_t len, int size) { if (!audioop_check_size(size)) return 0; diff --git a/Modules/md5module.c b/Modules/md5module.c index d217dc8..208930d 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -228,9 +228,9 @@ void md5_init(struct md5_state *md5) @param inlen The length of the data (octets) */ void md5_process(struct md5_state *md5, - const unsigned char *in, unsigned long inlen) + const unsigned char *in, Py_ssize_t inlen) { - unsigned long n; + Py_ssize_t n; assert(md5 != NULL); assert(in != NULL); diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index c83639c..dea682d 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -800,7 +800,7 @@ readinst(char *buf, int buf_size, PyObject *meth) PyObject *arg = NULL; PyObject *bytes = NULL; PyObject *str = NULL; - int len = -1; + Py_ssize_t len = -1; char *ptr; if ((bytes = PyLong_FromLong(buf_size)) == NULL) @@ -831,7 +831,7 @@ readinst(char *buf, int buf_size, PyObject *meth) if (len > buf_size) { PyErr_Format(PyExc_ValueError, "read() returned too much data: " - "%i bytes requested, %i returned", + "%i bytes requested, %zi returned", buf_size, len); goto finally; } @@ -839,7 +839,7 @@ readinst(char *buf, int buf_size, PyObject *meth) finally: Py_XDECREF(arg); Py_XDECREF(str); - return len; + return (int)len; } PyDoc_STRVAR(xmlparse_ParseFile__doc__, @@ -1807,7 +1807,7 @@ MODULE_INITFUNC(void) Py_XDECREF(rev_codes_dict); return NULL; } - + #define MYCONST(name) \ if (PyModule_AddStringConstant(errors_module, #name, \ (char *)XML_ErrorString(name)) < 0) \ @@ -1873,7 +1873,7 @@ MODULE_INITFUNC(void) return NULL; if (PyModule_AddObject(errors_module, "messages", rev_codes_dict) < 0) return NULL; - + #undef MYCONST #define MYCONST(c) PyModule_AddIntConstant(m, #c, c) diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 58cc4c7..65e1826 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -81,10 +81,9 @@ reap_obj(pylist fd2obj[FD_SETSIZE + 1]) static int seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1]) { - int i; int max = -1; int index = 0; - int len = -1; + Py_ssize_t i, len = -1; PyObject* fast_seq = NULL; PyObject* o = NULL; diff --git a/Modules/sha1module.c b/Modules/sha1module.c index b660042..b25bd44 100644 --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -203,9 +203,9 @@ void sha1_init(struct sha1_state *sha1) @param inlen The length of the data (octets) */ void sha1_process(struct sha1_state *sha1, - const unsigned char *in, unsigned long inlen) + const unsigned char *in, Py_ssize_t inlen) { - unsigned long n; + Py_ssize_t n; assert(sha1 != NULL); assert(in != NULL); diff --git a/Modules/sha256module.c b/Modules/sha256module.c index 705b31a..8617210 100644 --- a/Modules/sha256module.c +++ b/Modules/sha256module.c @@ -265,9 +265,9 @@ sha224_init(SHAobject *sha_info) /* update the SHA digest */ static void -sha_update(SHAobject *sha_info, SHA_BYTE *buffer, int count) +sha_update(SHAobject *sha_info, SHA_BYTE *buffer, Py_ssize_t count) { - int i; + Py_ssize_t i; SHA_INT32 clo; clo = sha_info->count_lo + ((SHA_INT32) count << 3); diff --git a/Modules/sha512module.c b/Modules/sha512module.c index c403ed6..0faaf5c 100644 --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -291,9 +291,9 @@ sha384_init(SHAobject *sha_info) /* update the SHA digest */ static void -sha512_update(SHAobject *sha_info, SHA_BYTE *buffer, int count) +sha512_update(SHAobject *sha_info, SHA_BYTE *buffer, Py_ssize_t count) { - int i; + Py_ssize_t i; SHA_INT32 clo; clo = sha_info->count_lo + ((SHA_INT32) count << 3); diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index bd96e36..463be2c 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -403,7 +403,8 @@ unicodedata_decomposition(PyObject *self, PyObject *args) { PyUnicodeObject *v; char decomp[256]; - int code, index, count, i; + int code, index, count; + size_t i; unsigned int prefix_index; Py_UCS4 c; @@ -450,15 +451,12 @@ unicodedata_decomposition(PyObject *self, PyObject *args) while (count-- > 0) { if (i) decomp[i++] = ' '; - assert((size_t)i < sizeof(decomp)); + assert(i < sizeof(decomp)); PyOS_snprintf(decomp + i, sizeof(decomp) - i, "%04X", decomp_data[++index]); i += strlen(decomp + i); } - - decomp[i] = '\0'; - - return PyUnicode_FromString(decomp); + return PyUnicode_FromStringAndSize(decomp, i); } static void |