mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
More Py_ssize_t changes
This commit is contained in:
parent
28f22fc908
commit
f987d74695
|
@ -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;
|
||||
|
@ -1250,9 +1251,8 @@ _putdata(ImagingObject* self, PyObject* args)
|
|||
|
||||
image = self->image;
|
||||
|
||||
// UNDONE Py_ssize_t 2Gpix image issue
|
||||
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");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -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