Skip to content

Commit

Permalink
avoid LTO issues
Browse files Browse the repository at this point in the history
Place structs inside the places where used.

Signed-off-by: Rosen Penev <[email protected]>
(cherry picked from commit 8a09f2d)
  • Loading branch information
neheb authored and mergify[bot] committed Jul 8, 2023
1 parent 512223f commit 8893f7d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
30 changes: 15 additions & 15 deletions src/minoltamn_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
31 changes: 14 additions & 17 deletions src/pentaxmn_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
uint32_t id_; //!< Lens id
PrintFct fct_; //!< Pretty-print function
//! Comparison operator for find template
bool operator==(uint32_t 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");
Expand Down

0 comments on commit 8893f7d

Please sign in to comment.