diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-08-15 23:03:39 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-08-15 23:03:39 (GMT) |
commit | 706768c687f5413c909168736506aaf4fb4861c0 (patch) | |
tree | 98131f201f269d30031ed6e3c6d98fe4cf1fe649 /Modules/_io/bytesio.c | |
parent | 12174a5dcaf1bdcd8d5fd790a8cad07049bddce6 (diff) | |
download | cpython-706768c687f5413c909168736506aaf4fb4861c0.zip cpython-706768c687f5413c909168736506aaf4fb4861c0.tar.gz cpython-706768c687f5413c909168736506aaf4fb4861c0.tar.bz2 |
Issue #22156: Fix some "comparison between signed and unsigned integers"
compiler warnings in the Modules/ subdirectory.
Diffstat (limited to 'Modules/_io/bytesio.c')
-rw-r--r-- | Modules/_io/bytesio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index d07da08..56ad788 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -53,10 +53,12 @@ unshare(bytesio *self, size_t preferred_size, int truncate) Py_ssize_t copy_size; char *new_buf; - if((! truncate) && preferred_size < self->string_size) { + if((! truncate) && preferred_size < (size_t)self->string_size) { preferred_size = self->string_size; } + /* PyMem_Malloc() returns NULL if preferred_size is bigger + than PY_SSIZE_T_MAX */ new_buf = (char *)PyMem_Malloc(preferred_size); if (new_buf == NULL) { PyErr_NoMemory(); @@ -64,7 +66,7 @@ unshare(bytesio *self, size_t preferred_size, int truncate) } copy_size = self->string_size; - if (copy_size > preferred_size) { + if ((size_t)copy_size > preferred_size) { copy_size = preferred_size; } |