mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 02:16:19 +03:00
Update src/_webp.c
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
parent
469db5114c
commit
c93b23239d
|
@ -448,18 +448,19 @@ PyObject *
|
||||||
_anim_decoder_get_next(PyObject *self) {
|
_anim_decoder_get_next(PyObject *self) {
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
int timestamp;
|
int timestamp;
|
||||||
|
int ok;
|
||||||
PyObject *bytes;
|
PyObject *bytes;
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
ImagingSectionCookie cookie;
|
ImagingSectionCookie cookie;
|
||||||
WebPAnimDecoderObject *decp = (WebPAnimDecoderObject *)self;
|
WebPAnimDecoderObject *decp = (WebPAnimDecoderObject *)self;
|
||||||
|
|
||||||
ImagingSectionEnter(&cookie);
|
ImagingSectionEnter(&cookie);
|
||||||
if (!WebPAnimDecoderGetNext(decp->dec, &buf, ×tamp)) {
|
ok = WebPAnimDecoderGetNext(decp->dec, &buf, ×tamp)
|
||||||
ImagingSectionLeave(&cookie);
|
ImagingSectionLeave(&cookie);
|
||||||
|
if (!ok) {
|
||||||
PyErr_SetString(PyExc_OSError, "failed to read next frame");
|
PyErr_SetString(PyExc_OSError, "failed to read next frame");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ImagingSectionLeave(&cookie);
|
|
||||||
|
|
||||||
bytes = PyBytes_FromStringAndSize(
|
bytes = PyBytes_FromStringAndSize(
|
||||||
(char *)buf, decp->info.canvas_width * 4 * decp->info.canvas_height);
|
(char *)buf, decp->info.canvas_width * 4 * decp->info.canvas_height);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user