[poppler] poppler/DCTStream.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu Apr 4 14:10:53 PDT 2013
poppler/DCTStream.cc | 57 ++++++++++++++++++++++++++-------------------------
1 file changed, 30 insertions(+), 27 deletions(-)
New commits:
commit 70e6af4739d2eea58e6f3200a8c9467597a12ae5
Author: Rodrigo Rivas Costa <rodrigorivascosta at gmail.com>
Date: Thu Apr 4 23:10:09 2013 +0200
Be pedantic about setjmp use
Bug #63067
diff --git a/poppler/DCTStream.cc b/poppler/DCTStream.cc
index decfd0f..d2dbba1 100644
--- a/poppler/DCTStream.cc
+++ b/poppler/DCTStream.cc
@@ -159,40 +159,43 @@ void DCTStream::reset() {
}
}
- if (!setjmp(err.setjmp_buffer) && jpeg_read_header(&cinfo, TRUE) != JPEG_SUSPENDED)
+ if (!setjmp(err.setjmp_buffer))
{
- // figure out color transform
- if (colorXform == -1 && !cinfo.saw_Adobe_marker) {
- if (cinfo.num_components == 3) {
- if (cinfo.saw_JFIF_marker) {
- colorXform = 1;
- } else if (cinfo.cur_comp_info[0]->component_id == 82 &&
- cinfo.cur_comp_info[1]->component_id == 71 &&
- cinfo.cur_comp_info[2]->component_id == 66) { // ASCII "RGB"
- colorXform = 0;
+ if (jpeg_read_header(&cinfo, TRUE) != JPEG_SUSPENDED)
+ {
+ // figure out color transform
+ if (colorXform == -1 && !cinfo.saw_Adobe_marker) {
+ if (cinfo.num_components == 3) {
+ if (cinfo.saw_JFIF_marker) {
+ colorXform = 1;
+ } else if (cinfo.cur_comp_info[0]->component_id == 82 &&
+ cinfo.cur_comp_info[1]->component_id == 71 &&
+ cinfo.cur_comp_info[2]->component_id == 66) { // ASCII "RGB"
+ colorXform = 0;
+ } else {
+ colorXform = 1;
+ }
} else {
- colorXform = 1;
+ colorXform = 0;
}
- } else {
- colorXform = 0;
+ } else if (cinfo.saw_Adobe_marker) {
+ colorXform = cinfo.Adobe_transform;
}
- } else if (cinfo.saw_Adobe_marker) {
- colorXform = cinfo.Adobe_transform;
- }
- switch (cinfo.num_components) {
- case 3:
- cinfo.jpeg_color_space = colorXform ? JCS_YCbCr : JCS_RGB;
- break;
- case 4:
- cinfo.jpeg_color_space = colorXform ? JCS_YCCK : JCS_CMYK;
- break;
- }
+ switch (cinfo.num_components) {
+ case 3:
+ cinfo.jpeg_color_space = colorXform ? JCS_YCbCr : JCS_RGB;
+ break;
+ case 4:
+ cinfo.jpeg_color_space = colorXform ? JCS_YCCK : JCS_CMYK;
+ break;
+ }
- jpeg_start_decompress(&cinfo);
+ jpeg_start_decompress(&cinfo);
- row_stride = cinfo.output_width * cinfo.output_components;
- row_buffer = cinfo.mem->alloc_sarray((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
+ row_stride = cinfo.output_width * cinfo.output_components;
+ row_buffer = cinfo.mem->alloc_sarray((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
+ }
}
}
More information about the poppler
mailing list