mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +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)
|
||||
{
|
||||
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;
|
||||
double scale = 1.0;
|
||||
|
@ -1244,17 +1245,16 @@ _putdata(ImagingObject* self, PyObject* args)
|
|||
return NULL;
|
||||
|
||||
if (!PySequence_Check(data)) {
|
||||
PyErr_SetString(PyExc_TypeError, must_be_sequence);
|
||||
return NULL;
|
||||
PyErr_SetString(PyExc_TypeError, must_be_sequence);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image = self->image;
|
||||
|
||||
// UNDONE Py_ssize_t 2Gpix image issue
|
||||
n = PyObject_Length(data);
|
||||
if (n > (int) (image->xsize * image->ysize)) {
|
||||
PyErr_SetString(PyExc_TypeError, "too many data entries");
|
||||
return NULL;
|
||||
if (n > (Py_ssize_t) (image->xsize * image->ysize)) {
|
||||
PyErr_SetString(PyExc_TypeError, "too many data entries");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (image->image8) {
|
||||
|
@ -1649,7 +1649,7 @@ _stretch(ImagingObject* self, PyObject* args)
|
|||
imIn = self->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);
|
||||
else
|
||||
imTemp = ImagingNew(imIn->mode, xsize, imIn->ysize);
|
||||
|
|
Loading…
Reference in New Issue
Block a user