Clear parameters and return 0 for failed decode - issue #28

This commit is contained in:
Bodmer
2018-11-15 01:08:32 +00:00
parent c8de90be87
commit 35ea1e036d

View File

@ -407,6 +407,15 @@ int JPEGDecoder::decodeArray(const uint8_t array[], uint32_t array_size) {
int JPEGDecoder::decodeCommon(void) { int JPEGDecoder::decodeCommon(void) {
width = 0;
height = 0;
comps = 0;
MCUSPerRow = 0;
MCUSPerCol = 0;
scanType = (pjpeg_scan_type_t)0;
MCUWidth = 0;
MCUHeight = 0;
status = pjpeg_decode_init(&image_info, pjpeg_callback, NULL, 0); status = pjpeg_decode_init(&image_info, pjpeg_callback, NULL, 0);
if (status) { if (status) {
@ -419,7 +428,7 @@ int JPEGDecoder::decodeCommon(void) {
} }
#endif #endif
return -1; return 0;
} }
decoded_width = image_info.m_width; decoded_width = image_info.m_width;