0917_returnvaluesanderror.patch

Thomas Schmidt, 13 Jan 2015 23:05

Download (2.24 KB)

View differences:

src/actions.cpp (Arbeitskopie)
513 513

  
514 514
    int Print::printMetadata(const Exiv2::Image* image)
515 515
    {
516
        int rc = 0;
516
        bool bFoundSomeMetadata = false;
517
        bool bTagFilterGiven = !Params::instance().keys_.empty();  // were tag filters given with -g?
517 518
        if (Params::instance().printTags_ & Exiv2::mdExif) {
518 519
            const Exiv2::ExifData& exifData = image->exifData();
519 520
            for (Exiv2::ExifData::const_iterator md = exifData.begin();
......
521 522
                printMetadatum(*md, image);
522 523
            }
523 524
            if (exifData.empty()) {
524
                if (Params::instance().verbose_) {
525
                if( !bTagFilterGiven) {
525 526
                    std::cerr << path_ << ": " << _("No Exif data found in the file\n");
526 527
                }
527
                rc = -3;
528
            }
528
            } else {
529
                bFoundSomeMetadata = true;
530
            }            
529 531
        }
530 532
        if (Params::instance().printTags_ & Exiv2::mdIptc) {
531 533
            const Exiv2::IptcData& iptcData = image->iptcData();
......
534 536
                printMetadatum(*md, image);
535 537
            }
536 538
            if (iptcData.empty()) {
537
                if (Params::instance().verbose_) {
539
                if( !bTagFilterGiven) {
538 540
                    std::cerr << path_ << ": " << _("No IPTC data found in the file\n");
539 541
                }
540
                rc = -3;
542
            } else {
543
                bFoundSomeMetadata = true;
541 544
            }
542 545
        }
543 546
        if (Params::instance().printTags_ & Exiv2::mdXmp) {
......
547 550
                printMetadatum(*md, image);
548 551
            }
549 552
            if (xmpData.empty()) {
550
                if (Params::instance().verbose_) {
553
                if( !bTagFilterGiven) {
551 554
                    std::cerr << path_ << ": " << _("No XMP data found in the file\n");
552 555
                }
553
                rc = -3;
556
            } else {
557
                bFoundSomeMetadata = true;
554 558
            }
555 559
        }
556
        return rc;
560
        return bFoundSomeMetadata ? 0 : -3;
557 561
    } // Print::printMetadata
558 562

  
559 563
    bool Print::grepTag(const std::string& key)
Redmine Appliance - Powered by TurnKey Linux