mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
cleanup unused variables
This commit is contained in:
parent
96907b9158
commit
857ee63436
|
@ -559,29 +559,16 @@ j2k_decode_entry(Imaging im, ImagingCodecState state)
|
|||
size_t buffer_size = 0;
|
||||
unsigned n;
|
||||
|
||||
// fastpath of using a filepointer, and not our own shufflers.
|
||||
/* if (context->fp) {
|
||||
context->pfile = fdopen(context->fp, 'rb');
|
||||
stream = opj_stream_create_default_file_stream(pfile, OPJ_TRUE);
|
||||
if (!stream) {
|
||||
state->errcode = IMAGING_CODEC_BROKEN;
|
||||
state->state = J2K_STATE_FAILED;
|
||||
goto quick_exit;
|
||||
}
|
||||
} else {
|
||||
*/ // Using our own shufflers.
|
||||
//stream = opj_stream_default_create(OPJ_TRUE);
|
||||
stream = opj_stream_create(BUFFER_SIZE, OPJ_TRUE);
|
||||
|
||||
if (!stream) {
|
||||
state->errcode = IMAGING_CODEC_BROKEN;
|
||||
state->state = J2K_STATE_FAILED;
|
||||
goto quick_exit;
|
||||
}
|
||||
|
||||
opj_stream_set_read_function(stream, j2k_read);
|
||||
opj_stream_set_skip_function(stream, j2k_skip);
|
||||
/* }*/
|
||||
stream = opj_stream_create(BUFFER_SIZE, OPJ_TRUE);
|
||||
|
||||
if (!stream) {
|
||||
state->errcode = IMAGING_CODEC_BROKEN;
|
||||
state->state = J2K_STATE_FAILED;
|
||||
goto quick_exit;
|
||||
}
|
||||
|
||||
opj_stream_set_read_function(stream, j2k_read);
|
||||
opj_stream_set_skip_function(stream, j2k_skip);
|
||||
|
||||
/* OpenJPEG 2.0 doesn't have OPJ_VERSION_MAJOR */
|
||||
#ifndef OPJ_VERSION_MAJOR
|
||||
|
@ -783,7 +770,6 @@ j2k_decode_entry(Imaging im, ImagingCodecState state)
|
|||
int
|
||||
ImagingJpeg2KDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||
{
|
||||
JPEG2KDECODESTATE *context = (JPEG2KDECODESTATE *) state->context;
|
||||
|
||||
if (bytes){
|
||||
state->errcode = IMAGING_CODEC_BROKEN;
|
||||
|
@ -816,17 +802,12 @@ int
|
|||
ImagingJpeg2KDecodeCleanup(ImagingCodecState state) {
|
||||
JPEG2KDECODESTATE *context = (JPEG2KDECODESTATE *)state->context;
|
||||
|
||||
if (context->error_msg)
|
||||
if (context->error_msg) {
|
||||
free ((void *)context->error_msg);
|
||||
|
||||
/* if (context->decoder)*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
context->error_msg = NULL;
|
||||
|
||||
/* Prevent multiple calls to ImagingIncrementalCodecDestroy */
|
||||
//context->decoder = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,8 +82,10 @@ static OPJ_BOOL
|
|||
j2k_seek(OPJ_OFF_T p_nb_bytes, void *p_user_data)
|
||||
{
|
||||
ImagingCodecState state = (ImagingCodecState)p_user_data;
|
||||
int ignored = _imaging_seek_pyFd(state->fd, p_nb_bytes, SEEK_SET);
|
||||
off_t pos = _imaging_tell_pyFd(state->fd);
|
||||
off_t pos = 0;
|
||||
|
||||
_imaging_seek_pyFd(state->fd, p_nb_bytes, SEEK_SET);
|
||||
pos = _imaging_tell_pyFd(state->fd);
|
||||
|
||||
return pos == p_nb_bytes;
|
||||
}
|
||||
|
@ -583,8 +585,6 @@ j2k_encode_entry(Imaging im, ImagingCodecState state)
|
|||
int
|
||||
ImagingJpeg2KEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes)
|
||||
{
|
||||
JPEG2KENCODESTATE *context = (JPEG2KENCODESTATE *)state->context;
|
||||
|
||||
if (state->state == J2K_STATE_FAILED)
|
||||
return -1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user