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

@ -49,15 +49,12 @@ int main(int argc, char* argv[])
} }
*/ */
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,29 +86,36 @@ 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") {
if ( ExifTags::isExifGroup(name) ) {
ExifTags::taglist(std::cout,name);
rc = 0; // result is good
} else {
std::cerr << "warning:"
<< name
<< " is not a valid Exif group name "
<< std::endl
;
const GroupInfo* groupList = ExifTags::groupList(); const GroupInfo* groupList = ExifTags::groupList();
if (groupList) { if (groupList) {
while (groupList->tagList_) { while (rc && groupList->tagList_) {
int count = 0;
if (name == groupList->groupName_) { if (name == groupList->groupName_) {
const Exiv2::TagInfo* tagInfo = groupList->tagList_(); const Exiv2::TagInfo* tagInfo = groupList->tagList_();
while (tagInfo->tag_ != 0xFFFF) { while (tagInfo->tag_ != 0xFFFF) {
std::cout << tagInfo->name_ << std::endl; std::cout << tagInfo->name_ << std::endl;
tagInfo++; tagInfo++;
count++;
} }
rc = 0; // result is good rc = 0; // result is good
std::cout << "Tags = " << count << std::endl;
} }
groupList++; groupList++;
} }
} }
} }
}
} break; } break;
default: default:

Loading…
Cancel
Save