diff --git a/rtengine/dcp.cc b/rtengine/dcp.cc index c60e80587..1c99b682c 100644 --- a/rtengine/dcp.cc +++ b/rtengine/dcp.cc @@ -1265,7 +1265,7 @@ void DCPProfile::step2ApplyTile(float* rc, float* gc, float* bc, int width, int float cnewb = FCLIP(newb); float h, s, v; - Color::rgb2hsvdcp(cnewr, cnewg, cnewb, h, s, v); + Color::rgb2hsvtc(cnewr, cnewg, cnewb, h, s, v); hsdApply(look_info, look_table, h, s, v); s = CLIP01(s); @@ -1648,7 +1648,7 @@ std::vector DCPProfile::makeHueSatMap(const ColorTemp& wh return res; } -void DCPProfile::hsdApply(const HsdTableInfo& table_info, const std::vector& table_base, float& h, float& s, float& v) const +inline void DCPProfile::hsdApply(const HsdTableInfo& table_info, const std::vector& table_base, float& h, float& s, float& v) const { // Apply the HueSatMap. Ported from Adobes reference implementation. float hue_shift; diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index 8507d7611..dcaf6e53c 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -306,6 +306,38 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* } if (lens == "Unknown") { + const auto lens_from_make_and_model = + [this, exif]() -> bool + { + if (!exif) { + return false; + } + + const rtexif::Tag* const lens_model = exif->getTag(0xA434); + + if (lens_model) { + const rtexif::Tag* const lens_make = exif->getTag(0xA433); + const std::string make = + lens_make + ? lens_make->valueToString() + : std::string(); + const std::string model = lens_model->valueToString(); + + if (!model.empty()) { + lens = make; + + if (!lens.empty()) { + lens += ' '; + } + + lens += model; + + return true; + } + } + + return false; + }; if (mnote) { @@ -412,11 +444,15 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* rtexif::Tag *lt = mnote->getTag("LensType"); if (lt) { - std::string ldata = lt->valueToString(); + if (lt->toInt()) { + std::string ldata = lt->valueToString (); - if (ldata.size() > 1) { - found = true; - lens = "Canon " + ldata; + if (ldata.size() > 1) { + found = true; + lens = "Canon " + ldata; + } + } else { + found = lens_from_make_and_model(); } } @@ -446,7 +482,13 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* } if (mnote->getTag("LensType")) { - lens = mnote->getTag("LensType")->valueToString(); + lens = mnote->getTag ("LensType")->valueToString(); + if (!mnote->getTag("LensType")->toInt()) { + // try to find something better than "M-42 or No Lens" + lens_from_make_and_model(); + } + } else { + lens_from_make_and_model(); } // Try to get the FocalLength from the LensInfo structure, where length below 10mm will be correctly set @@ -490,9 +532,7 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory* } } else if (exif->getTag("DNGLensInfo")) { lens = exif->getTag("DNGLensInfo")->valueToString(); - } else if (exif->getTag("LensModel")) { - lens = exif->getTag("LensModel")->valueToString(); - } else if (exif->getTag("LensInfo")) { + } else if (!lens_from_make_and_model() && exif->getTag ("LensInfo")) { lens = exif->getTag("LensInfo")->valueToString(); } } diff --git a/rtexif/canonattribs.cc b/rtexif/canonattribs.cc index 7b30d9ae6..2dcbdd96f 100644 --- a/rtexif/canonattribs.cc +++ b/rtexif/canonattribs.cc @@ -32,7 +32,7 @@ namespace rtexif class CAOnOffInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int n = t->toInt(); @@ -51,7 +51,7 @@ class CAIntSerNumInterpreter : public Interpreter { public: CAIntSerNumInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { return ""; } @@ -63,7 +63,7 @@ class CAApertureInterpreter : public Interpreter { public: CAApertureInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = pow (2.0, t->toDouble() / 64.0); @@ -92,7 +92,7 @@ CAMacroModeInterpreter caMacroModeInterpreter; class CASelfTimerInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int sec = t->toInt (0, SHORT); @@ -385,7 +385,7 @@ CAExposureModeInterpreter caExposureModeInterpreter; class CAFlashBitsInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream s; unsigned bits = t->toInt (0, SHORT); @@ -533,7 +533,7 @@ CARAWQualityInterpreter caRAWQualityInterpreter; class CAFocalInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { Tag *unitTag = t->getParent()->getRoot()->findTag ("FocalUnits"); double v = unitTag ? unitTag->toDouble() : 1.; @@ -957,7 +957,7 @@ public: }; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int lensID = t->toInt(); @@ -1109,7 +1109,7 @@ CAFocalTypeInterpreter caFocalTypeInterpreter; class CAFocalPlaneInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int val = t->toInt(); @@ -1127,7 +1127,7 @@ CAFocalPlaneInterpreter caFocalPlaneInterpreter; class CAExposureTimeInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double d = pow (2, - t->toInt() / 32.0); @@ -1139,7 +1139,7 @@ CAExposureTimeInterpreter caExposureTimeInterpreter; class CAEVInterpreter : public Interpreter { - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%.1f", t->toDouble() / 32.0 ); @@ -1151,7 +1151,7 @@ CAEVInterpreter caEVInterpreter; class CABaseISOInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int a = t->toInt(); @@ -1288,7 +1288,7 @@ CASlowShutterInterpreter caSlowShutterInterpreter; class CAFlashGuideNumberInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int n = t->toInt(); @@ -1349,7 +1349,7 @@ CAControModeInterpreter caControModeInterpreter; class CAFocusDistanceInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%.2f", t->toDouble() / 100 ); @@ -1361,7 +1361,7 @@ CAFocusDistanceInterpreter caFocusDistanceInterpreter; class CAMeasuredEVInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%.1f", t->toDouble() / 8 - 6 ); @@ -1496,7 +1496,7 @@ CAToningEffectInterpreter caToningEffectInterpreter; class CAFileNumberInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { unsigned long val = t->toInt (0, LONG); char buffer[32]; diff --git a/rtexif/nikonattribs.cc b/rtexif/nikonattribs.cc index 70246d6b2..a1fa28c34 100644 --- a/rtexif/nikonattribs.cc +++ b/rtexif/nikonattribs.cc @@ -34,7 +34,7 @@ class NAISOInterpreter : public Interpreter { public: NAISOInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%d", t->toInt (2)); @@ -47,7 +47,7 @@ class NAISOInfoISOInterpreter : public Interpreter { public: NAISOInfoISOInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int a = t->toInt(); @@ -83,7 +83,7 @@ class NAISOExpansionInterpreter : public Interpreter { public: NAISOExpansionInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt(); @@ -142,7 +142,7 @@ class NALensTypeInterpreter : public Interpreter { public: NALensTypeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt(); std::ostringstream str; @@ -191,7 +191,7 @@ class NAShootingModeInterpreter : public Interpreter { public: NAShootingModeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt(); std::ostringstream str; @@ -234,14 +234,26 @@ public: afpchoices[0x9] = "Far Left"; afpchoices[0xa] = "Far Right"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { + const auto get_from_choices = + [](const std::map& choices, int index) -> std::string + { + const std::map::const_iterator choice = choices.find(index); + + if (choice != choices.end()) { + return choice->second; + } + + return {}; + }; + int am = t->toInt (0, BYTE); int afp = t->toInt (1, BYTE); int aff = t->toInt (2, SHORT); std::ostringstream str; - str << "AFAreaMode = " << amchoices[am] << std::endl; - str << "AFAreaMode = " << afpchoices[afp] << std::endl; + str << "AFAreaMode = " << get_from_choices(amchoices, am) << std::endl; + str << "AFAreaMode = " << get_from_choices(afpchoices, afp) << std::endl; std::ostringstream af; @@ -314,7 +326,7 @@ class NALensDataInterpreter : public Interpreter static const std::map lenses; public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { static const unsigned char xlat[2][256] = { diff --git a/rtexif/olympusattribs.cc b/rtexif/olympusattribs.cc index ccf28d0ca..e42763e35 100644 --- a/rtexif/olympusattribs.cc +++ b/rtexif/olympusattribs.cc @@ -33,7 +33,7 @@ class OLOnOffInterpreter : public Interpreter { public: OLOnOffInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { if (t->toInt() == 0) { return "Off"; @@ -48,7 +48,7 @@ class OLYesNoInterpreter : public Interpreter { public: OLYesNoInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { if (t->toInt() == 0) { return "No"; @@ -63,7 +63,7 @@ class OLApertureInterpreter : public Interpreter { public: OLApertureInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; str.precision (2); @@ -194,7 +194,7 @@ public: lenses["03 02 00"] = "Leica D Summilux 25mm f/1.4 Asph."; lenses["05 01 10"] = "Tamron 14-150mm f/3.5-5.8 Di III"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream lid; lid.setf (std::ios_base::hex, std::ios_base::basefield); @@ -203,7 +203,7 @@ public: lid << std::setw (2) << std::setfill ('0') << t->toInt (2) << ' '; //model lid << std::setw (2) << std::setfill ('0') << t->toInt (3); // submodel - std::map::iterator r = lenses.find (lid.str()); + std::map::const_iterator r = lenses.find (lid.str()); if (r != lenses.end()) { return r->second; @@ -465,7 +465,7 @@ class OLNoiseFilterInterpreter : public Interpreter { public: OLNoiseFilterInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0); int b = t->toInt (2); @@ -490,7 +490,7 @@ class OLFlashModeInterpreter : public Interpreter { public: OLFlashModeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int a = t->toInt (); @@ -509,7 +509,7 @@ class OLNoiseReductionInterpreter : public Interpreter { public: OLNoiseReductionInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int a = t->toInt (); diff --git a/rtexif/pentaxattribs.cc b/rtexif/pentaxattribs.cc index 971f07ce1..7e861d64f 100644 --- a/rtexif/pentaxattribs.cc +++ b/rtexif/pentaxattribs.cc @@ -415,7 +415,7 @@ class PAFNumberInterpreter: public Interpreter { public: PAFNumberInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = t->toDouble() / 10; @@ -610,7 +610,7 @@ public: choices[256 * 255 + 0] = "Video (Auto Aperture)"; choices[256 * 255 + 4] = "Video (4)"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int c = 256 * t->toInt (0, BYTE) + t->toInt (1, BYTE); const ChoicesIterator r = choices.find (c); @@ -669,12 +669,12 @@ public: choices3[224] = "HDR Auto"; choices3[255] = "Video"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); - std::map::iterator r1 = choices1.find (t->toInt (1, BYTE)); - std::map::iterator r2 = choices2.find (t->toInt (2, BYTE)); - std::map::iterator r3 = choices3.find (t->toInt (3, BYTE)); + std::map::const_iterator r1 = choices1.find (t->toInt (1, BYTE)); + std::map::const_iterator r2 = choices2.find (t->toInt (2, BYTE)); + std::map::const_iterator r3 = choices3.find (t->toInt (3, BYTE)); std::ostringstream s; s << ((r != choices.end()) ? r->second : ""); s << ((r1 != choices1.end()) ? r1->second : "") << " "; @@ -993,7 +993,7 @@ public: choices.insert (p_t (256 * 22 + 4, "04 Toy Lens Wide 6.3mm f/7.1")); choices.insert (p_t (256 * 22 + 5, "05 Toy Lens Telephoto 18mm f/8")); } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double *liArray = nullptr; double maxApertureAtFocal = 0.; @@ -1061,7 +1061,7 @@ class PASRResultInterpreter: public Interpreter { public: PASRResultInterpreter() { } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int b = t->toInt (0, BYTE); @@ -1146,7 +1146,7 @@ public: choices[ 2 << 8 | 4 ] = "Auto"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int idx = 0; @@ -1173,7 +1173,7 @@ public: choices[2] = "Standard"; choices[3] = "Fast"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); std::ostringstream s; @@ -1211,7 +1211,7 @@ public: choices[2] = "Medium"; choices[3] = "High"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); std::ostringstream s; @@ -1243,11 +1243,11 @@ public: choices2[8] = "2 EV"; choices2[12] = "3 EV"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); - std::map::iterator r1 = choices1.find (t->toInt (1, BYTE)); - std::map::iterator r2 = choices2.find (t->toInt (2, BYTE)); + std::map::const_iterator r1 = choices1.find (t->toInt (1, BYTE)); + std::map::const_iterator r2 = choices2.find (t->toInt (2, BYTE)); std::ostringstream s; s << ((r != choices.end() ) ? r->second : "") << std::endl; s << ((r1 != choices1.end()) ? r1->second : "") << std::endl; @@ -1290,7 +1290,7 @@ class PALensModelQInterpreter: public Interpreter { public: PALensModelQInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[31]; buffer[0] = 0; // @@ -1308,7 +1308,7 @@ class PALensInfoQInterpreter: public Interpreter { public: PALensInfoQInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[21]; buffer[0] = 0; @@ -1326,7 +1326,7 @@ class PAFlashExposureCompInterpreter: public Interpreter { public: PAFlashExposureCompInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a; @@ -1359,7 +1359,7 @@ class PAFocalLengthInterpreter: public Interpreter { public: PAFocalLengthInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double a = double (t->toInt (0, LONG)); @@ -1388,7 +1388,7 @@ class PALensDataFocalLengthInterpreter: public Interpreter { public: PALensDataFocalLengthInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2)); @@ -1419,7 +1419,7 @@ class PAISOfInterpreter: public Interpreter { public: PAISOfInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); char buffer[32]; @@ -1439,7 +1439,7 @@ class PAMaxApertureInterpreter: public Interpreter { public: PAMaxApertureInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); a &= 0x7F; @@ -1476,7 +1476,7 @@ class PAAEXvInterpreter: public Interpreter { public: PAAEXvInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); char buffer[32]; @@ -1496,7 +1496,7 @@ class PAAEBXvInterpreter: public Interpreter { public: PAAEBXvInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, SBYTE); char buffer[32]; @@ -1516,7 +1516,7 @@ class PAApertureInterpreter: public Interpreter { public: PAApertureInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); char buffer[32]; @@ -1536,7 +1536,7 @@ class PAExposureTimeInterpreter: public Interpreter { public: PAExposureTimeInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); char buffer[32]; @@ -1556,7 +1556,7 @@ class PANominalMinApertureInterpreter: public Interpreter { public: PANominalMinApertureInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int a = t->toInt (0, BYTE); @@ -1576,7 +1576,7 @@ class PANominalMaxApertureInterpreter: public Interpreter { public: PANominalMaxApertureInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int a = t->toInt (0, BYTE); @@ -1694,7 +1694,7 @@ class PAExternalFlashGNInterpreter: public Interpreter { public: PAExternalFlashGNInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; int b = t->toInt (0, BYTE) & 0x1F; @@ -1708,7 +1708,7 @@ class PAEVStepsInterpreter: public Interpreter { public: PAEVStepsInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; @@ -1727,7 +1727,7 @@ class PAEDialinInterpreter: public Interpreter { public: PAEDialinInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; @@ -1746,7 +1746,7 @@ class PAApertureRingUseInterpreter: public Interpreter { public: PAApertureRingUseInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; @@ -1776,7 +1776,7 @@ public: choices[9] = "Slow-sync, Red-eye reduction"; choices[10] = "Trailing-curtain Sync"; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const ChoicesIterator r = choices.find (t->toInt (0, BYTE) >> 4); @@ -1795,7 +1795,7 @@ class PAMeteringMode2Interpreter: public Interpreter { public: PAMeteringMode2Interpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int v = (t->toInt (0, BYTE) & 0xF); @@ -1859,7 +1859,7 @@ class PAProgramLineInterpreter: public Interpreter { public: PAProgramLineInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::ostringstream str; int c = t->toInt (0, BYTE); @@ -1899,7 +1899,7 @@ class PAAFModeInterpreter: public Interpreter { public: PAAFModeInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { switch (t->toInt (0, BYTE) & 0x3) { case 0: @@ -1925,7 +1925,7 @@ class PAAFPointSelectedInterpreter: public Interpreter { public: PAAFPointSelectedInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int c = t->toInt (0, SHORT); @@ -1949,7 +1949,7 @@ class PADriveMode2Interpreter: public Interpreter { public: PADriveMode2Interpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int c = t->toInt (0, BYTE); diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 39d85ace9..f8ec3e5db 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -1767,7 +1767,7 @@ std::string Tag::nameToString (int i) return buffer; } -std::string Tag::valueToString () +std::string Tag::valueToString () const { if (attrib && attrib->interpreter) { @@ -3439,7 +3439,7 @@ short int int2_to_signed (short unsigned int i) * -mm f/- * NB: no space between separator '-'; no space between focal length and 'mm' */ -bool extractLensInfo (std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal) +bool extractLensInfo (const std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal) { minFocal = 0.0; maxFocal = 0.0; diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 242e02dea..67ce90552 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -58,7 +58,7 @@ const enum ByteOrder HOSTORDER = MOTOROLA; #endif enum MNKind {NOMK, IFD, HEADERIFD, NIKON3, OLYMPUS2, FUJI, TABLESUBDIR}; -bool extractLensInfo (std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); +bool extractLensInfo (const std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); unsigned short sget2 (unsigned char *s, ByteOrder order); int sget4 (unsigned char *s, ByteOrder order); @@ -293,7 +293,7 @@ public: int getDistanceFrom (const TagDirectory *root); // additional getter/setter for more comfortable use - std::string valueToString (); + std::string valueToString () const; std::string nameToString (int i = 0); void valueFromString (const std::string& value); void userCommentFromString (const Glib::ustring& text); @@ -372,7 +372,7 @@ class Interpreter public: Interpreter () {} virtual ~Interpreter() {}; - virtual std::string toString (Tag* t) + virtual std::string toString (const Tag* t) const { char buffer[1024]; t->toString (buffer); @@ -493,7 +493,7 @@ protected: Choices choices; public: ChoiceInterpreter () {}; - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { const typename std::map::const_iterator r = choices.find(t->toInt()); @@ -512,11 +512,11 @@ class IntLensInterpreter : public Interpreter { protected: typedef std::multimap< T, std::string> container_t; - typedef typename std::multimap< T, std::string>::iterator it_t; + typedef typename std::multimap< T, std::string>::const_iterator it_t; typedef std::pair< T, std::string> p_t; container_t choices; - virtual std::string guess (const T lensID, double focalLength, double maxApertureAtFocal, double *lensInfoArray) + virtual std::string guess (const T lensID, double focalLength, double maxApertureAtFocal, double *lensInfoArray) const { it_t r; size_t nFound = choices.count ( lensID ); diff --git a/rtexif/sonyminoltaattribs.cc b/rtexif/sonyminoltaattribs.cc index c8bbeb91d..0c6e433ff 100644 --- a/rtexif/sonyminoltaattribs.cc +++ b/rtexif/sonyminoltaattribs.cc @@ -1158,7 +1158,7 @@ public: }; } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int lensID = t->toInt(); Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo"); @@ -1309,7 +1309,7 @@ public: choices.insert (p_t (51507, "Samyang AF 35mm f/1.4")); } - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int lensID = t->toInt(); Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo"); @@ -2103,7 +2103,7 @@ class SAExposureTimeInterpreter : public Interpreter { public: SAExposureTimeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double a = t->toDouble(); @@ -2163,7 +2163,7 @@ class SAFNumberInterpreter : public Interpreter { public: SAFNumberInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double a = double (t->toDouble()); @@ -2223,7 +2223,7 @@ class SAISOSettingInterpreter : public Interpreter { public: SAISOSettingInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->toInt(); @@ -2264,7 +2264,7 @@ class SAExposureCompSetInterpreter : public Interpreter { public: SAExposureCompSetInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { double a = t->toDouble(); char buffer[32]; @@ -2285,7 +2285,7 @@ class SAAFMicroAdjValueInterpreter : public Interpreter { public: SAAFMicroAdjValueInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%d", t->getValue()[0] - 20); @@ -2302,7 +2302,7 @@ class SAAFMicroAdjModeInterpreter : public Interpreter { public: SAAFMicroAdjModeInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int a = t->getValue()[0] & 0x80; @@ -2324,7 +2324,7 @@ class SAAFMicroAdjRegisteredLensesInterpreter : public Interpreter { public: SAAFMicroAdjRegisteredLensesInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%d", t->getValue()[0] & 0x7f); @@ -2341,7 +2341,7 @@ class SAFocusStatusInterpreter : public Interpreter { public: SAFocusStatusInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { std::string retval; int a = t->toInt(); @@ -2380,7 +2380,7 @@ class SAColorTemperatureSettingInterpreter : public Interpreter { public: SAColorTemperatureSettingInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; sprintf (buffer, "%d", t->toInt()); diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc index aa8ed2b97..ec5534381 100644 --- a/rtexif/stdattribs.cc +++ b/rtexif/stdattribs.cc @@ -327,7 +327,7 @@ class FNumberInterpreter : public Interpreter { public: FNumberInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = t->toDouble(); @@ -346,7 +346,7 @@ class ApertureInterpreter : public Interpreter { public: ApertureInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = pow (2.0, t->toDouble() / 2.0); @@ -365,7 +365,7 @@ class ExposureBiasInterpreter : public Interpreter { public: ExposureBiasInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = t->toDouble(); @@ -384,7 +384,7 @@ class ShutterSpeedInterpreter : public Interpreter { public: ShutterSpeedInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double d = pow (2.0, -t->toDouble()); @@ -404,7 +404,7 @@ class ExposureTimeInterpreter : public Interpreter { public: ExposureTimeInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double d = t->toDouble(); @@ -424,7 +424,7 @@ class FocalLengthInterpreter : public Interpreter { public: FocalLengthInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char buffer[32]; double v = t->toDouble(); @@ -443,7 +443,7 @@ class UserCommentInterpreter : public Interpreter { public: UserCommentInterpreter () {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int count = t->getCount(); @@ -575,7 +575,7 @@ class CFAInterpreter : public Interpreter { public: CFAInterpreter() {} - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { char colors[] = "RGB"; char buffer[1024]; @@ -632,7 +632,7 @@ UTF8BinInterpreter utf8BinInterpreter; class RawImageSegmentationInterpreter : public Interpreter { public: - std::string toString (Tag* t) override + std::string toString (const Tag* t) const override { int segmentNumber = t->toInt(0, SHORT); int segmentWidth = t->toInt(2, SHORT);