(original) (raw)

changeset: 92615:599a957038fa user: Serhiy Storchaka storchaka@gmail.com date: Sun Sep 28 11:27:24 2014 +0300 files: Modules/_cursesmodule.c Modules/_decimal/_decimal.c Modules/cjkcodecs/cjkcodecs.h Modules/cjkcodecs/multibytecodec.c Modules/pyexpat.c Objects/bytesobject.c Objects/floatobject.c Objects/longobject.c Objects/unicodeobject.c Python/import.c description: Removed redundant casts to `char *`. Corresponding functions now accept `const char *` (issue #1772673). diff -r 78ae78f967f1 -r 599a957038fa Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Modules/_cursesmodule.c Sun Sep 28 11:27:24 2014 +0300 @@ -2675,7 +2675,7 @@ } knp = keyname(ch); - return PyBytes_FromString((knp == NULL) ? "" : (char *)knp); + return PyBytes_FromString((knp == NULL) ? "" : knp); } #endif diff -r 78ae78f967f1 -r 599a957038fa Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Modules/_decimal/_decimal.c Sun Sep 28 11:27:24 2014 +0300 @@ -5640,7 +5640,7 @@ goto error; /* GCOV_NOT_REACHED */ } - ASSIGN_PTR(cm->ex, PyErr_NewException((char *)cm->fqname, base, NULL)); + ASSIGN_PTR(cm->ex, PyErr_NewException(cm->fqname, base, NULL)); Py_DECREF(base); /* add to module */ @@ -5672,7 +5672,7 @@ goto error; /* GCOV_NOT_REACHED */ } - ASSIGN_PTR(cm->ex, PyErr_NewException((char *)cm->fqname, base, NULL)); + ASSIGN_PTR(cm->ex, PyErr_NewException(cm->fqname, base, NULL)); Py_DECREF(base); Py_INCREF(cm->ex); diff -r 78ae78f967f1 -r 599a957038fa Modules/cjkcodecs/cjkcodecs.h --- a/Modules/cjkcodecs/cjkcodecs.h Sun Sep 28 00:01:55 2014 +0300 +++ b/Modules/cjkcodecs/cjkcodecs.h Sun Sep 28 11:27:24 2014 +0300 @@ -362,7 +362,7 @@ if (mod == NULL) return -1; - o = PyObject_GetAttrString(mod, (char*)symbol); + o = PyObject_GetAttrString(mod, symbol); if (o == NULL) goto errorexit; else if (!PyCapsule_IsValid(o, PyMultibyteCodec_CAPSULE_NAME)) { diff -r 78ae78f967f1 -r 599a957038fa Modules/cjkcodecs/multibytecodec.c --- a/Modules/cjkcodecs/multibytecodec.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Modules/cjkcodecs/multibytecodec.c Sun Sep 28 11:27:24 2014 +0300 @@ -1269,10 +1269,10 @@ if (sizehint < 0) cres = PyObject_CallMethod(self->stream, - (char *)method, NULL); + method, NULL); else cres = PyObject_CallMethod(self->stream, - (char *)method, "i", sizehint); + method, "i", sizehint); if (cres == NULL) goto errorexit; diff -r 78ae78f967f1 -r 599a957038fa Modules/pyexpat.c --- a/Modules/pyexpat.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Modules/pyexpat.c Sun Sep 28 11:27:24 2014 +0300 @@ -1478,7 +1478,7 @@ static PyObject * -newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern) +newxmlparseobject(const char *encoding, const char *namespace_separator, PyObject *intern) { int i; xmlparseobject *self; @@ -1932,8 +1932,7 @@ return NULL; } - result = newxmlparseobject((char *)encoding, (char *)namespace_separator, - intern); + result = newxmlparseobject(encoding, namespace_separator, intern); if (intern_decref) { Py_DECREF(intern); } @@ -2074,7 +2073,7 @@ PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype); PyModule_AddStringConstant(m, "EXPAT_VERSION", - (char *) XML_ExpatVersion()); + XML_ExpatVersion()); { XML_Expat_Version info = XML_ExpatVersionInfo(); PyModule_AddObject(m, "version_info", @@ -2154,7 +2153,7 @@ #define MYCONST(name) \ if (PyModule_AddStringConstant(errors_module, #name, \ - (char *)XML_ErrorString(name)) < 0) \ + XML_ErrorString(name)) < 0) \ return NULL; \ tmpnum = PyLong_FromLong(name); \ if (tmpnum == NULL) return NULL; \ diff -r 78ae78f967f1 -r 599a957038fa Objects/bytesobject.c --- a/Objects/bytesobject.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Objects/bytesobject.c Sun Sep 28 11:27:24 2014 +0300 @@ -3403,7 +3403,7 @@ _Py_DEC_REFTOTAL; _Py_ForgetReference(v); *pv = (PyObject *) - PyObject_REALLOC((char *)v, PyBytesObject_SIZE + newsize); + PyObject_REALLOC(v, PyBytesObject_SIZE + newsize); if (*pv == NULL) { PyObject_Del(v); PyErr_NoMemory(); diff -r 78ae78f967f1 -r 599a957038fa Objects/floatobject.c --- a/Objects/floatobject.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Objects/floatobject.c Sun Sep 28 11:27:24 2014 +0300 @@ -2026,7 +2026,7 @@ } else { float y = (float)x; - const char *s = (char*)&y; + const unsigned char *s = (unsigned char*)&y; int i, incr = 1; if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x)) @@ -2162,7 +2162,7 @@ return -1; } else { - const char *s = (char*)&x; + const unsigned char *s = (unsigned char*)&x; int i, incr = 1; if ((double_format == ieee_little_endian_format && !le) diff -r 78ae78f967f1 -r 599a957038fa Objects/longobject.c --- a/Objects/longobject.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Objects/longobject.c Sun Sep 28 11:27:24 2014 +0300 @@ -2312,7 +2312,7 @@ PyObject *result, *strobj; char *end = NULL; - result = PyLong_FromString((char*)s, &end, base); + result = PyLong_FromString(s, &end, base); if (end == NULL || (result != NULL && end == s + len)) return result; Py_XDECREF(result); diff -r 78ae78f967f1 -r 599a957038fa Objects/unicodeobject.c --- a/Objects/unicodeobject.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Objects/unicodeobject.c Sun Sep 28 11:27:24 2014 +0300 @@ -727,7 +727,7 @@ _Py_DEC_REFTOTAL; _Py_ForgetReference(unicode); - new_unicode = (PyObject *)PyObject_REALLOC((char *)unicode, new_size); + new_unicode = (PyObject *)PyObject_REALLOC(unicode, new_size); if (new_unicode == NULL) { _Py_NewReference(unicode); PyErr_NoMemory(); @@ -3483,7 +3483,7 @@ memset(&mbs, 0, sizeof mbs); while (len) { - converted = mbrtowc(&ch, (char*)str, len, &mbs); + converted = mbrtowc(&ch, str, len, &mbs); if (converted == 0) /* Reached end of string */ break; diff -r 78ae78f967f1 -r 599a957038fa Python/import.c --- a/Python/import.c Sun Sep 28 00:01:55 2014 +0300 +++ b/Python/import.c Sun Sep 28 11:27:24 2014 +0300 @@ -2064,7 +2064,7 @@ memset(newtab, '\0', sizeof newtab); - newtab[0].name = (char *)name; + newtab[0].name = name; newtab[0].initfunc = initfunc; return PyImport_ExtendInittab(newtab); /storchaka@gmail.com