From a0b460898d9ca88ddc493194f08e5f5867e08bb6 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 6 Jul 2023 15:15:08 -0700 Subject: [PATCH] avoid LTO issues Place structs inside the places where used. Signed-off-by: Rosen Penev --- src/minoltamn_int.cpp | 30 +++++++++++++++--------------- src/pentaxmn_int.cpp | 31 ++++++++++++++----------------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/minoltamn_int.cpp b/src/minoltamn_int.cpp index e12f8b223b..7964bb3ecb 100644 --- a/src/minoltamn_int.cpp +++ b/src/minoltamn_int.cpp @@ -1649,23 +1649,23 @@ static std::ostream& resolveLens0xffff(std::ostream& os, const Value& value, con return EXV_PRINT_TAG(minoltaSonyLensID)(os, value, metadata); } -//! List of lens ids which require special treatment from printMinoltaSonyLensID -constexpr struct LensIdFct { - uint32_t idx; - PrintFct fct; +std::ostream& printMinoltaSonyLensID(std::ostream& os, const Value& value, const ExifData* metadata) { + //! List of lens ids which require special treatment from printMinoltaSonyLensID + static constexpr struct LensIdFct { + uint32_t idx; + PrintFct fct; - bool operator==(uint32_t i) const { - return i == idx; - } -} lensIdFct[] = { - {0x001cu, &resolveLens0x1c}, {0x0029u, &resolveLens0x29}, {0x0034u, &resolveLens0x34}, - {0x0080u, &resolveLens0x80}, {0x00ffu, &resolveLens0xff}, {0xffffu, &resolveLens0xffff}, - //{0x00ffu, &resolveLensTypeUsingExiftool}, // was used for debugging -}; -// #1145 end - respect lenses with shared LensID -// ---------------------------------------------------------------------- + bool operator==(uint32_t i) const { + return i == idx; + } + } lensIdFct[] = { + {0x001cu, &resolveLens0x1c}, {0x0029u, &resolveLens0x29}, {0x0034u, &resolveLens0x34}, + {0x0080u, &resolveLens0x80}, {0x00ffu, &resolveLens0xff}, {0xffffu, &resolveLens0xffff}, + //{0x00ffu, &resolveLensTypeUsingExiftool}, // was used for debugging + }; + // #1145 end - respect lenses with shared LensID + // ---------------------------------------------------------------------- -std::ostream& printMinoltaSonyLensID(std::ostream& os, const Value& value, const ExifData* metadata) { // #1034 const std::string undefined("undefined"); const std::string minolta("minolta"); diff --git a/src/pentaxmn_int.cpp b/src/pentaxmn_int.cpp index 99e02017cb..a50712f1b9 100644 --- a/src/pentaxmn_int.cpp +++ b/src/pentaxmn_int.cpp @@ -1231,25 +1231,22 @@ static std::ostream& resolveLensType(std::ostream& os, const Value& value, const return EXV_PRINT_COMBITAG_MULTI(pentaxLensType, 2, 1, 2)(os, value, metadata); } -struct LensIdFct { - long id_; //!< Lens id - PrintFct fct_; //!< Pretty-print function - //! Comparison operator for find template - bool operator==(long id) const { - return id_ == id; - } -}; - -//! List of lens ids which require special treatment using resolveLensType -constexpr LensIdFct lensIdFct[] = { - {0x0317, resolveLensType}, {0x0319, resolveLens0x319}, {0x031b, resolveLensType}, {0x031c, resolveLensType}, - {0x031d, resolveLensType}, {0x031f, resolveLensType}, {0x0329, resolveLensType}, {0x032c, resolveLens0x32c}, - {0x032e, resolveLensType}, {0x0334, resolveLensType}, {0x03ff, resolveLens0x3ff}, {0x041a, resolveLensType}, - {0x042d, resolveLensType}, {0x08ff, resolveLens0x8ff}, -}; - //! A lens id and a pretty-print function for special treatment of the id. static std::ostream& printLensType(std::ostream& os, const Value& value, const ExifData* metadata) { + //! List of lens ids which require special treatment using resolveLensType + static constexpr struct LensIdFct { + long id_; //!< Lens id + PrintFct fct_; //!< Pretty-print function + //! Comparison operator for find template + bool operator==(long id) const { + return id_ == id; + } + } lensIdFct[] = { + {0x0317, resolveLensType}, {0x0319, resolveLens0x319}, {0x031b, resolveLensType}, {0x031c, resolveLensType}, + {0x031d, resolveLensType}, {0x031f, resolveLensType}, {0x0329, resolveLensType}, {0x032c, resolveLens0x32c}, + {0x032e, resolveLensType}, {0x0334, resolveLensType}, {0x03ff, resolveLens0x3ff}, {0x041a, resolveLensType}, + {0x042d, resolveLensType}, {0x08ff, resolveLens0x8ff}, + }; // #1034 const std::string undefined("undefined"); const std::string section("pentax");