@@ -179,7 +179,7 @@ int setModeAndPrintStructure(Exiv2::PrintStructureOption option, const std::stri
179179 ascii.write_uint8 (str.size () * 3 , 0 );
180180 std::copy (str.begin (), str.end (), iccProfile.begin ());
181181 if (Exiv2::base64encode (iccProfile.c_data (), str.size (), reinterpret_cast <char *>(ascii.data ()), str.size () * 3 )) {
182- long chunk = 60 ;
182+ const size_t chunk = 60 ;
183183 std::string code = std::string (" data:" ) + ascii.c_str ();
184184 size_t length = code.size ();
185185 for (size_t start = 0 ; start < length; start += chunk) {
@@ -364,8 +364,8 @@ int Print::printList() {
364364 auto image = Exiv2::ImageFactory::open (path_);
365365 image->readMetadata ();
366366 // Set defaults for metadata types and data columns
367- if (Params::instance ().printTags_ == Exiv2::mdNone ) {
368- Params::instance ().printTags_ = Exiv2::mdExif | Exiv2::mdIptc | Exiv2::mdXmp ;
367+ if (Params::instance ().printTags_ == MetadataId::invalid ) {
368+ Params::instance ().printTags_ = MetadataId::exif | MetadataId::iptc | MetadataId::xmp ;
369369 }
370370 if (Params::instance ().printItems_ == 0 ) {
371371 Params::instance ().printItems_ = Params::prKey | Params::prType | Params::prCount | Params::prTrans;
@@ -376,7 +376,7 @@ int Print::printList() {
376376int Print::printMetadata (const Exiv2::Image* image) {
377377 bool ret = false ;
378378 bool noExif = false ;
379- if (Params::instance ().printTags_ & Exiv2::mdExif ) {
379+ if (( Params::instance ().printTags_ & MetadataId::exif) == MetadataId::exif ) {
380380 const Exiv2::ExifData& exifData = image->exifData ();
381381 for (auto && md : exifData) {
382382 ret |= printMetadatum (md, image);
@@ -386,7 +386,7 @@ int Print::printMetadata(const Exiv2::Image* image) {
386386 }
387387
388388 bool noIptc = false ;
389- if (Params::instance ().printTags_ & Exiv2::mdIptc ) {
389+ if (( Params::instance ().printTags_ & MetadataId::iptc) == MetadataId::iptc ) {
390390 const Exiv2::IptcData& iptcData = image->iptcData ();
391391 for (auto && md : iptcData) {
392392 ret |= printMetadatum (md, image);
@@ -396,7 +396,7 @@ int Print::printMetadata(const Exiv2::Image* image) {
396396 }
397397
398398 bool noXmp = false ;
399- if (Params::instance ().printTags_ & Exiv2::mdXmp ) {
399+ if (( Params::instance ().printTags_ & MetadataId::xmp) == MetadataId::xmp ) {
400400 const Exiv2::XmpData& xmpData = image->xmpData ();
401401 for (auto && md : xmpData) {
402402 ret |= printMetadatum (md, image);
@@ -1148,23 +1148,23 @@ int Modify::applyCommands(Exiv2::Image* pImage) {
11481148 int ret = 0 ;
11491149 for (auto && cmd : modifyCmds) {
11501150 switch (cmd.cmdId_ ) {
1151- case add:
1151+ case CmdId:: add:
11521152 ret = addMetadatum (pImage, cmd);
11531153 if (rc == 0 )
11541154 rc = ret;
11551155 break ;
1156- case set:
1156+ case CmdId:: set:
11571157 ret = setMetadatum (pImage, cmd);
11581158 if (rc == 0 )
11591159 rc = ret;
11601160 break ;
1161- case del:
1161+ case CmdId:: del:
11621162 delMetadatum (pImage, cmd);
11631163 break ;
1164- case reg:
1164+ case CmdId:: reg:
11651165 regNamespace (cmd);
11661166 break ;
1167- case invalidCmdId :
1167+ case CmdId::invalid :
11681168 break ;
11691169 }
11701170 }
@@ -1184,13 +1184,13 @@ int Modify::addMetadatum(Exiv2::Image* pImage, const ModifyCmd& modifyCmd) {
11841184 auto value = Exiv2::Value::create (modifyCmd.typeId_ );
11851185 int rc = value->read (modifyCmd.value_ );
11861186 if (0 == rc) {
1187- if (modifyCmd.metadataId_ == exif) {
1187+ if (modifyCmd.metadataId_ == MetadataId:: exif) {
11881188 exifData.add (Exiv2::ExifKey (modifyCmd.key_ ), value.get ());
11891189 }
1190- if (modifyCmd.metadataId_ == iptc) {
1190+ if (modifyCmd.metadataId_ == MetadataId:: iptc) {
11911191 iptcData.add (Exiv2::IptcKey (modifyCmd.key_ ), value.get ());
11921192 }
1193- if (modifyCmd.metadataId_ == xmp) {
1193+ if (modifyCmd.metadataId_ == MetadataId:: xmp) {
11941194 xmpData.add (Exiv2::XmpKey (modifyCmd.key_ ), value.get ());
11951195 }
11961196 } else {
@@ -1213,19 +1213,19 @@ int Modify::setMetadatum(Exiv2::Image* pImage, const ModifyCmd& modifyCmd) {
12131213 Exiv2::IptcData& iptcData = pImage->iptcData ();
12141214 Exiv2::XmpData& xmpData = pImage->xmpData ();
12151215 Exiv2::Metadatum* metadatum = nullptr ;
1216- if (modifyCmd.metadataId_ == exif) {
1216+ if (modifyCmd.metadataId_ == MetadataId:: exif) {
12171217 auto pos = exifData.findKey (Exiv2::ExifKey (modifyCmd.key_ ));
12181218 if (pos != exifData.end ()) {
12191219 metadatum = &(*pos);
12201220 }
12211221 }
1222- if (modifyCmd.metadataId_ == iptc) {
1222+ if (modifyCmd.metadataId_ == MetadataId:: iptc) {
12231223 auto pos = iptcData.findKey (Exiv2::IptcKey (modifyCmd.key_ ));
12241224 if (pos != iptcData.end ()) {
12251225 metadatum = &(*pos);
12261226 }
12271227 }
1228- if (modifyCmd.metadataId_ == xmp) {
1228+ if (modifyCmd.metadataId_ == MetadataId:: xmp) {
12291229 auto pos = xmpData.findKey (Exiv2::XmpKey (modifyCmd.key_ ));
12301230 if (pos != xmpData.end ()) {
12311231 metadatum = &(*pos);
@@ -1246,13 +1246,13 @@ int Modify::setMetadatum(Exiv2::Image* pImage, const ModifyCmd& modifyCmd) {
12461246 if (metadatum) {
12471247 metadatum->setValue (value.get ());
12481248 } else {
1249- if (modifyCmd.metadataId_ == exif) {
1249+ if (modifyCmd.metadataId_ == MetadataId:: exif) {
12501250 exifData.add (Exiv2::ExifKey (modifyCmd.key_ ), value.get ());
12511251 }
1252- if (modifyCmd.metadataId_ == iptc) {
1252+ if (modifyCmd.metadataId_ == MetadataId:: iptc) {
12531253 iptcData.add (Exiv2::IptcKey (modifyCmd.key_ ), value.get ());
12541254 }
1255- if (modifyCmd.metadataId_ == xmp) {
1255+ if (modifyCmd.metadataId_ == MetadataId:: xmp) {
12561256 xmpData.add (Exiv2::XmpKey (modifyCmd.key_ ), value.get ());
12571257 }
12581258 }
@@ -1273,21 +1273,21 @@ void Modify::delMetadatum(Exiv2::Image* pImage, const ModifyCmd& modifyCmd) {
12731273 Exiv2::ExifData& exifData = pImage->exifData ();
12741274 Exiv2::IptcData& iptcData = pImage->iptcData ();
12751275 Exiv2::XmpData& xmpData = pImage->xmpData ();
1276- if (modifyCmd.metadataId_ == exif) {
1276+ if (modifyCmd.metadataId_ == MetadataId:: exif) {
12771277 Exiv2::ExifData::iterator pos;
12781278 const Exiv2::ExifKey exifKey (modifyCmd.key_ );
12791279 while ((pos = exifData.findKey (exifKey)) != exifData.end ()) {
12801280 exifData.erase (pos);
12811281 }
12821282 }
1283- if (modifyCmd.metadataId_ == iptc) {
1283+ if (modifyCmd.metadataId_ == MetadataId:: iptc) {
12841284 Exiv2::IptcData::iterator pos;
12851285 const Exiv2::IptcKey iptcKey (modifyCmd.key_ );
12861286 while ((pos = iptcData.findKey (iptcKey)) != iptcData.end ()) {
12871287 iptcData.erase (pos);
12881288 }
12891289 }
1290- if (modifyCmd.metadataId_ == xmp) {
1290+ if (modifyCmd.metadataId_ == MetadataId:: xmp) {
12911291 Exiv2::XmpData::iterator pos;
12921292 const Exiv2::XmpKey xmpKey (modifyCmd.key_ );
12931293 if ((pos = xmpData.findKey (xmpKey)) != xmpData.end ()) {
@@ -1617,7 +1617,7 @@ int str2Tm(const std::string& timeStr, struct tm* tm) {
16171617 std::memset (tm, 0x0 , sizeof (struct tm ));
16181618 tm->tm_isdst = -1 ;
16191619
1620- long tmp = 0 ;
1620+ int64_t tmp = 0 ;
16211621 if (!Util::strtol (timeStr.substr (0 , 4 ).c_str (), tmp))
16221622 return 5 ;
16231623 // tmp is a 4-digit number so this cast cannot overflow
@@ -1759,7 +1759,7 @@ int metacopy(const std::string& source, const std::string& tgt, Exiv2::ImageType
17591759 }
17601760
17611761 // #1148 use Raw XMP packet if there are no XMP modification commands
1762- int tRawSidecar = Params::ctXmpSidecar | Params::ctXmpRaw; // option -eXX
1762+ Params::CommonTarget tRawSidecar = Params::ctXmpSidecar | Params::ctXmpRaw; // option -eXX
17631763 if (Params::instance ().modifyCmds_ .empty () && (Params::instance ().target_ & tRawSidecar) == tRawSidecar) {
17641764 // std::cout << "short cut" << std::endl;
17651765 // http://www.cplusplus.com/doc/tutorial/files/
0 commit comments