Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
Removed the handles_eof flag in the decoder, as there are no users of it
Browse files Browse the repository at this point in the history
  • Loading branch information
wiredfool committed Nov 14, 2016
1 parent 76d156b commit 90760a5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion PIL/ImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def load(self):
else:
raise IOError("image file is truncated")

if not s and not decoder.handles_eof: # truncated jpeg
if not s: # truncated jpeg
self.tile = []

# JpegDecode needs to clean things up here either way
Expand Down
14 changes: 0 additions & 14 deletions decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ typedef struct {
struct ImagingCodecStateInstance state;
Imaging im;
PyObject* lock;
int handles_eof;
int pulls_fd;
} ImagingDecoderObject;

Expand Down Expand Up @@ -95,9 +94,6 @@ PyImaging_DecoderNew(int contextsize)
/* Initialize the cleanup function pointer */
decoder->cleanup = NULL;

/* Most decoders don't want to handle EOF themselves */
decoder->handles_eof = 0;

/* set if the decoder needs to pull data from the fd, instead of
having it pushed */
decoder->pulls_fd = 0;
Expand Down Expand Up @@ -239,12 +235,6 @@ _setfd(ImagingDecoderObject* decoder, PyObject* args)
}


static PyObject *
_get_handles_eof(ImagingDecoderObject *decoder)
{
return PyBool_FromLong(decoder->handles_eof);
}

static PyObject *
_get_pulls_fd(ImagingDecoderObject *decoder)
{
Expand All @@ -260,9 +250,6 @@ static struct PyMethodDef methods[] = {
};

static struct PyGetSetDef getseters[] = {
{"handles_eof", (getter)_get_handles_eof, NULL,
"True if this decoder expects to handle EOF itself.",
NULL},
{"pulls_fd", (getter)_get_pulls_fd, NULL,
"True if this decoder expects to pull from self.fd itself.",
NULL},
Expand Down Expand Up @@ -918,7 +905,6 @@ PyImaging_Jpeg2KDecoderNew(PyObject* self, PyObject* args)
if (decoder == NULL)
return NULL;

decoder->handles_eof = 1;
decoder->pulls_fd = 1;
decoder->decode = ImagingJpeg2KDecode;
decoder->cleanup = ImagingJpeg2KDecodeCleanup;
Expand Down

0 comments on commit 90760a5

Please sign in to comment.