From: Victor Stinner Date: Fri, 20 Mar 2015 10:32:24 +0000 (+0100) Subject: Fix compiler warnings: comparison between signed and unsigned numbers X-Git-Tag: v3.5.0a3~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f50e1877245123a21f053d73951594794fa18500;p=python Fix compiler warnings: comparison between signed and unsigned numbers --- diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 147b48ee0e..8cf6140145 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1738,7 +1738,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, return 0; } - if (PyBytes_GET_SIZE(ctl_name) > sizeof(info.ctl_name)) { + if (PyBytes_GET_SIZE(ctl_name) > (Py_ssize_t)sizeof(info.ctl_name)) { PyErr_SetString(PyExc_ValueError, "provided string is too long"); Py_DECREF(ctl_name); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index ab22289f50..56d9a023dd 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -4799,7 +4799,7 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size) /* Note: size will always be longer than the resulting Unicode character count */ - if (PY_SSIZE_T_MAX / sizeof(wchar_t) < (size + 1)) + if (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(wchar_t) < (size + 1)) return NULL; unicode = PyMem_RawMalloc((size + 1) * sizeof(wchar_t)); if (!unicode)