Scan optimization: return error when unable to copy data buffer
#166 describes an issue where I/O suspension is not properly handled in scan optimization. Supporting I/O suspension may be difficult to achieve here, thus return an error to make it explicit that I/O suspension is unsupported.
This commit is contained in:
@@ -127,6 +127,8 @@ JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format")
|
|||||||
JMESSAGE(JERR_PNG_ERROR, "Unable to read PNG file: %s")
|
JMESSAGE(JERR_PNG_ERROR, "Unable to read PNG file: %s")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
JMESSAGE(JERR_UNSUPPORTED_SUSPEND, "I/O suspension not supported in scan optimization")
|
||||||
|
|
||||||
#ifdef JMAKE_ENUM_LIST
|
#ifdef JMAKE_ENUM_LIST
|
||||||
|
|
||||||
JMSG_LASTADDONCODE
|
JMSG_LASTADDONCODE
|
||||||
|
|||||||
@@ -605,7 +605,9 @@ copy_buffer (j_compress_ptr cinfo, int scan_idx)
|
|||||||
size -= cinfo->dest->free_in_buffer;
|
size -= cinfo->dest->free_in_buffer;
|
||||||
cinfo->dest->next_output_byte += cinfo->dest->free_in_buffer;
|
cinfo->dest->next_output_byte += cinfo->dest->free_in_buffer;
|
||||||
cinfo->dest->free_in_buffer = 0;
|
cinfo->dest->free_in_buffer = 0;
|
||||||
(*cinfo->dest->empty_output_buffer)(cinfo);
|
|
||||||
|
if (!(*cinfo->dest->empty_output_buffer)(cinfo))
|
||||||
|
ERREXIT(cinfo, JERR_UNSUPPORTED_SUSPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMCOPY(cinfo->dest->next_output_byte, src, size);
|
MEMCOPY(cinfo->dest->next_output_byte, src, size);
|
||||||
|
|||||||
Reference in New Issue
Block a user