Update src/_webp.c

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
Evan Miller 2024-02-07 20:20:27 -05:00 committed by GitHub
parent 469db5114c
commit c93b23239d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -448,18 +448,19 @@ PyObject *
_anim_decoder_get_next(PyObject *self) {
uint8_t *buf;
int timestamp;
int ok;
PyObject *bytes;
PyObject *ret;
ImagingSectionCookie cookie;
WebPAnimDecoderObject *decp = (WebPAnimDecoderObject *)self;
ImagingSectionEnter(&cookie);
if (!WebPAnimDecoderGetNext(decp->dec, &buf, &timestamp)) {
ImagingSectionLeave(&cookie);
ok = WebPAnimDecoderGetNext(decp->dec, &buf, &timestamp)
ImagingSectionLeave(&cookie);
if (!ok) {
PyErr_SetString(PyExc_OSError, "failed to read next frame");
return NULL;
}
ImagingSectionLeave(&cookie);
bytes = PyBytes_FromStringAndSize(
(char *)buf, decp->info.canvas_width * 4 * decp->info.canvas_height);