diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-08-15 21:17:38 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-08-15 21:17:38 (GMT) |
commit | 12174a5dcaf1bdcd8d5fd790a8cad07049bddce6 (patch) | |
tree | cd7632afadd1043e9708251c220e872639b767dc /Objects/unicodeobject.c | |
parent | 98ea54c35c37e4f9a7d7a923a7ccd792f4b7ff90 (diff) | |
download | cpython-12174a5dcaf1bdcd8d5fd790a8cad07049bddce6.zip cpython-12174a5dcaf1bdcd8d5fd790a8cad07049bddce6.tar.gz cpython-12174a5dcaf1bdcd8d5fd790a8cad07049bddce6.tar.bz2 |
Issue #22156: Fix "comparison between signed and unsigned integers" compiler
warnings in the Objects/ subdirectory.
PyType_FromSpecWithBases() and PyType_FromSpec() now reject explicitly negative
slot identifiers.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 263ca85..e7ff126 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3519,7 +3519,7 @@ PyUnicode_DecodeLocaleAndSize(const char *str, Py_ssize_t len, if (locale_error_handler(errors, &surrogateescape) < 0) return NULL; - if (str[len] != '\0' || len != strlen(str)) { + if (str[len] != '\0' || (size_t)len != strlen(str)) { PyErr_SetString(PyExc_TypeError, "embedded null character"); return NULL; } @@ -3696,7 +3696,7 @@ PyUnicode_FSConverter(PyObject* arg, void* addr) } size = PyBytes_GET_SIZE(output); data = PyBytes_AS_STRING(output); - if (size != strlen(data)) { + if ((size_t)size != strlen(data)) { PyErr_SetString(PyExc_TypeError, "embedded NUL character"); Py_DECREF(output); return 0; @@ -8874,7 +8874,7 @@ PyUnicode_TransformDecimalToASCII(Py_UNICODE *s, maxchar = 127; for (i = 0; i < length; i++) { - Py_UNICODE ch = s[i]; + Py_UCS4 ch = s[i]; if (ch > 127) { int decimal = Py_UNICODE_TODECIMAL(ch); if (decimal >= 0) @@ -8891,7 +8891,7 @@ PyUnicode_TransformDecimalToASCII(Py_UNICODE *s, data = PyUnicode_DATA(decimal); /* Iterate over code points */ for (i = 0; i < length; i++) { - Py_UNICODE ch = s[i]; + Py_UCS4 ch = s[i]; if (ch > 127) { int decimal = Py_UNICODE_TODECIMAL(ch); if (decimal >= 0) @@ -10833,7 +10833,7 @@ PyUnicode_CompareWithASCIIString(PyObject* uni, const char* str) void *data = PyUnicode_DATA(uni); /* Compare Unicode string and source character set string */ for (i = 0; (chr = PyUnicode_READ(kind, data, i)) && str[i]; i++) - if (chr != str[i]) + if (chr != (unsigned char)str[i]) return (chr < (unsigned char)(str[i])) ? -1 : 1; /* This check keeps Python strings that end in '\0' from comparing equal to C strings identical up to that point. */ |