Bug 225407 - dngconverter fix endian detection [patch]
Summary: dngconverter fix endian detection [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Bqm-DngConverter (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-03 16:55 UTC by Mark Purcell
Modified: 2016-07-15 12:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.2.0


Attachments
Fix compilation on Windows (469 bytes, patch)
2010-02-06 10:48 UTC, David Eriksson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Purcell 2010-02-03 16:55:05 UTC
Version:           unknown (using 4.3.4 (KDE 4.3.4), Debian packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.32-trunk-686

Find enclosed the patch Debian has been included to fix endian detection in dngconverter.

Mark

http://patch-tracker.debian.org/patch/series/view/kipi-plugins/1.0.0-1/fix_endian_detection.diff

--- a/dngconverter/dngwriter/extra/dng_sdk/dng_flags.h
+++ b/dngconverter/dngwriter/extra/dng_sdk/dng_flags.h
@@ -65,57 +65,28 @@
 /// \def qDNGBigEndian 1 if this target platform is big endian (e.g. PowerPC Macintosh), else 0
 /// \def qDNGLittleEndian 1 if this target platform is little endian (e.g. x86 processors), else 0
 
-#ifndef qDNGBigEndian
+#if !defined(qDNGBigEndian) 
 
-#if defined(qDNGLittleEndian)
-#define qDNGBigEndian !qDNGLittleEndian
+#include <endian.h>
 
-#elif defined(__hppa__)
-#define qDNGBigEndian 1
-
-#elif defined(__sparc__)
-#define qDNGBigEndian 1
-
-#elif defined(__s390x__)
-#define qDNGBigEndian 1
-
-#elif defined(__s390__)
-#define qDNGBigEndian 1
-
-#elif defined(__POWERPC__)
-#define qDNGBigEndian 1
-
-#elif defined(__INTEL__)
+#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define qDNGBigEndian 0
 
-#elif defined(_M_IX86)
-#define qDNGBigEndian 0
-
-#elif defined(_M_X64)
-#define qDNGBigEndian 0
-
-#elif defined(__LITTLE_ENDIAN__)
-#define qDNGBigEndian 0
-
-#elif defined(__BIG_ENDIAN__)
+#elif __BYTE_ORDER == __BIG_ENDIAN
 #define qDNGBigEndian 1
 
 #else
 
-#ifndef qXCodeRez
 #error Unable to figure out byte order.
-#endif
 
 #endif
-#endif
 
-#ifndef qXCodeRez
+#endif
 
-#ifndef qDNGLittleEndian
+#if !defined(qDNGLittleEndian) 
 #define qDNGLittleEndian !qDNGBigEndian
 #endif
 
-#endif
 
 /*****************************************************************************/
Comment 1 caulier.gilles 2010-02-04 10:23:27 UTC
SVN commit 1084997 by cgilles:

apply patch from Mark Purcel to fix endianess detection with Debian
BUGS: 225407


 M  +2 -1      NEWS  
 M  +6 -35     dngconverter/dngwriter/extra/dng_sdk/dng_flags.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1084997
Comment 2 Mark Purcell 2010-02-04 16:39:42 UTC
*** Bug 192545 has been marked as a duplicate of this bug. ***
Comment 3 David Eriksson 2010-02-04 23:18:36 UTC
This breaks compilation for me on Windows. I don't have an endian.h file.
Comment 4 caulier.gilles 2010-02-05 12:10:07 UTC
Mark,

For windows stuff, please use #ifdef WIN32 to solve this issue. 

Look there for ex :

http://lxr.kde.org/source/extragear/graphics/kipi-plugins/removeredeyes/libcvblobs/Blob.h#38

Gilles Caulier
Comment 5 David Eriksson 2010-02-06 10:48:08 UTC
Created attachment 40559 [details]
Fix compilation on Windows

This patch removes the inclusion of endian.h on Windows. It solves the problem for me.
Comment 6 caulier.gilles 2010-02-06 11:48:27 UTC
SVN commit 1086017 by cgilles:

apply patch #40559
CCBUGS: 225407


 M  +2 -0      dng_flags.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1086017