From 53f03bd00cf337d0743eb2009094047ca8bb8184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Wed, 18 May 2016 20:57:46 +0200 Subject: [PATCH 1/2] Fix ODR violation When building with LTO, the compiler warns about a violation of the ODR. This commit fixes the two competing places by moving the structs into anonymous namespaces. --- rtengine/jdatasrc.cc | 4 ++++ rtengine/jpeg_memsrc.cc | 3 +++ 2 files changed, 7 insertions(+) diff --git a/rtengine/jdatasrc.cc b/rtengine/jdatasrc.cc index c8567387b..ff509301d 100644 --- a/rtengine/jdatasrc.cc +++ b/rtengine/jdatasrc.cc @@ -32,6 +32,8 @@ /* Expanded data source object for stdio input */ +namespace +{ typedef struct { struct jpeg_source_mgr pub; /* public fields */ @@ -44,6 +46,8 @@ typedef struct { typedef my_source_mgr * my_src_ptr; +} + #define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ diff --git a/rtengine/jpeg_memsrc.cc b/rtengine/jpeg_memsrc.cc index 75a0b25bc..ab4ecf7d6 100644 --- a/rtengine/jpeg_memsrc.cc +++ b/rtengine/jpeg_memsrc.cc @@ -26,6 +26,8 @@ /* Expanded data source object for memory input */ +namespace +{ typedef struct { struct jpeg_source_mgr pub; /* public fields */ @@ -36,6 +38,7 @@ typedef struct { typedef my_source_mgr * my_src_ptr; +} /* * Initialize source --- called by jpeg_read_header From c556771843cd7d39ff90144b9ea352c32cbf740d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Wed, 18 May 2016 21:16:27 +0200 Subject: [PATCH 2/2] Prevent narrowing conversion when building for PowerPC --- rtengine/iccstore.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 66099199c..82f280e54 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -263,7 +263,7 @@ cmsHPROFILE ICCStore::makeStdGammaProfile (cmsHPROFILE iprof) tags[i].sig == 0x6B545243) { // kTRC if (gamma_offset == 0) { gamma_offset = offset; - uint32_t pcurve[] = { htonl(0x63757276), htonl(0), htonl(gamma_size == 12 ? 0 : 1) }; + uint32_t pcurve[] = { htonl(0x63757276), htonl(0), htonl(gamma_size == 12 ? 0U : 1U) }; memcpy(&nd[offset], pcurve, 12); if (gamma_size == 14) {