mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
C++ compiler cleanup: a cast here, a cast there... still does not compile under C++ though...
This commit is contained in:
parent
14f8899dc2
commit
cbe2e491bc
1 changed files with 4 additions and 3 deletions
|
@ -1164,7 +1164,7 @@ array_reverse(arrayobject *self, PyObject *unused)
|
||||||
register char *p, *q;
|
register char *p, *q;
|
||||||
/* little buffer to hold items while swapping */
|
/* little buffer to hold items while swapping */
|
||||||
char tmp[256]; /* 8 is probably enough -- but why skimp */
|
char tmp[256]; /* 8 is probably enough -- but why skimp */
|
||||||
assert(itemsize <= sizeof(tmp));
|
assert((size_t)itemsize <= sizeof(tmp));
|
||||||
|
|
||||||
if (self->ob_size > 1) {
|
if (self->ob_size > 1) {
|
||||||
for (p = self->ob_item,
|
for (p = self->ob_item,
|
||||||
|
@ -1674,7 +1674,8 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
|
||||||
}
|
}
|
||||||
|
|
||||||
self->ob_size -= slicelength;
|
self->ob_size -= slicelength;
|
||||||
self->ob_item = PyMem_REALLOC(self->ob_item, itemsize*self->ob_size);
|
self->ob_item = (char *)PyMem_REALLOC(self->ob_item,
|
||||||
|
itemsize*self->ob_size);
|
||||||
self->allocated = self->ob_size;
|
self->allocated = self->ob_size;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1866,7 +1867,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
arrayobject *self = (arrayobject *)a;
|
arrayobject *self = (arrayobject *)a;
|
||||||
char *item = self->ob_item;
|
char *item = self->ob_item;
|
||||||
item = PyMem_Realloc(item, n);
|
item = (char *)PyMem_Realloc(item, n);
|
||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
PyErr_NoMemory();
|
PyErr_NoMemory();
|
||||||
Py_DECREF(a);
|
Py_DECREF(a);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue