[Digikam-devel] [Bug 215743] Endianness bug loading 16 bits raw images

pochini at shiny.it pochini at shiny.it
Tue Nov 24 21:19:35 GMT 2009


https://bugs.kde.org/show_bug.cgi?id=215743





--- Comment #4 from  <pochini shiny it>  2009-11-24 22:19:34 ---
I propose another patch that fixes the bug and does not break anything, except,
perhaps, big-endian machines with KDCRAW_VERSION<0x000400 (I didn't test).
Little-endian archs are not affected.


--- digikam-1.0.0-beta6/libs/dimg/loaders/rawloader.cpp__orig   2009-11-24
21:51:58.000000000 +0100
+++ digikam-1.0.0-beta6/libs/dimg/loaders/rawloader.cpp 2009-11-24
22:03:02.000000000 +0100
@@ -177,7 +177,7 @@ bool RAWLoader::loadedFromDcraw(QByteArr

             for (int w = 0; w < width; ++w)
             {
-#if KDCRAW_VERSION < 0x000400
+#if (KDCRAW_VERSION < 0x000400) ^ (Q_BYTE_ORDER == Q_BIG_ENDIAN)
                 dst[0] = (unsigned short)((src[4]*256 + src[5]) * fac);     
// Blue
                 dst[1] = (unsigned short)((src[2]*256 + src[3]) * fac);     
// Green
                 dst[2] = (unsigned short)((src[0]*256 + src[1]) * fac);     
// Red

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Digikam-devel mailing list