commit
97e58a4573
@ -742,16 +742,15 @@ int Params::evalDelete(const std::string& optArg) {
|
|||||||
switch (action_) {
|
switch (action_) {
|
||||||
case Action::none:
|
case Action::none:
|
||||||
action_ = Action::erase;
|
action_ = Action::erase;
|
||||||
target_ = CommonTarget(0);
|
target_ = static_cast<CommonTarget>(0);
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case Action::erase: {
|
case Action::erase: {
|
||||||
const auto rc = parseCommonTargets(optArg, "erase");
|
const auto rc = parseCommonTargets(optArg, "erase");
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
target_ |= CommonTarget(rc);
|
target_ |= static_cast<CommonTarget>(rc);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
std::cerr << progname() << ": " << _("Option -d is not compatible with a previous option\n");
|
std::cerr << progname() << ": " << _("Option -d is not compatible with a previous option\n");
|
||||||
@ -764,16 +763,15 @@ int Params::evalExtract(const std::string& optArg) {
|
|||||||
case Action::none:
|
case Action::none:
|
||||||
case Action::modify:
|
case Action::modify:
|
||||||
action_ = Action::extract;
|
action_ = Action::extract;
|
||||||
target_ = CommonTarget(0);
|
target_ = static_cast<CommonTarget>(0);
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case Action::extract: {
|
case Action::extract: {
|
||||||
const auto rc = parseCommonTargets(optArg, "extract");
|
const auto rc = parseCommonTargets(optArg, "extract");
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
target_ |= CommonTarget(rc);
|
target_ |= static_cast<CommonTarget>(rc);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
std::cerr << progname() << ": " << _("Option -e is not compatible with a previous option\n");
|
std::cerr << progname() << ": " << _("Option -e is not compatible with a previous option\n");
|
||||||
@ -786,16 +784,15 @@ int Params::evalInsert(const std::string& optArg) {
|
|||||||
case Action::none:
|
case Action::none:
|
||||||
case Action::modify:
|
case Action::modify:
|
||||||
action_ = Action::insert;
|
action_ = Action::insert;
|
||||||
target_ = CommonTarget(0);
|
target_ = static_cast<CommonTarget>(0);
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case Action::insert: {
|
case Action::insert: {
|
||||||
const auto rc = parseCommonTargets(optArg, "insert");
|
const auto rc = parseCommonTargets(optArg, "insert");
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
target_ |= CommonTarget(rc);
|
target_ |= static_cast<CommonTarget>(rc);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
std::cerr << progname() << ": " << _("Option -i is not compatible with a previous option\n");
|
std::cerr << progname() << ": " << _("Option -i is not compatible with a previous option\n");
|
||||||
@ -1139,7 +1136,7 @@ void printUnrecognizedArgument(const char argc, const std::string& action) {
|
|||||||
|
|
||||||
int64_t parseCommonTargets(const std::string& optArg, const std::string& action) {
|
int64_t parseCommonTargets(const std::string& optArg, const std::string& action) {
|
||||||
int64_t rc = 0;
|
int64_t rc = 0;
|
||||||
Params::CommonTarget target = Params::CommonTarget(0);
|
auto target = static_cast<Params::CommonTarget>(0);
|
||||||
Params::CommonTarget all = Params::ctExif | Params::ctIptc | Params::ctComment | Params::ctXmp;
|
Params::CommonTarget all = Params::ctExif | Params::ctIptc | Params::ctComment | Params::ctXmp;
|
||||||
Params::CommonTarget extra = Params::ctXmpSidecar | Params::ctExif | Params::ctIptc | Params::ctXmp;
|
Params::CommonTarget extra = Params::ctXmpSidecar | Params::ctExif | Params::ctIptc | Params::ctXmp;
|
||||||
for (size_t i = 0; rc == 0 && i < optArg.size(); ++i) {
|
for (size_t i = 0; rc == 0 && i < optArg.size(); ++i) {
|
||||||
@ -1175,7 +1172,7 @@ int64_t parseCommonTargets(const std::string& optArg, const std::string& action)
|
|||||||
target |= extra; // -eX
|
target |= extra; // -eX
|
||||||
if (i > 0) { // -eXX or -iXX
|
if (i > 0) { // -eXX or -iXX
|
||||||
target |= Params::ctXmpRaw;
|
target |= Params::ctXmpRaw;
|
||||||
target = Params::CommonTarget(target & ~extra); // turn off those bits
|
target = static_cast<Params::CommonTarget>(target & ~extra); // turn off those bits
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1196,7 +1193,7 @@ int64_t parseCommonTargets(const std::string& optArg, const std::string& action)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc ? rc : int64_t(target);
|
return rc ? rc : static_cast<int64_t>(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
int parsePreviewNumbers(Params::PreviewNumbers& previewNumbers, const std::string& optArg, int j) {
|
int parsePreviewNumbers(Params::PreviewNumbers& previewNumbers, const std::string& optArg, int j) {
|
||||||
|
|||||||
@ -122,7 +122,7 @@ class Params : public Util::Getopt {
|
|||||||
static Params& instance();
|
static Params& instance();
|
||||||
|
|
||||||
//! Prevent copy-construction: not implemented.
|
//! Prevent copy-construction: not implemented.
|
||||||
~Params() = default;
|
~Params() override = default;
|
||||||
Params(const Params&) = delete;
|
Params(const Params&) = delete;
|
||||||
Params& operator=(const Params&) = delete;
|
Params& operator=(const Params&) = delete;
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
// namespace extensions
|
// namespace extensions
|
||||||
namespace Exiv2 {
|
namespace Exiv2 {
|
||||||
EXIV2API bool enableBMFF(bool enable = true);
|
EXIV2API bool enableBMFF(bool enable = true);
|
||||||
}
|
} // namespace Exiv2
|
||||||
|
|
||||||
#ifdef EXV_ENABLE_BMFF
|
#ifdef EXV_ENABLE_BMFF
|
||||||
namespace Exiv2 {
|
namespace Exiv2 {
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
// included header files
|
// included header files
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "datasets.hpp"
|
#include "datasets.hpp"
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class EXIV2API WebPImage : public Image {
|
|||||||
[[nodiscard]] std::string mimeType() const override;
|
[[nodiscard]] std::string mimeType() const override;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
~WebPImage() = default;
|
~WebPImage() override = default;
|
||||||
//! Copy constructor
|
//! Copy constructor
|
||||||
WebPImage(const WebPImage&) = delete;
|
WebPImage(const WebPImage&) = delete;
|
||||||
//! Assignment operator
|
//! Assignment operator
|
||||||
|
|||||||
@ -58,16 +58,11 @@ class EXIV2API Xmpdatum : public Metadatum {
|
|||||||
Calls setValue(const std::string&).
|
Calls setValue(const std::string&).
|
||||||
*/
|
*/
|
||||||
Xmpdatum& operator=(const std::string& value);
|
Xmpdatum& operator=(const std::string& value);
|
||||||
/*!
|
|
||||||
@brief Assign const char* \em value to the %Xmpdatum.
|
|
||||||
Calls operator=(const std::string&).
|
|
||||||
*/
|
|
||||||
Xmpdatum& operator=(const char* value);
|
|
||||||
/*!
|
/*!
|
||||||
@brief Assign a boolean \em value to the %Xmpdatum.
|
@brief Assign a boolean \em value to the %Xmpdatum.
|
||||||
Translates the value to a string "true" or "false".
|
Translates the value to a string "true" or "false".
|
||||||
*/
|
*/
|
||||||
Xmpdatum& operator=(const bool& value);
|
Xmpdatum& operator=(bool value);
|
||||||
/*!
|
/*!
|
||||||
@brief Assign a \em value of any type with an output operator
|
@brief Assign a \em value of any type with an output operator
|
||||||
to the %Xmpdatum. Calls operator=(const std::string&).
|
to the %Xmpdatum. Calls operator=(const std::string&).
|
||||||
@ -227,23 +222,23 @@ class EXIV2API XmpData {
|
|||||||
//! are we to use the packet?
|
//! are we to use the packet?
|
||||||
[[nodiscard]] bool usePacket() const {
|
[[nodiscard]] bool usePacket() const {
|
||||||
return usePacket_;
|
return usePacket_;
|
||||||
};
|
}
|
||||||
|
|
||||||
//! set usePacket_
|
//! set usePacket_
|
||||||
bool usePacket(bool b) {
|
bool usePacket(bool b) {
|
||||||
bool r = usePacket_;
|
bool r = usePacket_;
|
||||||
usePacket_ = b;
|
usePacket_ = b;
|
||||||
return r;
|
return r;
|
||||||
};
|
}
|
||||||
//! setPacket
|
//! setPacket
|
||||||
void setPacket(std::string xmpPacket) {
|
void setPacket(std::string xmpPacket) {
|
||||||
xmpPacket_ = std::move(xmpPacket);
|
xmpPacket_ = std::move(xmpPacket);
|
||||||
usePacket(false);
|
usePacket(false);
|
||||||
};
|
}
|
||||||
// ! getPacket
|
// ! getPacket
|
||||||
[[nodiscard]] const std::string& xmpPacket() const {
|
[[nodiscard]] const std::string& xmpPacket() const {
|
||||||
return xmpPacket_;
|
return xmpPacket_;
|
||||||
};
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
@ -404,11 +399,7 @@ class EXIV2API XmpParser {
|
|||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
// free functions, template and inline definitions
|
// free functions, template and inline definitions
|
||||||
|
|
||||||
inline Xmpdatum& Xmpdatum::operator=(const char* value) {
|
inline Xmpdatum& Xmpdatum::operator=(bool value) {
|
||||||
return Xmpdatum::operator=(std::string(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Xmpdatum& Xmpdatum::operator=(const bool& value) {
|
|
||||||
return operator=(value ? "True" : "False");
|
return operator=(value ? "True" : "False");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1284,7 +1284,7 @@ std::string Converter::computeExifDigest(bool tiff) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::string Converter::computeExifDigest(bool) {
|
std::string Converter::computeExifDigest(bool) {
|
||||||
return std::string("");
|
return {};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -3226,9 +3226,9 @@ std::ostream& Nikon3MakerNote::print0x009e(std::ostream& os, const Value& value,
|
|||||||
std::string d = s.empty() ? "" : "; ";
|
std::string d = s.empty() ? "" : "; ";
|
||||||
const TagDetails* td = find(nikonRetouchHistory, l);
|
const TagDetails* td = find(nikonRetouchHistory, l);
|
||||||
if (td) {
|
if (td) {
|
||||||
s = std::string(exvGettext(td->label_)) + d + s;
|
s = std::string(exvGettext(td->label_)).append(d).append(s);
|
||||||
} else {
|
} else {
|
||||||
s = std::string(_("Unknown")) + std::string(" (") + toString(l) + std::string(")") + d + s;
|
s = std::string(_("Unknown")).append(" (").append(toString(l)).append(")").append(d).append(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return os << s;
|
return os << s;
|
||||||
|
|||||||
@ -318,31 +318,25 @@ void PngChunk::parseChunkContent(Image* pImage, const byte* key, size_t keySize,
|
|||||||
} // PngChunk::parseChunkContent
|
} // PngChunk::parseChunkContent
|
||||||
|
|
||||||
std::string PngChunk::makeMetadataChunk(const std::string& metadata, MetadataId type) {
|
std::string PngChunk::makeMetadataChunk(const std::string& metadata, MetadataId type) {
|
||||||
std::string chunk;
|
|
||||||
std::string rawProfile;
|
std::string rawProfile;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case mdComment:
|
case mdComment:
|
||||||
chunk = makeUtf8TxtChunk("Description", metadata, true);
|
return makeUtf8TxtChunk("Description", metadata, true);
|
||||||
break;
|
|
||||||
case mdExif:
|
case mdExif:
|
||||||
rawProfile = writeRawProfile(metadata, "exif");
|
rawProfile = writeRawProfile(metadata, "exif");
|
||||||
chunk = makeAsciiTxtChunk("Raw profile type exif", rawProfile, true);
|
return makeAsciiTxtChunk("Raw profile type exif", rawProfile, true);
|
||||||
break;
|
|
||||||
case mdIptc:
|
case mdIptc:
|
||||||
rawProfile = writeRawProfile(metadata, "iptc");
|
rawProfile = writeRawProfile(metadata, "iptc");
|
||||||
chunk = makeAsciiTxtChunk("Raw profile type iptc", rawProfile, true);
|
return makeAsciiTxtChunk("Raw profile type iptc", rawProfile, true);
|
||||||
break;
|
|
||||||
case mdXmp:
|
case mdXmp:
|
||||||
chunk = makeUtf8TxtChunk("XML:com.adobe.xmp", metadata, false);
|
return makeUtf8TxtChunk("XML:com.adobe.xmp", metadata, false);
|
||||||
break;
|
|
||||||
case mdIccProfile:
|
case mdIccProfile:
|
||||||
break;
|
|
||||||
case mdNone:
|
case mdNone:
|
||||||
break;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return chunk;
|
return {};
|
||||||
|
|
||||||
} // PngChunk::makeMetadataChunk
|
} // PngChunk::makeMetadataChunk
|
||||||
|
|
||||||
|
|||||||
@ -302,7 +302,7 @@ std::string ExifKey::tagLabel() const {
|
|||||||
|
|
||||||
std::string ExifKey::tagDesc() const {
|
std::string ExifKey::tagDesc() const {
|
||||||
if (!p_->tagInfo_ || p_->tagInfo_->tag_ == 0xffff)
|
if (!p_->tagInfo_ || p_->tagInfo_->tag_ == 0xffff)
|
||||||
return "";
|
return {};
|
||||||
return _(p_->tagInfo_->desc_);
|
return _(p_->tagInfo_->desc_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -178,7 +178,8 @@ byte* Exiv2::DataBuf::data(size_t offset) {
|
|||||||
const byte* Exiv2::DataBuf::c_data(size_t offset) const {
|
const byte* Exiv2::DataBuf::c_data(size_t offset) const {
|
||||||
if (pData_.empty()) {
|
if (pData_.empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else if (offset >= pData_.size()) {
|
}
|
||||||
|
if (offset >= pData_.size()) {
|
||||||
throw std::out_of_range("Overflow in Exiv2::DataBuf::c_data");
|
throw std::out_of_range("Overflow in Exiv2::DataBuf::c_data");
|
||||||
}
|
}
|
||||||
return &pData_[offset];
|
return &pData_[offset];
|
||||||
|
|||||||
@ -14,7 +14,7 @@ constexpr bool startsWith(std::string_view s, std::string_view start) {
|
|||||||
std::string upper(const std::string& str);
|
std::string upper(const std::string& str);
|
||||||
|
|
||||||
/// @brief Returns the lowercase version of \b str
|
/// @brief Returns the lowercase version of \b str
|
||||||
std::string lower(const std::string& str);
|
std::string lower(const std::string& a);
|
||||||
|
|
||||||
} // namespace Exiv2::Internal
|
} // namespace Exiv2::Internal
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class XMLValidator {
|
|||||||
// error out if the depth exceeds this limit.
|
// error out if the depth exceeds this limit.
|
||||||
static const size_t max_recursion_limit_ = 1000;
|
static const size_t max_recursion_limit_ = 1000;
|
||||||
|
|
||||||
const XML_Parser parser_;
|
XML_Parser parser_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Runs an XML parser on `buf`. Throws an exception if the XML is invalid.
|
// Runs an XML parser on `buf`. Throws an exception if the XML is invalid.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user