manual for range loop conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
8e52032ee0
commit
20dfab8036
@ -489,14 +489,15 @@ namespace Action {
|
|||||||
bool Print::grepTag(const std::string& key)
|
bool Print::grepTag(const std::string& key)
|
||||||
{
|
{
|
||||||
bool result=Params::instance().greps_.empty();
|
bool result=Params::instance().greps_.empty();
|
||||||
for (auto g = Params::instance().greps_.begin(); !result && g != Params::instance().greps_.end(); ++g)
|
for (auto&& g : Params::instance().greps_) {
|
||||||
{
|
if (result)
|
||||||
|
break;
|
||||||
#if defined(EXV_HAVE_REGEX_H)
|
#if defined(EXV_HAVE_REGEX_H)
|
||||||
result = regexec( &(*g), key.c_str(), 0, NULL, 0) == 0 ;
|
result = regexec(&g, key.c_str(), 0, NULL, 0) == 0;
|
||||||
#else
|
#else
|
||||||
std::string Pattern(g->pattern_);
|
std::string Pattern(g.pattern_);
|
||||||
std::string Key(key);
|
std::string Key(key);
|
||||||
if ( g->bIgnoreCase_ ) {
|
if (g.bIgnoreCase_) {
|
||||||
// https://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/
|
// https://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/
|
||||||
std::transform(Pattern.begin(), Pattern.end(),Pattern.begin(), ::tolower);
|
std::transform(Pattern.begin(), Pattern.end(),Pattern.begin(), ::tolower);
|
||||||
std::transform(Key.begin() , Key.end() ,Key.begin() , ::tolower);
|
std::transform(Key.begin() , Key.end() ,Key.begin() , ::tolower);
|
||||||
@ -510,9 +511,10 @@ namespace Action {
|
|||||||
bool Print::keyTag(const std::string& key)
|
bool Print::keyTag(const std::string& key)
|
||||||
{
|
{
|
||||||
bool result=Params::instance().keys_.empty();
|
bool result=Params::instance().keys_.empty();
|
||||||
for (auto k = Params::instance().keys_.begin(); !result && k != Params::instance().keys_.end(); ++k)
|
for (auto&& k : Params::instance().keys_) {
|
||||||
{
|
if (result)
|
||||||
result = key == *k;
|
break;
|
||||||
|
result = key == k;
|
||||||
}
|
}
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
@ -1309,29 +1311,29 @@ namespace Action {
|
|||||||
|
|
||||||
// loop through command table and apply each command
|
// loop through command table and apply each command
|
||||||
ModifyCmds& modifyCmds = Params::instance().modifyCmds_;
|
ModifyCmds& modifyCmds = Params::instance().modifyCmds_;
|
||||||
auto i = modifyCmds.cbegin();
|
|
||||||
auto end = modifyCmds.cend();
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
for (; i != end; ++i) {
|
for (auto&& cmd : modifyCmds) {
|
||||||
switch (i->cmdId_) {
|
switch (cmd.cmdId_) {
|
||||||
case add:
|
case add:
|
||||||
ret = addMetadatum(pImage, *i);
|
ret = addMetadatum(pImage, cmd);
|
||||||
if (rc == 0) rc = ret;
|
if (rc == 0)
|
||||||
break;
|
rc = ret;
|
||||||
case set:
|
break;
|
||||||
ret = setMetadatum(pImage, *i);
|
case set:
|
||||||
if (rc == 0) rc = ret;
|
ret = setMetadatum(pImage, cmd);
|
||||||
break;
|
if (rc == 0)
|
||||||
case del:
|
rc = ret;
|
||||||
delMetadatum(pImage, *i);
|
break;
|
||||||
break;
|
case del:
|
||||||
case reg:
|
delMetadatum(pImage, cmd);
|
||||||
regNamespace(*i);
|
break;
|
||||||
break;
|
case reg:
|
||||||
case invalidCmdId:
|
regNamespace(cmd);
|
||||||
assert(invalidCmdId == i->cmdId_);
|
break;
|
||||||
break;
|
case invalidCmdId:
|
||||||
|
assert(invalidCmdId == cmd.cmdId_);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -1958,9 +1960,8 @@ namespace {
|
|||||||
<< " " << _("to") << " " << target << std::endl;
|
<< " " << _("to") << " " << target << std::endl;
|
||||||
}
|
}
|
||||||
if ( preserve ) {
|
if ( preserve ) {
|
||||||
auto end = sourceImage->exifData().end();
|
for (auto&& exif : sourceImage->exifData()) {
|
||||||
for (auto i = sourceImage->exifData().begin(); i != end; ++i) {
|
targetImage->exifData()[exif.key()] = exif.value();
|
||||||
targetImage->exifData()[i->key()] = i->value();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
targetImage->setExifData(sourceImage->exifData());
|
targetImage->setExifData(sourceImage->exifData());
|
||||||
@ -1973,9 +1974,8 @@ namespace {
|
|||||||
<< " " << _("to") << " " << target << std::endl;
|
<< " " << _("to") << " " << target << std::endl;
|
||||||
}
|
}
|
||||||
if ( preserve ) {
|
if ( preserve ) {
|
||||||
Exiv2::IptcData::const_iterator end = sourceImage->iptcData().end();
|
for (auto&& iptc : sourceImage->iptcData()) {
|
||||||
for (Exiv2::IptcData::const_iterator i = sourceImage->iptcData().begin(); i != end; ++i) {
|
targetImage->iptcData()[iptc.key()] = iptc.value();
|
||||||
targetImage->iptcData()[i->key()] = i->value();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
targetImage->setIptcData(sourceImage->iptcData());
|
targetImage->setIptcData(sourceImage->iptcData());
|
||||||
@ -2000,9 +2000,8 @@ namespace {
|
|||||||
os.close();
|
os.close();
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else if (preserve) {
|
} else if (preserve) {
|
||||||
Exiv2::XmpData::const_iterator end = sourceImage->xmpData().end();
|
for (auto&& xmp : sourceImage->xmpData()) {
|
||||||
for (Exiv2::XmpData::const_iterator i = sourceImage->xmpData().begin(); i != end; ++i) {
|
targetImage->xmpData()[xmp.key()] = xmp.value();
|
||||||
targetImage->xmpData()[i->key()] = i->value();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// std::cout << "long cut" << std::endl;
|
// std::cout << "long cut" << std::endl;
|
||||||
|
|||||||
@ -62,16 +62,14 @@ namespace {
|
|||||||
{ 6, -270 },
|
{ 6, -270 },
|
||||||
{ 8, 270 },
|
{ 8, 270 },
|
||||||
{ 8, -90 },
|
{ 8, -90 },
|
||||||
// last entry
|
|
||||||
{ 0, 0 }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint16_t RotationMap::orientation(int32_t degrees)
|
uint16_t RotationMap::orientation(int32_t degrees)
|
||||||
{
|
{
|
||||||
uint16_t o = 1;
|
uint16_t o = 1;
|
||||||
for (int i = 0; omList_[i].orientation != 0; ++i) {
|
for (auto&& om : omList_) {
|
||||||
if (omList_[i].degrees == degrees) {
|
if (om.degrees == degrees) {
|
||||||
o = omList_[i].orientation;
|
o = om.orientation;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,9 +79,9 @@ namespace {
|
|||||||
int32_t RotationMap::degrees(uint16_t orientation)
|
int32_t RotationMap::degrees(uint16_t orientation)
|
||||||
{
|
{
|
||||||
int32_t d = 0;
|
int32_t d = 0;
|
||||||
for (int i = 0; omList_[i].orientation != 0; ++i) {
|
for (auto&& om : omList_) {
|
||||||
if (omList_[i].orientation == orientation) {
|
if (om.orientation == orientation) {
|
||||||
d = omList_[i].degrees;
|
d = om.degrees;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,8 +137,6 @@ namespace Exiv2 {
|
|||||||
//CrwMapping(0x1818, 0x3002, 0, 0x9204, exifId, decodeBasic, encodeBasic),
|
//CrwMapping(0x1818, 0x3002, 0, 0x9204, exifId, decodeBasic, encodeBasic),
|
||||||
CrwMapping(0x183b, 0x300b, 0, 0x0015, canonId, decodeBasic, encodeBasic),
|
CrwMapping(0x183b, 0x300b, 0, 0x0015, canonId, decodeBasic, encodeBasic),
|
||||||
CrwMapping(0x2008, 0x0000, 0, 0, ifd1Id, decode0x2008, encode0x2008),
|
CrwMapping(0x2008, 0x0000, 0, 0, ifd1Id, decode0x2008, encode0x2008),
|
||||||
// End of list marker
|
|
||||||
CrwMapping(0x0000, 0x0000, 0, 0x0000, ifdIdNotSet, 0, 0)
|
|
||||||
}; // CrwMap::crwMapping_[]
|
}; // CrwMap::crwMapping_[]
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -169,8 +165,6 @@ namespace Exiv2 {
|
|||||||
{ 0x2804, 0x300a },
|
{ 0x2804, 0x300a },
|
||||||
{ 0x300a, 0x0000 },
|
{ 0x300a, 0x0000 },
|
||||||
{ 0x0000, 0xffff },
|
{ 0x0000, 0xffff },
|
||||||
// End of list marker
|
|
||||||
{ 0xffff, 0xffff }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char CiffHeader::signature_[] = "HEAPCCDR";
|
const char CiffHeader::signature_[] = "HEAPCCDR";
|
||||||
@ -188,10 +182,8 @@ namespace Exiv2 {
|
|||||||
|
|
||||||
CiffDirectory::~CiffDirectory()
|
CiffDirectory::~CiffDirectory()
|
||||||
{
|
{
|
||||||
Components::iterator b = components_.begin();
|
for (auto&& component : components_) {
|
||||||
Components::iterator e = components_.end();
|
delete component;
|
||||||
for (Components::iterator i = b; i != e; ++i) {
|
|
||||||
delete *i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,10 +351,8 @@ namespace Exiv2 {
|
|||||||
|
|
||||||
void CiffDirectory::doDecode(Image& image, ByteOrder byteOrder) const
|
void CiffDirectory::doDecode(Image& image, ByteOrder byteOrder) const
|
||||||
{
|
{
|
||||||
Components::const_iterator b = components_.begin();
|
for (auto&& component : components_) {
|
||||||
Components::const_iterator e = components_.end();
|
component->decode(image, byteOrder);
|
||||||
for (Components::const_iterator i = b; i != e; ++i) {
|
|
||||||
(*i)->decode(image, byteOrder);
|
|
||||||
}
|
}
|
||||||
} // CiffDirectory::doDecode
|
} // CiffDirectory::doDecode
|
||||||
|
|
||||||
@ -445,10 +435,8 @@ namespace Exiv2 {
|
|||||||
uint32_t dirOffset = 0;
|
uint32_t dirOffset = 0;
|
||||||
|
|
||||||
// Value data
|
// Value data
|
||||||
const Components::iterator b = components_.begin();
|
for (auto&& component : components_) {
|
||||||
const Components::iterator e = components_.end();
|
dirOffset = component->write(blob, byteOrder, dirOffset);
|
||||||
for (Components::iterator i = b; i != e; ++i) {
|
|
||||||
dirOffset = (*i)->write(blob, byteOrder, dirOffset);
|
|
||||||
}
|
}
|
||||||
const uint32_t dirStart = dirOffset;
|
const uint32_t dirStart = dirOffset;
|
||||||
|
|
||||||
@ -459,8 +447,8 @@ namespace Exiv2 {
|
|||||||
dirOffset += 2;
|
dirOffset += 2;
|
||||||
|
|
||||||
// Directory entries
|
// Directory entries
|
||||||
for (Components::iterator i = b; i != e; ++i) {
|
for (auto&& component : components_) {
|
||||||
(*i)->writeDirEntry(blob, byteOrder);
|
component->writeDirEntry(blob, byteOrder);
|
||||||
dirOffset += 10;
|
dirOffset += 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,10 +553,8 @@ namespace Exiv2 {
|
|||||||
const std::string& prefix) const
|
const std::string& prefix) const
|
||||||
{
|
{
|
||||||
CiffComponent::doPrint(os, byteOrder, prefix);
|
CiffComponent::doPrint(os, byteOrder, prefix);
|
||||||
Components::const_iterator b = components_.begin();
|
for (auto&& component : components_) {
|
||||||
Components::const_iterator e = components_.end();
|
component->print(os, byteOrder, prefix + " ");
|
||||||
for (Components::const_iterator i = b; i != e; ++i) {
|
|
||||||
(*i)->print(os, byteOrder, prefix + " ");
|
|
||||||
}
|
}
|
||||||
} // CiffDirectory::doPrint
|
} // CiffDirectory::doPrint
|
||||||
|
|
||||||
@ -642,11 +628,9 @@ namespace Exiv2 {
|
|||||||
CiffComponent* CiffDirectory::doFindComponent(uint16_t crwTagId,
|
CiffComponent* CiffDirectory::doFindComponent(uint16_t crwTagId,
|
||||||
uint16_t crwDir) const
|
uint16_t crwDir) const
|
||||||
{
|
{
|
||||||
CiffComponent* cc = NULL;
|
CiffComponent* cc;
|
||||||
const Components::const_iterator b = components_.begin();
|
for (auto&& component : components_) {
|
||||||
const Components::const_iterator e = components_.end();
|
cc = component->findComponent(crwTagId, crwDir);
|
||||||
for (Components::const_iterator i = b; i != e; ++i) {
|
|
||||||
cc = (*i)->findComponent(crwTagId, crwDir);
|
|
||||||
if (cc) return cc;
|
if (cc) return cc;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -691,16 +675,13 @@ namespace Exiv2 {
|
|||||||
if not found, create it
|
if not found, create it
|
||||||
set value
|
set value
|
||||||
*/
|
*/
|
||||||
const Components::iterator b = components_.begin();
|
|
||||||
const Components::iterator e = components_.end();
|
|
||||||
|
|
||||||
if (!crwDirs.empty()) {
|
if (!crwDirs.empty()) {
|
||||||
CrwSubDir csd = crwDirs.top();
|
CrwSubDir csd = crwDirs.top();
|
||||||
crwDirs.pop();
|
crwDirs.pop();
|
||||||
// Find the directory
|
// Find the directory
|
||||||
for (Components::iterator i = b; i != e; ++i) {
|
for (auto&& component : components_) {
|
||||||
if ((*i)->tag() == csd.crwDir_) {
|
if (component->tag() == csd.crwDir_) {
|
||||||
cc_ = *i;
|
cc_ = component;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -715,9 +696,9 @@ namespace Exiv2 {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Find the tag
|
// Find the tag
|
||||||
for (Components::iterator i = b; i != e; ++i) {
|
for (auto&& component : components_) {
|
||||||
if ((*i)->tagId() == crwTagId) {
|
if (component->tagId() == crwTagId) {
|
||||||
cc_ = *i;
|
cc_ = component;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -814,10 +795,9 @@ namespace Exiv2 {
|
|||||||
|
|
||||||
const CrwMapping* CrwMap::crwMapping(uint16_t crwDir, uint16_t crwTagId)
|
const CrwMapping* CrwMap::crwMapping(uint16_t crwDir, uint16_t crwTagId)
|
||||||
{
|
{
|
||||||
for (int i = 0; crwMapping_[i].ifdId_ != ifdIdNotSet; ++i) {
|
for (auto&& crw : crwMapping_) {
|
||||||
if ( crwMapping_[i].crwDir_ == crwDir
|
if (crw.crwDir_ == crwDir && crw.crwTagId_ == crwTagId) {
|
||||||
&& crwMapping_[i].crwTagId_ == crwTagId) {
|
return &crw;
|
||||||
return &(crwMapping_[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1010,19 +990,19 @@ namespace Exiv2 {
|
|||||||
|
|
||||||
void CrwMap::loadStack(CrwDirs& crwDirs, uint16_t crwDir)
|
void CrwMap::loadStack(CrwDirs& crwDirs, uint16_t crwDir)
|
||||||
{
|
{
|
||||||
for (int i = 0; crwSubDir_[i].crwDir_ != 0xffff; ++i) {
|
for (auto&& crw : crwSubDir_) {
|
||||||
if (crwSubDir_[i].crwDir_ == crwDir) {
|
if (crw.crwDir_ == crwDir) {
|
||||||
crwDirs.push(crwSubDir_[i]);
|
crwDirs.push(crw);
|
||||||
crwDir = crwSubDir_[i].parent_;
|
crwDir = crw.parent_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // CrwMap::loadStack
|
} // CrwMap::loadStack
|
||||||
|
|
||||||
void CrwMap::encode(CiffHeader* pHead, const Image& image)
|
void CrwMap::encode(CiffHeader* pHead, const Image& image)
|
||||||
{
|
{
|
||||||
for (const CrwMapping* cmi = crwMapping_; cmi->ifdId_ != ifdIdNotSet; ++cmi) {
|
for (auto&& crw : crwMapping_) {
|
||||||
if (cmi->fromExif_ != 0) {
|
if (crw.fromExif_ != 0) {
|
||||||
cmi->fromExif_(image, cmi, pHead);
|
crw.fromExif_(image, &crw, pHead);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // CrwMap::encode
|
} // CrwMap::encode
|
||||||
@ -1237,14 +1217,13 @@ namespace Exiv2 {
|
|||||||
std::memset(buf.pData_, 0x0, buf.size_);
|
std::memset(buf.pData_, 0x0, buf.size_);
|
||||||
|
|
||||||
uint16_t len = 0;
|
uint16_t len = 0;
|
||||||
const auto b = exifData.begin();
|
for (auto&& exif : exifData) {
|
||||||
const auto e = exifData.end();
|
if (exif.ifdId() != ifdId)
|
||||||
for (auto i = b; i != e; ++i) {
|
continue;
|
||||||
if (i->ifdId() != ifdId) continue;
|
const uint16_t s = exif.tag() * 2 + static_cast<uint16_t>(exif.size());
|
||||||
const uint16_t s = i->tag()*2 + static_cast<uint16_t>(i->size());
|
|
||||||
assert(s <= size);
|
assert(s <= size);
|
||||||
if (len < s) len = s;
|
if (len < s) len = s;
|
||||||
i->copy(buf.pData_ + i->tag()*2, byteOrder);
|
exif.copy(buf.pData_ + exif.tag() * 2, byteOrder);
|
||||||
}
|
}
|
||||||
// Round the size to make it even.
|
// Round the size to make it even.
|
||||||
buf.size_ = len + len%2;
|
buf.size_ = len + len%2;
|
||||||
|
|||||||
@ -1373,8 +1373,6 @@ namespace Exiv2 {
|
|||||||
{ { 3, 1, 0 }, "Leica D Vario Elmarit 14-50mm F2.8-3.5 Asph." },
|
{ { 3, 1, 0 }, "Leica D Vario Elmarit 14-50mm F2.8-3.5 Asph." },
|
||||||
{ { 3, 2, 0 }, "Leica D Summilux 25mm F1.4 Asph." },
|
{ { 3, 2, 0 }, "Leica D Summilux 25mm F1.4 Asph." },
|
||||||
{ { 5, 1, 16 }, "Tamron 14-150mm F3.5-5.8 Di III" },
|
{ { 5, 1, 16 }, "Tamron 14-150mm F3.5-5.8 Di III" },
|
||||||
// End of list marker
|
|
||||||
{ { 0xff, 0, 0 }, "" }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (value.count() != 6 || value.typeId() != unsignedByte) {
|
if (value.count() != 6 || value.typeId() != unsignedByte) {
|
||||||
@ -1385,11 +1383,9 @@ namespace Exiv2 {
|
|||||||
byte v2 = (byte)value.toLong(2);
|
byte v2 = (byte)value.toLong(2);
|
||||||
byte v3 = (byte)value.toLong(3);
|
byte v3 = (byte)value.toLong(3);
|
||||||
|
|
||||||
for (int i = 0; lensTypes[i].val[0] != 0xff; i++) {
|
for (auto&& type : lensTypes) {
|
||||||
if (lensTypes[i].val[0] == v0 &&
|
if (type.val[0] == v0 && type.val[1] == v2 && type.val[2] == v3) {
|
||||||
lensTypes[i].val[1] == v2 &&
|
return os << type.label;
|
||||||
lensTypes[i].val[2] == v3) {
|
|
||||||
return os << lensTypes[i].label;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return os << value;
|
return os << value;
|
||||||
@ -1423,8 +1419,6 @@ namespace Exiv2 {
|
|||||||
{ { 0, 4 }, "Olympus Zuiko Digital EC-14 1.4x Teleconverter" },
|
{ { 0, 4 }, "Olympus Zuiko Digital EC-14 1.4x Teleconverter" },
|
||||||
{ { 0, 8 }, "Olympus EX-25 Extension Tube" },
|
{ { 0, 8 }, "Olympus EX-25 Extension Tube" },
|
||||||
{ { 0, 16 },"Olympus Zuiko Digital EC-20 2.0x Teleconverter" },
|
{ { 0, 16 },"Olympus Zuiko Digital EC-20 2.0x Teleconverter" },
|
||||||
// End of list marker
|
|
||||||
{ { 0xff, 0 }, "" }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (value.count() != 6 || value.typeId() != unsignedByte) {
|
if (value.count() != 6 || value.typeId() != unsignedByte) {
|
||||||
@ -1434,10 +1428,9 @@ namespace Exiv2 {
|
|||||||
byte v0 = (byte)value.toLong(0);
|
byte v0 = (byte)value.toLong(0);
|
||||||
byte v2 = (byte)value.toLong(2);
|
byte v2 = (byte)value.toLong(2);
|
||||||
|
|
||||||
for (int i = 0; extenderModels[i].val[0] != 0xff; i++) {
|
for (auto&& model : extenderModels) {
|
||||||
if (extenderModels[i].val[0] == v0 &&
|
if (model.val[0] == v0 && model.val[1] == v2) {
|
||||||
extenderModels[i].val[1] == v2) {
|
return os << model.label;
|
||||||
return os << extenderModels[i].label;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return os << value;
|
return os << value;
|
||||||
@ -1547,8 +1540,6 @@ namespace Exiv2 {
|
|||||||
{ { 39, 1280}, N_("Partial Color") },
|
{ { 39, 1280}, N_("Partial Color") },
|
||||||
{ { 40, 1280}, N_("Partial Color II") },
|
{ { 40, 1280}, N_("Partial Color II") },
|
||||||
{ { 41, 1280}, N_("Partial Color III") },
|
{ { 41, 1280}, N_("Partial Color III") },
|
||||||
// End of list marker
|
|
||||||
{ { 0xffff, 0 }, "" }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (value.count() != 4 || value.typeId() != unsignedShort) {
|
if (value.count() != 4 || value.typeId() != unsignedShort) {
|
||||||
@ -1558,10 +1549,9 @@ namespace Exiv2 {
|
|||||||
uint16_t v0 = (uint16_t)value.toLong(0);
|
uint16_t v0 = (uint16_t)value.toLong(0);
|
||||||
uint16_t v1 = (uint16_t)value.toLong(1);
|
uint16_t v1 = (uint16_t)value.toLong(1);
|
||||||
|
|
||||||
for (int i = 0; artFilters[i].val[0] != 0xffff; i++) {
|
for (auto&& filter : artFilters) {
|
||||||
if (artFilters[i].val[0] == v0 &&
|
if (filter.val[0] == v0 && filter.val[1] == v1) {
|
||||||
artFilters[i].val[1] == v1) {
|
return os << filter.label;
|
||||||
return os << artFilters[i].label;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return os << "";
|
return os << "";
|
||||||
@ -1621,8 +1611,6 @@ value, const ExifData* metadata)
|
|||||||
{ 2, N_("Right") },
|
{ 2, N_("Right") },
|
||||||
{ 3, N_("Center (vertical)") },
|
{ 3, N_("Center (vertical)") },
|
||||||
{ 255, N_("None") },
|
{ 255, N_("None") },
|
||||||
// End of list marker
|
|
||||||
{ 0xffff, "" }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
@ -1652,8 +1640,6 @@ value, const ExifData* metadata)
|
|||||||
{ 0x14, N_("Bottom-left (vertical)") },
|
{ 0x14, N_("Bottom-left (vertical)") },
|
||||||
{ 0x15, N_("Bottom-center (vertical)") },
|
{ 0x15, N_("Bottom-center (vertical)") },
|
||||||
{ 0x16, N_("Bottom-right (vertical)") },
|
{ 0x16, N_("Bottom-right (vertical)") },
|
||||||
// End of list marker
|
|
||||||
{ 0xff, "" }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (value.count() != 1 || value.typeId() != unsignedShort) {
|
if (value.count() != 1 || value.typeId() != unsignedShort) {
|
||||||
@ -1676,17 +1662,17 @@ value, const ExifData* metadata)
|
|||||||
uint16_t v = (uint16_t) value.toLong(0);
|
uint16_t v = (uint16_t) value.toLong(0);
|
||||||
|
|
||||||
if (!E3_E30model) {
|
if (!E3_E30model) {
|
||||||
for (int i = 0; afPoints[i].val != 0xffff; i++) {
|
for (auto&& point : afPoints) {
|
||||||
if (afPoints[i].val == v) {
|
if (point.val == v) {
|
||||||
return os << afPoints[i].label;
|
return os << point.label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// E-3 and E-30
|
// E-3 and E-30
|
||||||
for (int i = 0; afPointsE3[i].val != 0xff; i++) {
|
for (auto&& point : afPointsE3) {
|
||||||
if (afPointsE3[i].val == (v & 0x1f)) {
|
if (point.val == (v & 0x1f)) {
|
||||||
os << afPointsE3[i].label;
|
os << point.label;
|
||||||
os << ", ";
|
os << ", ";
|
||||||
if ((v & 0xe0) == 0) return os << N_("Single Target");
|
if ((v & 0xe0) == 0) return os << N_("Single Target");
|
||||||
if (v & 0x40) return os << N_("All Target");
|
if (v & 0x40) return os << N_("All Target");
|
||||||
|
|||||||
@ -880,9 +880,10 @@ namespace Exiv2 {
|
|||||||
void TiffDirectory::doAccept(TiffVisitor& visitor)
|
void TiffDirectory::doAccept(TiffVisitor& visitor)
|
||||||
{
|
{
|
||||||
visitor.visitDirectory(this);
|
visitor.visitDirectory(this);
|
||||||
for (Components::const_iterator i = components_.begin();
|
for (auto&& component : components_) {
|
||||||
visitor.go(TiffVisitor::geTraverse) && i != components_.end(); ++i) {
|
if (!visitor.go(TiffVisitor::geTraverse))
|
||||||
(*i)->accept(visitor);
|
break;
|
||||||
|
component->accept(visitor);
|
||||||
}
|
}
|
||||||
if (visitor.go(TiffVisitor::geTraverse)) visitor.visitDirectoryNext(this);
|
if (visitor.go(TiffVisitor::geTraverse)) visitor.visitDirectoryNext(this);
|
||||||
if (pNext_) pNext_->accept(visitor);
|
if (pNext_) pNext_->accept(visitor);
|
||||||
@ -892,9 +893,10 @@ namespace Exiv2 {
|
|||||||
void TiffSubIfd::doAccept(TiffVisitor& visitor)
|
void TiffSubIfd::doAccept(TiffVisitor& visitor)
|
||||||
{
|
{
|
||||||
visitor.visitSubIfd(this);
|
visitor.visitSubIfd(this);
|
||||||
for (Ifds::iterator i = ifds_.begin();
|
for (auto&& ifd : ifds_) {
|
||||||
visitor.go(TiffVisitor::geTraverse) && i != ifds_.end(); ++i) {
|
if (!visitor.go(TiffVisitor::geTraverse))
|
||||||
(*i)->accept(visitor);
|
break;
|
||||||
|
ifd->accept(visitor);
|
||||||
}
|
}
|
||||||
} // TiffSubIfd::doAccept
|
} // TiffSubIfd::doAccept
|
||||||
|
|
||||||
@ -920,9 +922,10 @@ namespace Exiv2 {
|
|||||||
void TiffBinaryArray::doAccept(TiffVisitor& visitor)
|
void TiffBinaryArray::doAccept(TiffVisitor& visitor)
|
||||||
{
|
{
|
||||||
visitor.visitBinaryArray(this);
|
visitor.visitBinaryArray(this);
|
||||||
for (Components::const_iterator i = elements_.begin();
|
for (auto&& element : elements_) {
|
||||||
visitor.go(TiffVisitor::geTraverse) && i != elements_.end(); ++i) {
|
if (!visitor.go(TiffVisitor::geTraverse))
|
||||||
(*i)->accept(visitor);
|
break;
|
||||||
|
element->accept(visitor);
|
||||||
}
|
}
|
||||||
if (visitor.go(TiffVisitor::geTraverse)) visitor.visitBinaryArrayEnd(this);
|
if (visitor.go(TiffVisitor::geTraverse)) visitor.visitBinaryArrayEnd(this);
|
||||||
} // TiffBinaryArray::doAccept
|
} // TiffBinaryArray::doAccept
|
||||||
|
|||||||
@ -489,23 +489,27 @@ namespace Exiv2 {
|
|||||||
{ 0x260c , nMasks , false }, // AFPointsInFocus
|
{ 0x260c , nMasks , false }, // AFPointsInFocus
|
||||||
{ 0x260d , nMasks , false }, // AFPointsSelected
|
{ 0x260d , nMasks , false }, // AFPointsSelected
|
||||||
{ 0x260e , nMasks , false }, // AFPointsUnusable
|
{ 0x260e , nMasks , false }, // AFPointsUnusable
|
||||||
{ 0xffff , 0 , true } // end marker
|
|
||||||
};
|
};
|
||||||
// check we have enough data!
|
// check we have enough data!
|
||||||
uint16_t count = 0;
|
uint16_t count = 0;
|
||||||
for ( uint16_t i = 0; records[i].tag != 0xffff ; i++) count += records[i].size ;
|
for (auto&& record : records) {
|
||||||
if ( count > ints.size() ) return ;
|
count += record.size;
|
||||||
|
if (count > ints.size())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for ( uint16_t i = 0; records[i].tag != 0xffff ; i++) {
|
for (auto&& record : records) {
|
||||||
const TagInfo* pTags = ExifTags::tagList("Canon") ;
|
const TagInfo* pTags = ExifTags::tagList("Canon") ;
|
||||||
const TagInfo* pTag = findTag(pTags,records[i].tag);
|
const TagInfo* pTag = findTag(pTags, record.tag);
|
||||||
if ( pTag ) {
|
if ( pTag ) {
|
||||||
Exiv2::Value::UniquePtr v = Exiv2::Value::create(records[i].bSigned?Exiv2::signedShort:Exiv2::unsignedShort);
|
auto v = Exiv2::Value::create(record.bSigned ? Exiv2::signedShort : Exiv2::unsignedShort);
|
||||||
std::ostringstream s;
|
std::ostringstream s;
|
||||||
if ( records[i].bSigned ) {
|
if (record.bSigned) {
|
||||||
for ( int16_t k = 0 ; k < records[i].size ; k++ ) s << " " << ints.at(nStart++);
|
for (int16_t k = 0; k < record.size; k++)
|
||||||
|
s << " " << ints.at(nStart++);
|
||||||
} else {
|
} else {
|
||||||
for ( int16_t k = 0 ; k < records[i].size ; k++ ) s << " " << uint.at(nStart++);
|
for (int16_t k = 0; k < record.size; k++)
|
||||||
|
s << " " << uint.at(nStart++);
|
||||||
}
|
}
|
||||||
|
|
||||||
v->read(s.str());
|
v->read(s.str());
|
||||||
|
|||||||
@ -868,10 +868,10 @@ namespace Exiv2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write the others
|
// Write the others
|
||||||
for (i = value_.begin(); i != value_.end(); ++i) {
|
for (auto&& v : value_) {
|
||||||
if (i->first != x_default ) {
|
if (v.first != x_default) {
|
||||||
if (!first) os << ", ";
|
if (!first) os << ", ";
|
||||||
os << "lang=\"" << i->first << "\" " << i->second;
|
os << "lang=\"" << v.first << "\" " << v.second;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user