Fix warnings about using char as an array subscript. This is not portable

since char is signed on some platforms and unsigned on others.
This commit is contained in:
Neal Norwitz 2008-03-27 04:40:50 +00:00
parent 4ebd46a02d
commit 231346e23f
4 changed files with 22 additions and 22 deletions

View file

@ -480,13 +480,13 @@ PyObject *PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
/* Single characters are shared when using this constructor.
Restrict to ASCII, since the input must be UTF-8. */
if (size == 1 && Py_CHARMASK(*u) < 128) {
unicode = unicode_latin1[Py_CHARMASK(*u)];
unicode = unicode_latin1[(unsigned)Py_CHARMASK(*u)];
if (!unicode) {
unicode = _PyUnicode_New(1);
if (!unicode)
return NULL;
unicode->str[0] = Py_CHARMASK(*u);
unicode_latin1[Py_CHARMASK(*u)] = unicode;
unicode_latin1[(unsigned)Py_CHARMASK(*u)] = unicode;
}
Py_INCREF(unicode);
return (PyObject *)unicode;