]> granicus.if.org Git - python/commitdiff
Fix compiler warnings: comparison between signed and unsigned numbers
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 20 Mar 2015 10:32:24 +0000 (11:32 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 20 Mar 2015 10:32:24 +0000 (11:32 +0100)
Modules/socketmodule.c
Objects/unicodeobject.c

index 147b48ee0edca2d00290e9cf20c5852b47975ebf..8cf6140145c1d7db006b71c33800bdd4e7af856d 100644 (file)
@@ -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);
index ab22289f5066e8a331e5f617449028d0e26e8ca6..56d9a023ddc368b54a5e32ee2e0b1801478d716b 100644 (file)
@@ -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)