Version: 0.8.0-beta1 (using KDE 3.4.2 Level "b" , SUSE 10.0) Compiler: Target: i586-suse-linux OS: Linux (i686) release 2.6.13-9-default Hello, when I have a 48-bit JPEG image in my album folder, digikam refuses to start up. On the console, you can read "Unsupported JPEG data precision 12" It's probably OK if it does not display this image but I think it should not completely refuse to start up. Jens
SVN commit 461552 by pahlibar: override default jpeg error handling so that the program doesn't bail out on encoutering a rogue jpeg file BUGS: 112801 M +37 -8 jpegmetadata.cpp --- trunk/extragear/graphics/digikam/libs/jpegutils/jpegmetadata.cpp #461551:461552 @@ -19,6 +19,7 @@ * ============================================================ */ #include <qfile.h> +#include <kdebug.h> #include <libkexif/kexifdata.h> #include "jpegmetadata.h" @@ -27,8 +28,28 @@ extern "C" { #include <stdio.h> #include <jpeglib.h> +#include <setjmp.h> } +struct readJPEGMetaData_error_mgr : public jpeg_error_mgr +{ + jmp_buf setjmp_buffer; +}; + +extern "C" +{ + static void readJPEGMetaData_error_exit(j_common_ptr cinfo) + { + readJPEGMetaData_error_mgr* myerr = + (readJPEGMetaData_error_mgr*) cinfo->err; + + char buffer[JMSG_LENGTH_MAX]; + (*cinfo->err->format_message)(cinfo, buffer); + kdWarning() << buffer << endl; + longjmp(myerr->setjmp_buffer, 1); + } +} + namespace Digikam { @@ -42,18 +63,26 @@ comments = QString(); datetime = QDateTime(); - struct jpeg_decompress_struct srcinfo; - struct jpeg_error_mgr jsrcerr; + FILE *input_file = fopen(QFile::encodeName(filePath), "rb"); + if (!input_file) + return; + + struct jpeg_decompress_struct srcinfo; + struct readJPEGMetaData_error_mgr jerr; - srcinfo.err = jpeg_std_error(&jsrcerr); + srcinfo.err = jpeg_std_error(&jerr); + srcinfo.err->error_exit = readJPEGMetaData_error_exit; + + if (setjmp(jerr.setjmp_buffer)) + { + jpeg_destroy_decompress(&srcinfo); + fclose(input_file); + return; + } + jpeg_create_decompress(&srcinfo); - FILE *input_file; - input_file = fopen(QFile::encodeName(filePath), "rb"); - if (!input_file) - return; - unsigned short header; if (fread(&header, 2, 1, input_file) != 1)
Thank you! I was just about to provide a sample image. :-) You can download it at www.jensbenecke.de/temp/3-11-48bit.jpg