Fl_JPEG_Image did not correctly handle errors reported by the
JPEG library (STR #652) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3946 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
f912892305
commit
3387edd247
2
CHANGES
2
CHANGES
@ -1,5 +1,7 @@
|
||||
CHANGES IN FLTK 1.1.7
|
||||
|
||||
- Fl_JPEG_Image did not correctly handle errors reported
|
||||
by the JPEG library (STR #652)
|
||||
- Fl_Menu now draws sub-menu arrows like other toolkits
|
||||
and FLTK 2.0 (STR #651)
|
||||
- Fixed a compiler warning in Fl_Window.H (STR #641)
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_JPEG_Image.cxx,v 1.1.2.10 2004/04/11 04:38:57 easysw Exp $"
|
||||
// "$Id: Fl_JPEG_Image.cxx,v 1.1.2.11 2004/12/16 21:38:24 easysw Exp $"
|
||||
//
|
||||
// Fl_JPEG_Image routines.
|
||||
//
|
||||
@ -85,11 +85,14 @@ Fl_JPEG_Image::Fl_JPEG_Image(const char *jpeg) // I - File to load
|
||||
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jerr.error_exit = jpeg_error_handler;
|
||||
jerr.output_message = jpeg_error_handler;
|
||||
|
||||
jpeg_create_decompress(&cinfo);
|
||||
jpeg_stdio_src(&cinfo, fp);
|
||||
jpeg_read_header(&cinfo, 1);
|
||||
|
||||
if (cinfo.err->msg_code) goto error_return;
|
||||
|
||||
cinfo.quantize_colors = (boolean)FALSE;
|
||||
cinfo.out_color_space = JCS_RGB;
|
||||
cinfo.out_color_components = 3;
|
||||
@ -108,6 +111,8 @@ Fl_JPEG_Image::Fl_JPEG_Image(const char *jpeg) // I - File to load
|
||||
|
||||
while (cinfo.output_scanline < cinfo.output_height)
|
||||
{
|
||||
if (cinfo.err->msg_code) goto error_return;
|
||||
|
||||
row = (JSAMPROW)(array +
|
||||
cinfo.output_scanline * cinfo.output_width *
|
||||
cinfo.output_components);
|
||||
@ -118,9 +123,27 @@ Fl_JPEG_Image::Fl_JPEG_Image(const char *jpeg) // I - File to load
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
// JPEG error handling...
|
||||
error_return:
|
||||
|
||||
if (array) jpeg_finish_decompress(&cinfo);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if (array) {
|
||||
w(0);
|
||||
h(0);
|
||||
d(0);
|
||||
|
||||
delete[] array;
|
||||
array = 0;
|
||||
alloc_array = 0;
|
||||
}
|
||||
#endif // HAVE_LIBJPEG
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_JPEG_Image.cxx,v 1.1.2.10 2004/04/11 04:38:57 easysw Exp $".
|
||||
// End of "$Id: Fl_JPEG_Image.cxx,v 1.1.2.11 2004/12/16 21:38:24 easysw Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user