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