Fix samples/tags.cpp to call ExifTags::taglist() (https://github.com/Exiv2/exiv2/issues/465)

v0.27.3
clanmills 7 years ago committed by Luis Díaz Más
parent 12d44f8f17
commit 4a1d0962fc

@ -25,39 +25,36 @@ int main(int argc, char* argv[])
std::string item(argv[1]); std::string item(argv[1]);
if (item == "Groups") { if (item == "Groups") {
/* /*
https://cgit.kde.org/digikam.git/tree/core/libs/dmetadata/metaengine_exif.cpp#n1077 https://cgit.kde.org/digikam.git/tree/core/libs/dmetadata/metaengine_exif.cpp#n1077
const Exiv2::GroupInfo* gi = Exiv2::ExifTags::groupList(); const Exiv2::GroupInfo* gi = Exiv2::ExifTags::groupList();
while (gi->tagList_ != 0) while (gi->tagList_ != 0)
{ {
// NOTE: See BUG #375809 : MPF tags = exception Exiv2 0.26 // NOTE: See BUG #375809 : MPF tags = exception Exiv2 0.26
if (QLatin1String(gi->ifdName_) != QLatin1String("Makernote"))
{
Exiv2::TagListFct tl = gi->tagList_;
const Exiv2::TagInfo* ti = tl();
while (ti->tag_ != 0xFFFF) if (QLatin1String(gi->ifdName_) != QLatin1String("Makernote"))
{ {
tags << ti; Exiv2::TagListFct tl = gi->tagList_;
++ti; const Exiv2::TagInfo* ti = tl();
}
}
++gi; while (ti->tag_ != 0xFFFF)
{
tags << ti;
++ti;
} }
}
++gi;
}
*/ */
const GroupInfo* groupList = ExifTags::groupList(); const GroupInfo* groupList = ExifTags::groupList();
int count = 0;
if (groupList) { if (groupList) {
while (groupList->tagList_ && count < 10000) { while (groupList->tagList_) {
count++;
std::cout << groupList->groupName_ << std::endl; std::cout << groupList->groupName_ << std::endl;
groupList++; groupList++;
} }
} }
std::cout << "Groups = " << count << std::endl;
break; break;
} }
@ -89,26 +86,33 @@ int main(int argc, char* argv[])
break; break;
case 3: { case 3: {
rc = 1; // assume unhappy ending!
std::string item(argv[1]); std::string item(argv[1]);
std::string name(argv[2]); std::string name(argv[2]);
rc = 1; // assume unhappy ending!
if (item == "--group") { if (item == "--group") {
const GroupInfo* groupList = ExifTags::groupList(); if ( ExifTags::isExifGroup(name) ) {
if (groupList) { ExifTags::taglist(std::cout,name);
while (groupList->tagList_) { rc = 0; // result is good
int count = 0; } else {
if (name == groupList->groupName_) { std::cerr << "warning:"
const Exiv2::TagInfo* tagInfo = groupList->tagList_(); << name
while (tagInfo->tag_ != 0xFFFF) { << " is not a valid Exif group name "
std::cout << tagInfo->name_ << std::endl; << std::endl
tagInfo++; ;
count++; const GroupInfo* groupList = ExifTags::groupList();
if (groupList) {
while (rc && groupList->tagList_) {
if (name == groupList->groupName_) {
const Exiv2::TagInfo* tagInfo = groupList->tagList_();
while (tagInfo->tag_ != 0xFFFF) {
std::cout << tagInfo->name_ << std::endl;
tagInfo++;
}
rc = 0; // result is good
} }
rc = 0; // result is good groupList++;
std::cout << "Tags = " << count << std::endl;
} }
groupList++;
} }
} }
} }

Loading…
Cancel
Save