Skip to content

Commit

Permalink
Merge pull request #2039 from Exiv2/mergify/bp/main/pr-2037
Browse files Browse the repository at this point in the history
Fix bug in loop. It wasn't iterating over the elements of dateStrings as intended (backport #2037)
  • Loading branch information
kevinbackhouse authored Dec 22, 2021
2 parents bea66d6 + 891f58a commit c28e501
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions samples/geotag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,9 @@ time_t readImageTime(const std::string& path, std::string* pS = nullptr)

const char* dateStrings[] = {"Exif.Photo.DateTimeOriginal", "Exif.Photo.DateTimeDigitized", "Exif.Image.DateTime",
nullptr};
const char* dateString = dateStrings[0] ;

do {
for (size_t i = 0; !result && dateStrings[i]; i++) {
const char* dateString = dateStrings[i] ;
try {
Image::UniquePtr image = ImageFactory::open(path);
if ( image.get() ) {
Expand All @@ -626,7 +626,7 @@ time_t readImageTime(const std::string& path, std::string* pS = nullptr)
if ( result && pS ) *pS = exifData[dateString].toString();
}
} catch ( ... ) {};
} while ( !result && ++dateString );
}

return result ;
}
Expand Down

0 comments on commit c28e501

Please sign in to comment.