Merge pull request #2132 from neheb/2

misc cleanups
main
Luis Díaz Más 3 years ago committed by GitHub
commit 89e66ffd37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -461,12 +461,6 @@ namespace Exiv2 {
return rc == src + N ? nullptr : rc;
}
//! Template used in the COUNTOF macro to determine the size of an array
template <typename T, int N>
char (&sizer(T (&)[N]))[N];
//! Macro to determine the size of an array
#define EXV_COUNTOF(a) (sizeof(Exiv2::sizer(a)))
//! Utility function to convert the argument of any type to a string
template <typename T>
std::string toString(const T& arg) {

@ -58,7 +58,8 @@ try {
std::vector<std::regex> keys;
Exiv2::dumpLibraryInfo(std::cout,keys);
return rc;
} else if ( strcmp(file,"--version-test") == 0 ) {
}
if (strcmp(file, "--version-test") == 0) {
// verifies/test macro EXIV2_TEST_VERSION
// described in include/exiv2/version.hpp
std::cout << "EXV_PACKAGE_VERSION " << EXV_PACKAGE_VERSION << std::endl

@ -61,7 +61,7 @@ namespace {
pos += subject.find(search, pos + replace.length());
}
}
}
} // namespace
namespace Exiv2 {
void BasicIo::readOrThrow(byte* buf, size_t rcount, ErrorCode err) {

@ -16,11 +16,9 @@ namespace {
@param keys Array of keys to look for
@param count Number of elements in the array
*/
ExifData::const_iterator findMetadatum(const ExifData& ed,
const char* keys[],
int count)
ExifData::const_iterator findMetadatum(const ExifData& ed, const char* keys[], size_t count)
{
for (int i = 0; i < count; ++i) {
for (size_t i = 0; i < count; ++i) {
auto pos = ed.findKey(ExifKey(keys[i]));
if (pos != ed.end()) return pos;
}
@ -48,7 +46,7 @@ namespace Exiv2 {
"Exif.Sony2Cs2.Rotation",
"Exif.Sony1MltCsA100.Rotation"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator isoSpeed(const ExifData& ed)
@ -104,10 +102,10 @@ namespace Exiv2 {
};
// Find the first ISO value which is not "0"
const int cnt = EXV_COUNTOF(keys);
const size_t cnt = std::size(keys);
auto md = ed.end();
int64_t iso_val = -1;
for (int idx = 0; idx < cnt; ) {
for (size_t idx = 0; idx < cnt;) {
md = findMetadatum(ed, keys + idx, cnt - idx);
if (md == ed.end()) break;
std::ostringstream os;
@ -168,7 +166,7 @@ namespace Exiv2 {
"Exif.Photo.DateTimeOriginal",
"Exif.Image.DateTimeOriginal"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator flashBias(const ExifData& ed)
@ -183,7 +181,7 @@ namespace Exiv2 {
"Exif.Sony1.FlashExposureComp",
"Exif.Sony2.FlashExposureComp"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator exposureMode(const ExifData& ed)
@ -201,7 +199,7 @@ namespace Exiv2 {
"Exif.Sony2Cs.ExposureProgram",
"Exif.Sigma.ExposureMode"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator sceneMode(const ExifData& ed)
@ -222,7 +220,7 @@ namespace Exiv2 {
"Exif.PentaxDng.PictureMode",
"Exif.Photo.SceneCaptureType"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator macroMode(const ExifData& ed)
@ -238,7 +236,7 @@ namespace Exiv2 {
"Exif.Sony1.Macro",
"Exif.Sony2.Macro"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator imageQuality(const ExifData& ed)
@ -269,7 +267,7 @@ namespace Exiv2 {
"Exif.Casio2.QualityMode",
"Exif.Casio2.Quality"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator whiteBalance(const ExifData& ed)
@ -300,7 +298,7 @@ namespace Exiv2 {
"Exif.Casio2.WhiteBalance2",
"Exif.Photo.WhiteBalance"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator lensName(const ExifData& ed)
@ -323,7 +321,7 @@ namespace Exiv2 {
"Exif.Panasonic.LensType",
"Exif.Samsung2.LensType"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator saturation(const ExifData& ed)
@ -345,7 +343,7 @@ namespace Exiv2 {
"Exif.Casio2.Saturation",
"Exif.Casio2.Saturation2"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator sharpness(const ExifData& ed)
@ -367,7 +365,7 @@ namespace Exiv2 {
"Exif.Casio2.Sharpness",
"Exif.Casio2.Sharpness2"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator contrast(const ExifData& ed)
@ -390,7 +388,7 @@ namespace Exiv2 {
"Exif.Casio2.Contrast2"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator sceneCaptureType(const ExifData& ed)
@ -399,7 +397,7 @@ namespace Exiv2 {
"Exif.Photo.SceneCaptureType",
"Exif.Olympus.SpecialMode"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator meteringMode(const ExifData& ed)
@ -410,7 +408,7 @@ namespace Exiv2 {
"Exif.CanonCs.MeteringMode",
"Exif.Sony1MltCsA100.MeteringMode"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator make(const ExifData& ed)
@ -418,7 +416,7 @@ namespace Exiv2 {
static const char* keys[] = {
"Exif.Image.Make"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator model(const ExifData& ed)
@ -426,7 +424,7 @@ namespace Exiv2 {
static const char* keys[] = {
"Exif.Image.Model"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator exposureTime(const ExifData& ed)
@ -436,7 +434,7 @@ namespace Exiv2 {
"Exif.Image.ExposureTime",
"Exif.Samsung2.ExposureTime"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator fNumber(const ExifData& ed)
@ -446,7 +444,7 @@ namespace Exiv2 {
"Exif.Image.FNumber",
"Exif.Samsung2.FNumber"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator shutterSpeedValue(const ExifData& ed)
@ -455,7 +453,7 @@ namespace Exiv2 {
"Exif.Photo.ShutterSpeedValue",
"Exif.Image.ShutterSpeedValue"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator apertureValue(const ExifData& ed)
@ -464,7 +462,7 @@ namespace Exiv2 {
"Exif.Photo.ApertureValue",
"Exif.Image.ApertureValue"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator brightnessValue(const ExifData& ed)
@ -473,7 +471,7 @@ namespace Exiv2 {
"Exif.Photo.BrightnessValue",
"Exif.Image.BrightnessValue"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator exposureBiasValue(const ExifData& ed)
@ -482,7 +480,7 @@ namespace Exiv2 {
"Exif.Photo.ExposureBiasValue",
"Exif.Image.ExposureBiasValue"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator maxApertureValue(const ExifData& ed)
@ -491,7 +489,7 @@ namespace Exiv2 {
"Exif.Photo.MaxApertureValue",
"Exif.Image.MaxApertureValue"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator subjectDistance(const ExifData& ed)
@ -512,7 +510,7 @@ namespace Exiv2 {
"Exif.Casio.ObjectDistance",
"Exif.Casio2.ObjectDistance"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator lightSource(const ExifData& ed)
@ -521,7 +519,7 @@ namespace Exiv2 {
"Exif.Photo.LightSource",
"Exif.Image.LightSource"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator flash(const ExifData& ed)
@ -530,7 +528,7 @@ namespace Exiv2 {
"Exif.Photo.Flash",
"Exif.Image.Flash"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator serialNumber(const ExifData& ed)
@ -544,7 +542,7 @@ namespace Exiv2 {
"Exif.Olympus.SerialNumber2",
"Exif.Sigma.SerialNumber"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator focalLength(const ExifData& ed)
@ -560,7 +558,7 @@ namespace Exiv2 {
"Exif.PentaxDng.FocalLength",
"Exif.Casio2.FocalLength"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator subjectArea(const ExifData& ed)
@ -569,7 +567,7 @@ namespace Exiv2 {
"Exif.Photo.SubjectArea",
"Exif.Image.SubjectLocation"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator flashEnergy(const ExifData& ed)
@ -578,7 +576,7 @@ namespace Exiv2 {
"Exif.Photo.FlashEnergy",
"Exif.Image.FlashEnergy"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator exposureIndex(const ExifData& ed)
@ -587,7 +585,7 @@ namespace Exiv2 {
"Exif.Photo.ExposureIndex",
"Exif.Image.ExposureIndex"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator sensingMethod(const ExifData& ed)
@ -596,7 +594,7 @@ namespace Exiv2 {
"Exif.Photo.SensingMethod",
"Exif.Image.SensingMethod"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
ExifData::const_iterator afPoint(const ExifData& ed)
@ -625,7 +623,7 @@ namespace Exiv2 {
"Exif.Casio.AFPoint",
"Exif.Casio2.AFPointPosition"
};
return findMetadatum(ed, keys, EXV_COUNTOF(keys));
return findMetadatum(ed, keys, std::size(keys));
}
} // namespace Exiv2

@ -350,7 +350,7 @@ namespace Exiv2::Internal {
{
if (value.count() >= 1) {
const uint32_t focusArea = value.toUint32(0);
if (focusArea >= EXV_COUNTOF(nikonFocusarea)) {
if (focusArea >= std::size(nikonFocusarea)) {
os << "Invalid value";
} else {
os << nikonFocusarea[focusArea];
@ -2963,9 +2963,9 @@ fmountlens[] = {
oss.copyfmt(os);
const auto temp = value.toInt64();
printTag<EXV_COUNTOF(nikonFlashControlMode), nikonFlashControlMode>(os, (temp >> 4), data);
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (temp >> 4), data);
os << ", ";
printTag<EXV_COUNTOF(nikonFlashControlMode), nikonFlashControlMode>(os, (temp & 0x0f), data);
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (temp & 0x0f), data);
os.copyfmt(oss);
os.flags(f);

@ -85,9 +85,11 @@ namespace Exiv2::Internal {
}
//! Shortcut for the printCombiTag template which requires typing the array name only once.
#define EXV_PRINT_COMBITAG(array, count, ignoredcount) printCombiTag<EXV_COUNTOF(array), array, count, ignoredcount, ignoredcount>
#define EXV_PRINT_COMBITAG(array, count, ignoredcount) \
printCombiTag<std::size(array), array, count, ignoredcount, ignoredcount>
//! Shortcut for the printCombiTag template which requires typing the array name only once.
#define EXV_PRINT_COMBITAG_MULTI(array, count, ignoredcount, ignoredcountmax) printCombiTag<EXV_COUNTOF(array), array, count, ignoredcount, ignoredcountmax>
#define EXV_PRINT_COMBITAG_MULTI(array, count, ignoredcount, ignoredcountmax) \
printCombiTag<std::size(array), array, count, ignoredcount, ignoredcountmax>
} // namespace Exiv2::Internal

@ -390,10 +390,7 @@ namespace {
return prop;
}
PreviewId Loader::getNumLoaders()
{
return static_cast<PreviewId> EXV_COUNTOF(loaderList_);
}
PreviewId Loader::getNumLoaders() { return PreviewId(std::size(loaderList_)); }
LoaderNative::LoaderNative(PreviewId id, const Image &image, int parIdx)
: Loader(id, image)

@ -10,13 +10,9 @@
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
class ExifData;
namespace Internal {
// *****************************************************************************
// class definitions
namespace Exiv2::Internal {
// *****************************************************************************
// class definitions
//! Type to specify the IFD to which a metadata belongs
enum IfdId {
@ -264,7 +260,7 @@ namespace Exiv2 {
}
//! Shortcut for the printTag template which requires typing the array name only once.
#define EXV_PRINT_TAG(array) printTag<EXV_COUNTOF(array), array>
#define EXV_PRINT_TAG(array) printTag<std::size(array), array>
/*!
@brief Generic print function to translate a long value to a description
@ -297,7 +293,7 @@ namespace Exiv2 {
}
//! Shortcut for the printTagBitmask template which requires typing the array name only once.
#define EXV_PRINT_TAG_BITMASK(array) printTagBitmask<EXV_COUNTOF(array), array>
#define EXV_PRINT_TAG_BITMASK(array) printTagBitmask<std::size(array), array>
/*!
@brief Generic pretty-print function to translate a controlled vocabulary value (string)
@ -317,7 +313,7 @@ namespace Exiv2 {
}
//! Shortcut for the printTagVocabulary template which requires typing the array name only once.
#define EXV_PRINT_VOCABULARY(array) printTagVocabulary<EXV_COUNTOF(array), array>
#define EXV_PRINT_VOCABULARY(array) printTagVocabulary<std::size(array), array>
template <int N, const TagVocabulary (&array)[N]>
std::ostream& printTagVocabularyMulti(std::ostream& os, const Value& value, const ExifData*)
@ -343,10 +339,10 @@ namespace Exiv2 {
}
//! Shortcut for the printTagVocabularyMulti template which requires typing the array name only once.
#define EXV_PRINT_VOCABULARY_MULTI(array) printTagVocabularyMulti<EXV_COUNTOF(array), array>
#define EXV_PRINT_VOCABULARY_MULTI(array) printTagVocabularyMulti<std::size(array), array>
// *****************************************************************************
// free functions
// *****************************************************************************
// free functions
//! Return read-only list of built-in IFD0/1 tags
const TagInfo* ifdTagList();
@ -501,6 +497,6 @@ namespace Exiv2 {
//! Calculate the exposure time from an APEX shutter speed value
URational exposureTime(float shutterSpeedValue);
}} // namespace Internal, Exiv2
} // namespace Exiv2::Internal
#endif // #ifndef TAGS_INT_HPP_

@ -482,7 +482,7 @@ namespace Exiv2::Internal {
if (arraySet_[idx].cfg_.group_ == group) {
arrayCfg_ = &arraySet_[idx].cfg_;
arrayDef_ = arraySet_[idx].def_;
defSize_ = arraySet_[idx].defSize_;
defSize_ = int(arraySet_[idx].defSize_);
return true;
}
}
@ -498,7 +498,7 @@ namespace Exiv2::Internal {
if (idx > -1) {
arrayCfg_ = &arraySet_[idx].cfg_;
arrayDef_ = arraySet_[idx].def_;
defSize_ = arraySet_[idx].defSize_;
defSize_ = int(arraySet_[idx].defSize_);
}
return idx > -1;
}

@ -526,13 +526,13 @@ namespace Exiv2 {
//! Used (internally) to create another reference to the DataBuf reference by storage_.
const std::shared_ptr<DataBuf>& storage() { return storage_; }
private:
//! @name NOT implemented
//@{
//! Assignment operator.
TiffEntryBase& operator=(const TiffEntryBase& rhs);
TiffEntryBase& operator=(const TiffEntryBase& rhs) = delete;
//@}
private:
// DATA
TiffType tiffType_; //!< Field TIFF type
size_t count_{}; //!< The number of values of the indicated type
@ -901,13 +901,13 @@ namespace Exiv2 {
size_t doSizeImage() const override;
//@}
private:
//! @name NOT implemented
//@{
//! Assignment operator.
TiffDirectory& operator=(const TiffDirectory& rhs);
TiffDirectory& operator=(const TiffDirectory&) = delete;
//@}
private:
//! @name Private Accessors
//@{
//! Write a binary directory entry for a TIFF component.
@ -986,13 +986,13 @@ namespace Exiv2 {
size_t doSizeImage() const override;
//@}
private:
//! @name NOT implemented
//@{
//! Assignment operator.
TiffSubIfd& operator=(const TiffSubIfd& rhs);
TiffSubIfd& operator=(const TiffSubIfd&) = delete;
//@}
private:
//! A collection of TIFF directories (IFDs)
using Ifds = std::vector<TiffDirectory*>;
@ -1055,15 +1055,15 @@ namespace Exiv2 {
// Using doSizeImage from base class
//@}
private:
//! @name NOT implemented
//@{
//! Copy constructor.
TiffMnEntry(const TiffMnEntry& rhs);
TiffMnEntry(const TiffMnEntry&) = delete;
//! Assignment operator.
TiffMnEntry& operator=(const TiffMnEntry& rhs);
TiffMnEntry& operator=(const TiffMnEntry&) = delete;
//@}
private:
// DATA
IfdId mnGroup_; //!< New group for concrete mn
TiffComponent* mn_{}; //!< The Makernote
@ -1268,7 +1268,7 @@ namespace Exiv2 {
struct ArraySet {
const ArrayCfg cfg_; //!< Binary array configuration
const ArrayDef* def_; //!< Binary array definition array
const int defSize_; //!< Size of the array definition array
const size_t defSize_; //!< Size of the array definition array
};
/*!
@ -1350,6 +1350,8 @@ namespace Exiv2 {
TiffBinaryArray(const TiffBinaryArray& rhs);
//@}
TiffBinaryArray& operator=(const TiffBinaryArray&) = delete;
//! @name Protected Manipulators
//@{
/*!
@ -1386,12 +1388,6 @@ namespace Exiv2 {
//@}
private:
//! @name NOT implemented
//@{
//! Assignment operator.
TiffBinaryArray& operator=(const TiffBinaryArray& rhs);
//@}
// DATA
const CfgSelFct cfgSelFct_{}; //!< Pointer to a function to determine which cfg to use (may be 0)
const ArraySet* arraySet_{}; //!< Pointer to the array set, if any (may be 0)

@ -11,9 +11,9 @@
#include <iostream>
// Shortcuts for the newTiffBinaryArray templates.
#define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<&arrayCfg, EXV_COUNTOF(arrayDef), arrayDef>)
#define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<&arrayCfg, std::size(arrayDef), arrayDef>)
#define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&arrayCfg>)
#define EXV_COMPLEX_BINARY_ARRAY(arraySet, cfgSelFct) (newTiffBinaryArray2<arraySet, EXV_COUNTOF(arraySet), cfgSelFct>)
#define EXV_COMPLEX_BINARY_ARRAY(arraySet, cfgSelFct) (newTiffBinaryArray2<arraySet, std::size(arraySet), cfgSelFct>)
namespace Exiv2::Internal {
@ -415,8 +415,8 @@ namespace Exiv2::Internal {
//! Nikon AF2 configuration and definitions
// https://github.com/Exiv2/exiv2/issues/646
constexpr ArraySet nikonAf2Set[] = {
{ nikonAf21Cfg, nikonAf21Def, EXV_COUNTOF(nikonAf21Def) },
{ nikonAf22Cfg, nikonAf22Def, EXV_COUNTOF(nikonAf22Def) },
{nikonAf21Cfg, nikonAf21Def, std::size(nikonAf21Def)},
{nikonAf22Cfg, nikonAf22Def, std::size(nikonAf22Def)},
};
//! Nikon AF Fine Tune binary array - configuration
@ -575,10 +575,10 @@ namespace Exiv2::Internal {
//! Nikon Flash Info Data configurations and definitions
constexpr ArraySet nikonFlSet[] = {
{ nikonFl1Cfg, nikonFl1Def, EXV_COUNTOF(nikonFl1Def) },
{ nikonFl2Cfg, nikonFl2Def, EXV_COUNTOF(nikonFl2Def) },
{ nikonFl3Cfg, nikonFl3Def, EXV_COUNTOF(nikonFl3Def) },
{ nikonFl7Cfg, nikonFl7Def, EXV_COUNTOF(nikonFl7Def) }
{nikonFl1Cfg, nikonFl1Def, std::size(nikonFl1Def)},
{nikonFl2Cfg, nikonFl2Def, std::size(nikonFl2Def)},
{nikonFl3Cfg, nikonFl3Def, std::size(nikonFl3Def)},
{nikonFl7Cfg, nikonFl7Def, std::size(nikonFl7Def)},
};
//! Nikon Shot Info binary array - configuration 1 (D80)
@ -689,12 +689,12 @@ namespace Exiv2::Internal {
};
//! Nikon Lens Data configurations and definitions
constexpr ArraySet nikonSiSet[] = {
{ nikonSi1Cfg, nikonSi1Def, EXV_COUNTOF(nikonSi1Def) },
{ nikonSi2Cfg, nikonSi2Def, EXV_COUNTOF(nikonSi2Def) },
{ nikonSi3Cfg, nikonSi3Def, EXV_COUNTOF(nikonSi3Def) },
{ nikonSi4Cfg, nikonSi4Def, EXV_COUNTOF(nikonSi4Def) },
{ nikonSi5Cfg, nikonSi5Def, EXV_COUNTOF(nikonSi5Def) },
{ nikonSi6Cfg, nikonSi5Def, EXV_COUNTOF(nikonSi5Def) } // uses nikonSi5Def
{nikonSi1Cfg, nikonSi1Def, std::size(nikonSi1Def)},
{nikonSi2Cfg, nikonSi2Def, std::size(nikonSi2Def)},
{nikonSi3Cfg, nikonSi3Def, std::size(nikonSi3Def)},
{nikonSi4Cfg, nikonSi4Def, std::size(nikonSi4Def)},
{nikonSi5Cfg, nikonSi5Def, std::size(nikonSi5Def)},
{nikonSi6Cfg, nikonSi5Def, std::size(nikonSi5Def)}, // uses nikonSi5Def
};
//! Nikon Lens Data binary array - configuration 1
@ -755,10 +755,10 @@ namespace Exiv2::Internal {
};
//! Nikon Lens Data configurations and definitions
constexpr ArraySet nikonLdSet[] = {
{ nikonLd1Cfg, nikonLdDef, EXV_COUNTOF(nikonLdDef) },
{ nikonLd2Cfg, nikonLdDef, EXV_COUNTOF(nikonLdDef) },
{ nikonLd3Cfg, nikonLdDef, EXV_COUNTOF(nikonLdDef) },
{ nikonLd4Cfg, nikonLd4Def, EXV_COUNTOF(nikonLd4Def) }
{nikonLd1Cfg, nikonLdDef, std::size(nikonLdDef)},
{nikonLd2Cfg, nikonLdDef, std::size(nikonLdDef)},
{nikonLd3Cfg, nikonLdDef, std::size(nikonLdDef)},
{nikonLd4Cfg, nikonLd4Def, std::size(nikonLd4Def)},
};
//! Nikon Color Balance binary array - configuration 1
@ -863,12 +863,12 @@ namespace Exiv2::Internal {
};
//! Nikon Color Balance configurations and definitions
constexpr ArraySet nikonCbSet[] = {
{ nikonCb1Cfg, nikonCb1Def, EXV_COUNTOF(nikonCb1Def) },
{ nikonCb2Cfg, nikonCb2Def, EXV_COUNTOF(nikonCb2Def) },
{ nikonCb2aCfg, nikonCb2aDef, EXV_COUNTOF(nikonCb2aDef) },
{ nikonCb2bCfg, nikonCb2bDef, EXV_COUNTOF(nikonCb2bDef) },
{ nikonCb3Cfg, nikonCb3Def, EXV_COUNTOF(nikonCb3Def) },
{ nikonCb4Cfg, nikonCb4Def, EXV_COUNTOF(nikonCb4Def) }
{ nikonCb1Cfg, nikonCb1Def, std::size(nikonCb1Def) },
{ nikonCb2Cfg, nikonCb2Def, std::size(nikonCb2Def) },
{ nikonCb2aCfg, nikonCb2aDef, std::size(nikonCb2aDef) },
{ nikonCb2bCfg, nikonCb2bDef, std::size(nikonCb2bDef) },
{ nikonCb3Cfg, nikonCb3Def, std::size(nikonCb3Def) },
{ nikonCb4Cfg, nikonCb4Def, std::size(nikonCb4Def) },
};
//! Minolta Camera Settings (old) binary array - configuration
@ -975,7 +975,7 @@ namespace Exiv2::Internal {
//! Sony2Fp configurations and definitions
constexpr ArraySet sony2FpSet[] = {
{ sony2FpCfg, sony2FpDef, EXV_COUNTOF(sony2FpDef) }
{sony2FpCfg, sony2FpDef, std::size(sony2FpDef)},
};
constexpr ArrayCfg sonyMisc1Cfg = {
@ -1013,7 +1013,7 @@ namespace Exiv2::Internal {
//! SonyMisc2b configurations and definitions
constexpr ArraySet sonyMisc2bSet[] = {
{ sonyMisc2bCfg, sonyMisc2bDef, EXV_COUNTOF(sonyMisc2bDef) }
{sonyMisc2bCfg, sonyMisc2bDef, std::size(sonyMisc2bDef)},
};
constexpr ArrayCfg sonyMisc3cCfg = {
@ -1042,7 +1042,7 @@ namespace Exiv2::Internal {
//! SonyMisc3c Settings configurations and definitions
constexpr ArraySet sonyMisc3cSet[] = {
{ sonyMisc3cCfg, sonyMisc3cDef, EXV_COUNTOF(sonyMisc3cDef) }
{sonyMisc3cCfg, sonyMisc3cDef, std::size(sonyMisc3cDef)},
};
constexpr ArrayCfg sonySInfo1Cfg = {
@ -1115,7 +1115,7 @@ namespace Exiv2::Internal {
//! Sony1 Camera Settings configurations and definitions
constexpr ArraySet sony2010eSet[] = {
{ sony2010eCfg, sony2010eDef, EXV_COUNTOF(sony2010eDef) }
{sony2010eCfg, sony2010eDef, std::size(sony2010eDef)},
};
//! Sony[12] Camera Settings binary array - definition
@ -1150,13 +1150,13 @@ namespace Exiv2::Internal {
};
//! Sony1 Camera Settings configurations and definitions
constexpr ArraySet sony1CsSet[] = {
{ sony1CsCfg, sonyCsDef, EXV_COUNTOF(sonyCsDef) },
{ sony1Cs2Cfg, sonyCs2Def, EXV_COUNTOF(sonyCs2Def) }
{sony1CsCfg, sonyCsDef, std::size(sonyCsDef)},
{sony1Cs2Cfg, sonyCs2Def, std::size(sonyCs2Def)},
};
//! Sony2 Camera Settings configurations and definitions
constexpr ArraySet sony2CsSet[] = {
{ sony2CsCfg, sonyCsDef, EXV_COUNTOF(sonyCsDef) },
{ sony2Cs2Cfg, sonyCs2Def, EXV_COUNTOF(sonyCs2Def) }
{sony2CsCfg, sonyCsDef, std::size(sonyCsDef)},
{sony2Cs2Cfg, sonyCs2Def, std::size(sonyCs2Def)},
};
//! Sony Minolta Camera Settings (old) binary array - configuration

@ -199,7 +199,8 @@ namespace Exiv2 {
/// \todo this first check should be for <= offset
if (pData_.size() < offset) {
throw std::overflow_error("Overflow in Exiv2::DataBuf::c_data");
} else if (pData_.empty() || pData_.size() == offset) {
}
if (pData_.empty() || pData_.size() == offset) {
return nullptr;
}
return &pData_[offset];
@ -209,7 +210,8 @@ namespace Exiv2 {
/// \todo this first check should be for <= offset
if (pData_.size() < offset) {
throw std::overflow_error("Overflow in Exiv2::DataBuf::c_data");
} else if (pData_.empty() || pData_.size() == offset) {
}
if (pData_.empty() || pData_.size() == offset) {
return nullptr;
}
return &pData_[offset];

@ -309,12 +309,12 @@ namespace Exiv2 {
}
Xmpdatum::Xmpdatum(const XmpKey& key, const Value* pValue)
: p_(new Impl(key, pValue))
: p_(std::make_unique<Impl>(key, pValue))
{
}
Xmpdatum::Xmpdatum(const Xmpdatum& rhs)
: Metadatum(rhs), p_(new Impl(*rhs.p_))
: Metadatum(rhs), p_(std::make_unique<Impl>(*rhs.p_))
{
}

Loading…
Cancel
Save