@@ -22,10 +22,7 @@ class RotationMap {
2222
2323 private:
2424 // ! Helper structure for the mapping list
25- struct OmList {
26- uint16_t orientation; // !< Exif orientation value
27- int32_t degrees; // !< CRW Rotation degrees
28- };
25+ using OmList = std::pair<uint16_t , int32_t >;
2926 // DATA
3027 static const OmList omList_[];
3128}; // class RotationMap
@@ -520,7 +517,7 @@ CiffComponent* CiffDirectory::doFindComponent(uint16_t crwTagId, uint16_t crwDir
520517void CiffHeader::add (uint16_t crwTagId, uint16_t crwDir, DataBuf&& buf) {
521518 CrwDirs crwDirs;
522519 CrwMap::loadStack (crwDirs, crwDir);
523- [[maybe_unused]] uint16_t rootDirectory = crwDirs.top (). crwDir_ ;
520+ [[maybe_unused]] auto [ rootDirectory, _] = crwDirs.top ();
524521 crwDirs.pop ();
525522 if (!pRootDir_) {
526523 pRootDir_ = std::make_unique<CiffDirectory>();
@@ -553,18 +550,18 @@ CiffComponent* CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) {
553550 set value
554551 */
555552 if (!crwDirs.empty ()) {
556- CrwSubDir csd = crwDirs.top ();
553+ auto [dir, parent] = crwDirs.top ();
557554 crwDirs.pop ();
558555 // Find the directory
559556 for (auto && component : components_) {
560- if (component->tag () == csd. crwDir_ ) {
557+ if (component->tag () == dir ) {
561558 cc_ = component;
562559 break ;
563560 }
564561 }
565562 if (!cc_) {
566563 // Directory doesn't exist yet, add it
567- m_ = std::make_unique<CiffDirectory>(csd. crwDir_ , csd. parent_ );
564+ m_ = std::make_unique<CiffDirectory>(dir, parent );
568565 cc_ = m_.get ();
569566 add (std::move (m_));
570567 }
@@ -592,7 +589,6 @@ void CiffHeader::remove(uint16_t crwTagId, uint16_t crwDir) {
592589 if (pRootDir_) {
593590 CrwDirs crwDirs;
594591 CrwMap::loadStack (crwDirs, crwDir);
595- [[maybe_unused]] uint16_t rootDirectory = crwDirs.top ().crwDir_ ;
596592 crwDirs.pop ();
597593 pRootDir_->remove (crwDirs, crwTagId);
598594 }
@@ -608,11 +604,11 @@ void CiffComponent::doRemove(CrwDirs& /*crwDirs*/, uint16_t /*crwTagId*/) {
608604
609605void CiffDirectory::doRemove (CrwDirs& crwDirs, uint16_t crwTagId) {
610606 if (!crwDirs.empty ()) {
611- CrwSubDir csd = crwDirs.top ();
607+ auto [dir, _] = crwDirs.top ();
612608 crwDirs.pop ();
613609 // Find the directory
614610 for (auto i = components_.begin (); i != components_.end (); ++i) {
615- if ((*i)->tag () == csd. crwDir_ ) {
611+ if ((*i)->tag () == dir ) {
616612 // Recursive call to next lower level directory
617613 (*i)->remove (crwDirs, crwTagId);
618614 if ((*i)->empty ())
@@ -743,8 +739,8 @@ void CrwMap::decodeArray(const CiffComponent& ciffComponent, const CrwMapping* p
743739 if (ifdId == canonSiId) {
744740 // Exif.Photo.FNumber
745741 float f = fnumber (canonEv (aperture));
746- Rational r = floatToRationalCast (f);
747- URational ur (r. first , r. second );
742+ auto [r, s] = floatToRationalCast (f);
743+ auto ur = URational (r, s );
748744 URationalValue fn;
749745 fn.value_ .push_back (ur);
750746 image.exifData ().add (ExifKey (" Exif.Photo.FNumber" ), &fn);
@@ -835,9 +831,10 @@ void CrwMap::decodeBasic(const CiffComponent& ciffComponent, const CrwMapping* p
835831
836832void CrwMap::loadStack (CrwDirs& crwDirs, uint16_t crwDir) {
837833 for (auto && crw : crwSubDir_) {
838- if (crw.crwDir_ == crwDir) {
834+ auto && [dir, parent] = crw;
835+ if (dir == crwDir) {
839836 crwDirs.push (crw);
840- crwDir = crw. parent_ ;
837+ crwDir = parent ;
841838 }
842839 }
843840} // CrwMap::loadStack
0 commit comments