mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-29 10:13:09 +03:00
More Py_ssize_t changes
This commit is contained in:
parent
28f22fc908
commit
f987d74695
16
_imaging.c
16
_imaging.c
|
@ -1234,7 +1234,8 @@ static PyObject*
|
||||||
_putdata(ImagingObject* self, PyObject* args)
|
_putdata(ImagingObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
Imaging image;
|
Imaging image;
|
||||||
int n, i, x, y;
|
// i & n are # pixels, require py_ssize_t. x can be as large as n. y, just because.
|
||||||
|
Py_ssize_t n, i, x, y;
|
||||||
|
|
||||||
PyObject* data;
|
PyObject* data;
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
|
@ -1244,17 +1245,16 @@ _putdata(ImagingObject* self, PyObject* args)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!PySequence_Check(data)) {
|
if (!PySequence_Check(data)) {
|
||||||
PyErr_SetString(PyExc_TypeError, must_be_sequence);
|
PyErr_SetString(PyExc_TypeError, must_be_sequence);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
image = self->image;
|
image = self->image;
|
||||||
|
|
||||||
// UNDONE Py_ssize_t 2Gpix image issue
|
|
||||||
n = PyObject_Length(data);
|
n = PyObject_Length(data);
|
||||||
if (n > (int) (image->xsize * image->ysize)) {
|
if (n > (Py_ssize_t) (image->xsize * image->ysize)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "too many data entries");
|
PyErr_SetString(PyExc_TypeError, "too many data entries");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image->image8) {
|
if (image->image8) {
|
||||||
|
@ -1649,7 +1649,7 @@ _stretch(ImagingObject* self, PyObject* args)
|
||||||
imIn = self->image;
|
imIn = self->image;
|
||||||
|
|
||||||
/* two-pass resize: minimize size of intermediate image */
|
/* two-pass resize: minimize size of intermediate image */
|
||||||
if (imIn->xsize * ysize < xsize * imIn->ysize)
|
if ((Py_ssize_t) imIn->xsize * ysize < (Py_ssize_t) xsize * imIn->ysize)
|
||||||
imTemp = ImagingNew(imIn->mode, imIn->xsize, ysize);
|
imTemp = ImagingNew(imIn->mode, imIn->xsize, ysize);
|
||||||
else
|
else
|
||||||
imTemp = ImagingNew(imIn->mode, xsize, imIn->ysize);
|
imTemp = ImagingNew(imIn->mode, xsize, imIn->ysize);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user