Bug 131550

Summary: digikam/showfoto can't show jpeg image under PowerPC
Product: [Applications] digikam Reporter: Yannick Roehlly <yannick.roehlly>
Component: Plugin-DImg-JPEGAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.9.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0
Sentry Crash Report:

Description Yannick Roehlly 2006-07-30 15:11:04 UTC
Version:           0.9.0-beta1 (using KDE 3.5.4, Debian Package 4:3.5.4-1 (testing/unstable))
Compiler:          Target: powerpc-linux-gnu
OS:                Linux (ppc) release 2.6.17

The 0.9.0-beta1 (tested with up to svn 567816) version of Digikam is unable to open jpeg images, neither from digikam nor directly with showfoto.
The thumbnail is correctly generated but opening an image results in an empty window.
When launching showfoto from console here is the result:

showfoto: WARNING: KIPI::PluginLoader:: createInstanceFromLibrary returned 0 for ImagePlugin_Core (digikamimageplugin_core) with error number 5
QFile::open: No file name specified
QFile::open: No file name specified
showfoto: WARNING: [void Digikam::DImgInterface::slotImageLoaded(const QString&, const Digikam::DImg&)] Failed to load image 
showfoto: WARNING: [Digikam::DImg* Digikam::DImgInterface::getImg()] d->image is NULL

Note that displaying gif image works, and displaying png images works also (minus bug #131549).

Calling showfoto on a gif image in console results in:

showfoto: WARNING: KIPI::PluginLoader:: createInstanceFromLibrary returned 0 for ImagePlugin_Core (digikamimageplugin_core) with error number 5
QFile::open: No file name specified
QFile::open: No file name specified

so maybe only the two last lines above are relevant.

If you want, I can recompile digikam with debug turned on to have more informations.
Comment 1 Marcel Wiesweg 2006-08-01 23:08:28 UTC
Uncomment line 27 of libs/dimg/loaders/jpegloader.cpp and recompile. Perhaps libjpeg gives any indication of the error.

The other error when the core image plugins fail to load is errno 5: I/O error. I don't know what that means.
Comment 2 Yannick Roehlly 2006-08-02 23:17:31 UTC
Hi Marcel,

I commented out the line, recompile, but showfoto/digikam doesn't give me more error information than above. :'(
Comment 3 Mark Purcell 2006-08-03 11:42:24 UTC
I can also confirm this problem on powerpc.
Comment 4 Marcel Wiesweg 2006-08-03 23:53:31 UTC
SVN commit 569460 by mwiesweg:

Make JPEG signature checking endianness-proof
(please test)

CCBUGS: 131550


 M  +4 -2      jpegloader.cpp  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/jpegloader.cpp #569459:569460
@@ -105,7 +105,7 @@
     if (!file)
         return false;
 
-    unsigned short header;
+    unsigned char header[2];
 
     if (fread(&header, 2, 1, file) != 1)
     {
@@ -113,7 +113,9 @@
         return false;
     }
 
-    if (header != 0xd8ff)
+    unsigned char jpegID[] = { 0xFF, 0xD8 };
+
+    if (memcmp(header, jpegID, 2) != 0)
     {
         // not a jpeg file
         fclose(file);
Comment 5 Yannick Roehlly 2006-08-04 11:12:33 UTC
Great ! That solved the problem.
Comment 6 Mark Purcell 2006-08-05 13:48:34 UTC
I have pulled this patch into the Debian powerpc pacakge and it is now available for download from http://packages.debian.org/digikam.
Comment 7 Marcel Wiesweg 2006-08-05 14:33:44 UTC
Closing as fixed