Merge pull request #2130 from neheb/1

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

@ -80,6 +80,7 @@ namespace Exiv2 {
public: public:
//! Constructor //! Constructor
explicit Impl(std::string path); explicit Impl(std::string path);
~Impl() = default;
// Enumerations // Enumerations
//! Mode of operation //! Mode of operation
enum OpMode { opRead, opWrite, opSeek }; enum OpMode { opRead, opWrite, opSeek };
@ -126,7 +127,7 @@ namespace Exiv2 {
int FileIo::Impl::switchMode(OpMode opMode) int FileIo::Impl::switchMode(OpMode opMode)
{ {
assert(fp_ != 0); assert(fp_);
if (opMode_ == opMode) return 0; if (opMode_ == opMode) return 0;
OpMode oldOpMode = opMode_; OpMode oldOpMode = opMode_;
opMode_ = opMode; opMode_ = opMode;
@ -231,7 +232,7 @@ namespace Exiv2 {
byte* FileIo::mmap(bool isWriteable) byte* FileIo::mmap(bool isWriteable)
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
if (munmap() != 0) { if (munmap() != 0) {
throw Error(kerCallFailed, path(), strError(), "munmap"); throw Error(kerCallFailed, path(), strError(), "munmap");
} }
@ -304,7 +305,7 @@ namespace Exiv2 {
size_t FileIo::write(const byte* data, size_t wcount) size_t FileIo::write(const byte* data, size_t wcount)
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
if (p_->switchMode(Impl::opWrite) != 0) if (p_->switchMode(Impl::opWrite) != 0)
return 0; return 0;
return std::fwrite(data, 1, wcount, p_->fp_); return std::fwrite(data, 1, wcount, p_->fp_);
@ -312,7 +313,7 @@ namespace Exiv2 {
size_t FileIo::write(BasicIo& src) size_t FileIo::write(BasicIo& src)
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
if (static_cast<BasicIo*>(this) == &src) if (static_cast<BasicIo*>(this) == &src)
return 0; return 0;
if (!src.isopen()) if (!src.isopen())
@ -446,14 +447,14 @@ namespace Exiv2 {
int FileIo::putb(byte data) int FileIo::putb(byte data)
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
if (p_->switchMode(Impl::opWrite) != 0) return EOF; if (p_->switchMode(Impl::opWrite) != 0) return EOF;
return putc(data, p_->fp_); return putc(data, p_->fp_);
} }
int FileIo::seek( int64_t offset, Position pos ) int FileIo::seek( int64_t offset, Position pos )
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
int fileSeek = 0; int fileSeek = 0;
switch (pos) { switch (pos) {
@ -472,7 +473,7 @@ namespace Exiv2 {
long FileIo::tell() const long FileIo::tell() const
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
return std::ftell(p_->fp_); return std::ftell(p_->fp_);
} }
@ -531,7 +532,7 @@ namespace Exiv2 {
DataBuf FileIo::read(size_t rcount) DataBuf FileIo::read(size_t rcount)
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
if (static_cast<size_t>(rcount) > size()) if (static_cast<size_t>(rcount) > size())
throw Error(kerInvalidMalloc); throw Error(kerInvalidMalloc);
DataBuf buf(rcount); DataBuf buf(rcount);
@ -545,7 +546,7 @@ namespace Exiv2 {
size_t FileIo::read(byte* buf, size_t rcount) size_t FileIo::read(byte* buf, size_t rcount)
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
if (p_->switchMode(Impl::opRead) != 0) { if (p_->switchMode(Impl::opRead) != 0) {
return 0; return 0;
} }
@ -554,7 +555,7 @@ namespace Exiv2 {
int FileIo::getb() int FileIo::getb()
{ {
assert(p_->fp_ != 0); assert(p_->fp_);
if (p_->switchMode(Impl::opRead) != 0) return EOF; if (p_->switchMode(Impl::opRead) != 0) return EOF;
return getc(p_->fp_); return getc(p_->fp_);
} }
@ -583,6 +584,7 @@ namespace Exiv2 {
public: public:
Impl() = default; //!< Default constructor Impl() = default; //!< Default constructor
Impl(const byte* data, size_t size); //!< Constructor 2 Impl(const byte* data, size_t size); //!< Constructor 2
~Impl() = default;
// DATA // DATA
byte* data_{nullptr}; //!< Pointer to the start of the memory area byte* data_{nullptr}; //!< Pointer to the start of the memory area
@ -623,6 +625,9 @@ namespace Exiv2 {
delete [] data_; delete [] data_;
} }
BlockMap(const BlockMap&) = delete;
BlockMap& operator=(const BlockMap&) = delete;
//! @brief Populate the block. //! @brief Populate the block.
//! @param source The data populate to the block //! @param source The data populate to the block
//! @param num The size of data //! @param num The size of data
@ -1038,6 +1043,9 @@ namespace Exiv2 {
//! Destructor. Releases all managed memory. //! Destructor. Releases all managed memory.
virtual ~Impl(); virtual ~Impl();
Impl(const Impl&) = delete;
Impl& operator=(const Impl&) = delete;
// DATA // DATA
std::string path_; //!< (Standard) path std::string path_; //!< (Standard) path
size_t blockSize_; //!< Size of the block memory. size_t blockSize_; //!< Size of the block memory.
@ -1450,6 +1458,8 @@ namespace Exiv2 {
HttpImpl(const std::string& url, size_t blockSize); HttpImpl(const std::string& url, size_t blockSize);
Exiv2::Uri hostInfo_; //!< the host information extracted from the path Exiv2::Uri hostInfo_; //!< the host information extracted from the path
~HttpImpl() override = default;
// METHODS // METHODS
/*! /*!
@brief Get the length (in bytes) of the remote file. @brief Get the length (in bytes) of the remote file.

@ -21,13 +21,9 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
class Value; // *****************************************************************************
// class definitions
namespace Internal {
// *****************************************************************************
// class definitions
//! MakerNote for Canon cameras //! MakerNote for Canon cameras
class CanonMakerNote { class CanonMakerNote {
@ -205,7 +201,7 @@ namespace Exiv2 {
*/ */
float canonEv(int64_t val); float canonEv(int64_t val);
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef CANONMN_INT_HPP_ #endif // #ifndef CANONMN_INT_HPP_

@ -18,11 +18,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Casio cameras //! MakerNote for Casio cameras
class CasioMakerNote { class CasioMakerNote {
@ -56,6 +55,6 @@ namespace Exiv2 {
}; // class Casio2MakerNote }; // class Casio2MakerNote
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef CasioMN_INT_HPP_ #endif // #ifndef CasioMN_INT_HPP_

@ -16,11 +16,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
/// @brief Canon CR2 header structure. /// @brief Canon CR2 header structure.
class Cr2Header : public TiffHeaderBase { class Cr2Header : public TiffHeaderBase {
@ -53,6 +52,6 @@ namespace Exiv2 {
static constexpr auto cr2sig_ = "CR\2\0"; //!< Signature for CR2 type TIFF static constexpr auto cr2sig_ = "CR\2\0"; //!< Signature for CR2 type TIFF
}; // class Cr2Header }; // class Cr2Header
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef CR2IMAGE_INT_HPP_ #endif // #ifndef CR2IMAGE_INT_HPP_

@ -14,16 +14,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
// ***************************************************************************** // *****************************************************************************
// class declarations // class declarations
class ExifData;
namespace Internal {
// *****************************************************************************
// class declarations
class CiffHeader; class CiffHeader;
class CiffComponent; class CiffComponent;
struct CrwMapping; struct CrwMapping;
@ -691,6 +685,6 @@ namespace Exiv2 {
IfdId ifdId, IfdId ifdId,
ByteOrder byteOrder); ByteOrder byteOrder);
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef CRWIMAGE_INT_HPP_ #endif // #ifndef CRWIMAGE_INT_HPP_

@ -102,12 +102,7 @@ namespace {
public: public:
//! Shortcut for a %TiffThumbnail auto pointer. //! Shortcut for a %TiffThumbnail auto pointer.
using UniquePtr = std::unique_ptr<TiffThumbnail>; using UniquePtr = std::unique_ptr<TiffThumbnail>;
~TiffThumbnail() override = default;
//! @name Manipulators
//@{
//! Assignment operator.
TiffThumbnail& operator=(const TiffThumbnail& rhs);
//@}
//! @name Accessors //! @name Accessors
//@{ //@{
@ -123,12 +118,7 @@ namespace {
public: public:
//! Shortcut for a %JpegThumbnail auto pointer. //! Shortcut for a %JpegThumbnail auto pointer.
using UniquePtr = std::unique_ptr<JpegThumbnail>; using UniquePtr = std::unique_ptr<JpegThumbnail>;
~JpegThumbnail() override = default;
//! @name Manipulators
//@{
//! Assignment operator.
JpegThumbnail& operator=(const JpegThumbnail& rhs);
//@}
//! @name Accessors //! @name Accessors
//@{ //@{

@ -9,11 +9,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Fujifilm cameras //! MakerNote for Fujifilm cameras
class FujiMakerNote { class FujiMakerNote {
@ -24,9 +23,8 @@ namespace Exiv2 {
private: private:
//! Tag information //! Tag information
static const TagInfo tagInfo_[]; static const TagInfo tagInfo_[];
}; // class FujiMakerNote }; // class FujiMakerNote
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef FUJIMN_INT_HPP_ #endif // #ifndef FUJIMN_INT_HPP_

@ -18,11 +18,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
/*! /*!
@brief format a string in the pattern of \em sprintf \em . @brief format a string in the pattern of \em sprintf \em .
@ -106,6 +105,6 @@ namespace Exiv2 {
/// @brief indent output for kpsRecursive in \em printStructure() \em . /// @brief indent output for kpsRecursive in \em printStructure() \em .
std::string indent(int32_t depth); std::string indent(int32_t depth);
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef IMAGE_INT_HPP_ #endif // #ifndef IMAGE_INT_HPP_

@ -11,23 +11,21 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal { // *****************************************************************************
// ***************************************************************************** // function prototypes
// function prototypes /*!
/*! @brief Determine the path to the Exiv2 configuration file
@brief Determine the path to the Exiv2 configuration file */
*/ std::string getExiv2ConfigPath();
std::string getExiv2ConfigPath();
/*!
@brief Read value from Exiv2 configuration file
*/
std::string readExiv2Config(const std::string& section,const std::string& value,const std::string& def);
/*!
@brief Read value from Exiv2 configuration file
*/
std::string readExiv2Config(const std::string& section, const std::string& value, const std::string& def);
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! Type for a pointer to a function creating a makernote (image) //! Type for a pointer to a function creating a makernote (image)
using NewMnFct = TiffComponent* (*)(uint16_t tag, using NewMnFct = TiffComponent* (*)(uint16_t tag,
@ -748,6 +746,6 @@ namespace Exiv2 {
*/ */
DataBuf nikonCrypt(uint16_t tag, const byte* pData, uint32_t size, TiffComponent* const pRoot); DataBuf nikonCrypt(uint16_t tag, const byte* pData, uint32_t size, TiffComponent* const pRoot);
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef MAKERNOTE_INT_HPP_ #endif // #ifndef MAKERNOTE_INT_HPP_

@ -13,11 +13,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Minolta cameras //! MakerNote for Minolta cameras
class MinoltaMakerNote { class MinoltaMakerNote {
@ -121,6 +120,6 @@ namespace Exiv2 {
// TODO: Added shared methods here. // TODO: Added shared methods here.
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef MINOLTAMN_INT_HPP_ #endif // #ifndef MINOLTAMN_INT_HPP_

@ -27,11 +27,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! A MakerNote format used by Nikon cameras, such as the E990 and D1. //! A MakerNote format used by Nikon cameras, such as the E990 and D1.
class Nikon1MakerNote { class Nikon1MakerNote {
@ -286,6 +285,6 @@ namespace Exiv2 {
}; // class Nikon3MakerNote }; // class Nikon3MakerNote
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef NIKONMN_INT_HPP_ #endif // #ifndef NIKONMN_INT_HPP_

@ -22,11 +22,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Olympus cameras //! MakerNote for Olympus cameras
class OlympusMakerNote { class OlympusMakerNote {
@ -96,6 +95,6 @@ namespace Exiv2 {
}; // class OlympusMakerNote }; // class OlympusMakerNote
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef OLYMPUSMN_INT_HPP_ #endif // #ifndef OLYMPUSMN_INT_HPP_

@ -10,11 +10,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
/*! /*!
@brief Olympus ORF header structure. @brief Olympus ORF header structure.
@ -43,6 +42,6 @@ namespace Exiv2 {
uint16_t sig_; //<! The actual magic number uint16_t sig_; //<! The actual magic number
}; // class OrfHeader }; // class OrfHeader
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef ORFIMAGE_INT_HPP_ #endif // #ifndef ORFIMAGE_INT_HPP_

@ -10,11 +10,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Panasonic cameras //! MakerNote for Panasonic cameras
class PanasonicMakerNote { class PanasonicMakerNote {
@ -57,7 +56,6 @@ namespace Exiv2 {
static const TagInfo tagInfoRaw_[]; static const TagInfo tagInfoRaw_[];
}; // class PanasonicMakerNote }; // class PanasonicMakerNote
} // namespace Exiv2::Internal
}} // namespace Internal, Exiv2
#endif // #ifndef PANASONICMN_INT_HPP_ #endif // #ifndef PANASONICMN_INT_HPP_

@ -11,11 +11,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Pentaxfilm cameras //! MakerNote for Pentaxfilm cameras
class PentaxMakerNote { class PentaxMakerNote {
@ -90,8 +89,6 @@ namespace Exiv2 {
//! Shortcut for the printCombiTag template which requires typing the array name only once. //! 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<EXV_COUNTOF(array), array, count, ignoredcount, ignoredcountmax>
} // namespace Internal } // namespace Exiv2::Internal
} // namespace Exiv2
#endif // #ifndef PENTAXMN_INT_HPP_ #endif // #ifndef PENTAXMN_INT_HPP_

@ -10,16 +10,9 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
// *****************************************************************************
// ***************************************************************************** // class definitions
// class declarations
class Image;
namespace Internal {
// *****************************************************************************
// class definitions
/*! /*!
@brief Stateless parser class for data in PNG chunk format. Images use this @brief Stateless parser class for data in PNG chunk format. Images use this
@ -161,6 +154,6 @@ namespace Exiv2 {
}; // class PngChunk }; // class PngChunk
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef PNGCHUNK_INT_HPP_ #endif // #ifndef PNGCHUNK_INT_HPP_

@ -9,11 +9,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
/*! /*!
@brief Panasonic RW2 header structure. @brief Panasonic RW2 header structure.
@ -36,6 +35,6 @@ namespace Exiv2 {
}; // class Rw2Header }; // class Rw2Header
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef RW2IMAGE_INT_HPP_ #endif // #ifndef RW2IMAGE_INT_HPP_

@ -10,11 +10,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Samsung cameras //! MakerNote for Samsung cameras
class Samsung2MakerNote { class Samsung2MakerNote {
@ -32,6 +31,6 @@ namespace Exiv2 {
}; // class Samsung2MakerNote }; // class Samsung2MakerNote
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef SAMSUNGMN_INT_HPP_ #endif // #ifndef SAMSUNGMN_INT_HPP_

@ -10,11 +10,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Sigma (Foveon) cameras //! MakerNote for Sigma (Foveon) cameras
class SigmaMakerNote { class SigmaMakerNote {
@ -38,6 +37,6 @@ namespace Exiv2 {
}; // class SigmaMakerNote }; // class SigmaMakerNote
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef SIGMAMN_INT_HPP_ #endif // #ifndef SIGMAMN_INT_HPP_

@ -9,11 +9,10 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
//! MakerNote for Sony cameras //! MakerNote for Sony cameras
class SonyMakerNote { class SonyMakerNote {
@ -83,6 +82,6 @@ namespace Exiv2 {
DataBuf sonyTagDecipher(uint16_t, const byte*, uint32_t, TiffComponent* const); DataBuf sonyTagDecipher(uint16_t, const byte*, uint32_t, TiffComponent* const);
DataBuf sonyTagEncipher(uint16_t, const byte*, uint32_t, TiffComponent* const); DataBuf sonyTagEncipher(uint16_t, const byte*, uint32_t, TiffComponent* const);
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef SONYMN_INT_HPP_ #endif // #ifndef SONYMN_INT_HPP_

@ -332,10 +332,7 @@ namespace Exiv2 {
return p_->key_; return p_->key_;
} }
const char* ExifKey::familyName() const const char* ExifKey::familyName() const { return Exiv2::ExifKey::Impl::familyName_; }
{
return p_->familyName_;
}
std::string ExifKey::groupName() const std::string ExifKey::groupName() const
{ {

@ -69,21 +69,10 @@ namespace Exiv2::Internal {
if (pow_) pow_->setTarget(OffsetWriter::OffsetId(id), static_cast<uint32_t>(target)); if (pow_) pow_->setTarget(OffsetWriter::OffsetId(id), static_cast<uint32_t>(target));
} }
TiffComponent::TiffComponent(uint16_t tag, IfdId group) : tag_(tag), group_(group), pStart_(nullptr) TiffComponent::TiffComponent(uint16_t tag, IfdId group) : tag_(tag), group_(group) {}
{
}
TiffEntryBase::TiffEntryBase(uint16_t tag, IfdId group, TiffType tiffType) TiffEntryBase::TiffEntryBase(uint16_t tag, IfdId group, TiffType tiffType)
: TiffComponent(tag, group), : TiffComponent(tag, group), tiffType_(tiffType) {}
tiffType_(tiffType),
count_(0),
offset_(0),
size_(0),
pData_(nullptr),
idx_(0),
pValue_(nullptr)
{
}
TiffSubIfd::TiffSubIfd(uint16_t tag, IfdId group, IfdId newGroup) TiffSubIfd::TiffSubIfd(uint16_t tag, IfdId group, IfdId newGroup)
: TiffEntryBase(tag, group, ttUnsignedLong), newGroup_(newGroup) : TiffEntryBase(tag, group, ttUnsignedLong), newGroup_(newGroup)
@ -91,9 +80,7 @@ namespace Exiv2::Internal {
} }
TiffMnEntry::TiffMnEntry(uint16_t tag, IfdId group, IfdId mnGroup) TiffMnEntry::TiffMnEntry(uint16_t tag, IfdId group, IfdId mnGroup)
: TiffEntryBase(tag, group, ttUndefined), mnGroup_(mnGroup), mn_(nullptr) : TiffEntryBase(tag, group, ttUndefined), mnGroup_(mnGroup) {}
{
}
TiffIfdMakernote::TiffIfdMakernote(uint16_t tag, TiffIfdMakernote::TiffIfdMakernote(uint16_t tag,
IfdId group, IfdId group,
@ -103,7 +90,6 @@ namespace Exiv2::Internal {
: TiffComponent(tag, group), : TiffComponent(tag, group),
pHeader_(pHeader), pHeader_(pHeader),
ifd_(tag, mnGroup, hasNext), ifd_(tag, mnGroup, hasNext),
mnOffset_(0),
imageByteOrder_(invalidByteOrder) imageByteOrder_(invalidByteOrder)
{ {
} }
@ -111,17 +97,9 @@ namespace Exiv2::Internal {
TiffBinaryArray::TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg* arrayCfg, const ArrayDef* arrayDef, TiffBinaryArray::TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg* arrayCfg, const ArrayDef* arrayDef,
int defSize) int defSize)
: TiffEntryBase(tag, group, arrayCfg->elTiffType_), : TiffEntryBase(tag, group, arrayCfg->elTiffType_),
cfgSelFct_(nullptr),
arraySet_(nullptr),
arrayCfg_(arrayCfg), arrayCfg_(arrayCfg),
arrayDef_(arrayDef), arrayDef_(arrayDef),
defSize_(defSize), defSize_(defSize) {
setSize_(0),
origData_(nullptr),
origSize_(0),
pRoot_(nullptr),
decoded_(false)
{
assert(arrayCfg != 0); assert(arrayCfg != 0);
} }
@ -130,15 +108,7 @@ namespace Exiv2::Internal {
: TiffEntryBase(tag, group), // Todo: Does it make a difference that there is no type? : TiffEntryBase(tag, group), // Todo: Does it make a difference that there is no type?
cfgSelFct_(cfgSelFct), cfgSelFct_(cfgSelFct),
arraySet_(arraySet), arraySet_(arraySet),
arrayCfg_(nullptr), setSize_(setSize) {
arrayDef_(nullptr),
defSize_(0),
setSize_(setSize),
origData_(nullptr),
origSize_(0),
pRoot_(nullptr),
decoded_(false)
{
// We'll figure out the correct cfg later // We'll figure out the correct cfg later
assert(cfgSelFct != 0); assert(cfgSelFct != 0);
assert(arraySet_ != 0); assert(arraySet_ != 0);
@ -203,9 +173,7 @@ namespace Exiv2::Internal {
{ {
} }
TiffDirectory::TiffDirectory(const TiffDirectory& rhs) : TiffComponent(rhs), hasNext_(rhs.hasNext_), pNext_(nullptr) TiffDirectory::TiffDirectory(const TiffDirectory& rhs) : TiffComponent(rhs), hasNext_(rhs.hasNext_) {}
{
}
TiffSubIfd::TiffSubIfd(const TiffSubIfd& rhs) TiffSubIfd::TiffSubIfd(const TiffSubIfd& rhs)
: TiffEntryBase(rhs), : TiffEntryBase(rhs),
@ -223,10 +191,7 @@ namespace Exiv2::Internal {
setSize_(rhs.setSize_), setSize_(rhs.setSize_),
origData_(rhs.origData_), origData_(rhs.origData_),
origSize_(rhs.origSize_), origSize_(rhs.origSize_),
pRoot_(rhs.pRoot_), pRoot_(rhs.pRoot_) {}
decoded_(false)
{
}
TiffComponent::UniquePtr TiffComponent::clone() const TiffComponent::UniquePtr TiffComponent::clone() const
{ {

@ -342,7 +342,7 @@ namespace Exiv2 {
Pointer to the start of the binary representation of the component in Pointer to the start of the binary representation of the component in
a memory buffer. The buffer is allocated and freed outside of this class. a memory buffer. The buffer is allocated and freed outside of this class.
*/ */
byte* pStart_; byte* pStart_{};
}; // class TiffComponent }; // class TiffComponent
@ -535,23 +535,23 @@ namespace Exiv2 {
// DATA // DATA
TiffType tiffType_; //!< Field TIFF type TiffType tiffType_; //!< Field TIFF type
size_t count_; //!< The number of values of the indicated type size_t count_{}; //!< The number of values of the indicated type
int64_t offset_; //!< Offset to the data area int64_t offset_{}; //!< Offset to the data area
/*! /*!
Size of the data buffer holding the value in bytes, there is no Size of the data buffer holding the value in bytes, there is no
minimum size. minimum size.
*/ */
uint32_t size_; uint32_t size_{};
// Notes on the ownership model of pData_: pData_ is a always a // Notes on the ownership model of pData_: pData_ is a always a
// pointer to a buffer owned by somebody else. Usually it is a // pointer to a buffer owned by somebody else. Usually it is a
// pointer into a copy of the image file, but if // pointer into a copy of the image file, but if
// TiffEntryBase::setData is used then it is a pointer into the // TiffEntryBase::setData is used then it is a pointer into the
// storage_ DataBuf below. // storage_ DataBuf below.
byte* pData_; //!< Pointer to the data area byte* pData_{}; //!< Pointer to the data area
int idx_; //!< Unique id of the entry in the image int idx_{}; //!< Unique id of the entry in the image
Value* pValue_; //!< Converted data value Value* pValue_{}; //!< Converted data value
// This DataBuf is only used when TiffEntryBase::setData is called. // This DataBuf is only used when TiffEntryBase::setData is called.
// Otherwise, it remains empty. It is wrapped in a shared_ptr because // Otherwise, it remains empty. It is wrapped in a shared_ptr because
@ -653,15 +653,7 @@ namespace Exiv2 {
class TiffDataEntry : public TiffDataEntryBase { class TiffDataEntry : public TiffDataEntryBase {
friend class TiffEncoder; friend class TiffEncoder;
public: public:
//! @name Creators using TiffDataEntryBase::TiffDataEntryBase;
//@{
//! Constructor
TiffDataEntry(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup)
: TiffDataEntryBase(tag, group, szTag, szGroup),
pDataArea_(0), sizeDataArea_(0) {}
//! Virtual destructor.
~TiffDataEntry() override = default;
//@}
//! @name Manipulators //! @name Manipulators
//@{ //@{
@ -706,8 +698,8 @@ namespace Exiv2 {
private: private:
// DATA // DATA
byte* pDataArea_; //!< Pointer to the data area (never alloc'd) byte* pDataArea_{}; //!< Pointer to the data area (never alloc'd)
uint32_t sizeDataArea_; //!< Size of the data area uint32_t sizeDataArea_{}; //!< Size of the data area
}; // class TiffDataEntry }; // class TiffDataEntry
@ -725,16 +717,9 @@ namespace Exiv2 {
*/ */
class TiffImageEntry : public TiffDataEntryBase { class TiffImageEntry : public TiffDataEntryBase {
friend class TiffEncoder; friend class TiffEncoder;
public: using TiffDataEntryBase::TiffDataEntryBase;
//! @name Creators
//@{
//! Constructor
TiffImageEntry(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup)
: TiffDataEntryBase(tag, group, szTag, szGroup) {}
//! Virtual destructor.
~TiffImageEntry() override = default;
//@}
public:
//! @name Manipulators //! @name Manipulators
//@{ //@{
void setStrips(const Value* pSize, const byte* pData, uint32_t sizeData, uint32_t baseOffset) override; void setStrips(const Value* pSize, const byte* pData, uint32_t sizeData, uint32_t baseOffset) override;
@ -844,8 +829,7 @@ namespace Exiv2 {
//! @name Creators //! @name Creators
//@{ //@{
//! Default constructor //! Default constructor
TiffDirectory(uint16_t tag, IfdId group, bool hasNext =true) TiffDirectory(uint16_t tag, IfdId group, bool hasNext = true) : TiffComponent(tag, group), hasNext_(hasNext) {}
: TiffComponent(tag, group), hasNext_(hasNext), pNext_(0) {}
//! Virtual destructor //! Virtual destructor
~TiffDirectory() override; ~TiffDirectory() override;
//@} //@}
@ -932,11 +916,10 @@ namespace Exiv2 {
uint32_t& imageIdx); uint32_t& imageIdx);
//@} //@}
private:
// DATA // DATA
Components components_; //!< List of components in this directory Components components_; //!< List of components in this directory
const bool hasNext_; //!< True if the directory has a next pointer const bool hasNext_; //!< True if the directory has a next pointer
TiffComponent* pNext_; //!< Pointer to the next IFD TiffComponent* pNext_{}; //!< Pointer to the next IFD
}; // class TiffDirectory }; // class TiffDirectory
@ -1083,7 +1066,7 @@ namespace Exiv2 {
// DATA // DATA
IfdId mnGroup_; //!< New group for concrete mn IfdId mnGroup_; //!< New group for concrete mn
TiffComponent* mn_; //!< The Makernote TiffComponent* mn_{}; //!< The Makernote
}; // class TiffMnEntry }; // class TiffMnEntry
@ -1237,7 +1220,7 @@ namespace Exiv2 {
// DATA // DATA
MnHeader* pHeader_; //!< Makernote header MnHeader* pHeader_; //!< Makernote header
TiffDirectory ifd_; //!< Makernote IFD TiffDirectory ifd_; //!< Makernote IFD
uint32_t mnOffset_; //!< Makernote offset uint32_t mnOffset_{}; //!< Makernote offset
ByteOrder imageByteOrder_; //!< Byte order for the image ByteOrder imageByteOrder_; //!< Byte order for the image
}; // class TiffIfdMakernote }; // class TiffIfdMakernote
@ -1410,17 +1393,19 @@ namespace Exiv2 {
//@} //@}
// DATA // DATA
const CfgSelFct cfgSelFct_; //!< Pointer to a function to determine which cfg to use (may be 0) 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) const ArraySet* arraySet_{}; //!< Pointer to the array set, if any (may be 0)
const ArrayCfg* arrayCfg_; //!< Pointer to the array configuration (must not be 0, except for unrecognized complex binary arrays) const ArrayCfg* arrayCfg_{}; //!< Pointer to the array configuration (must not be 0, except for unrecognized
const ArrayDef* arrayDef_; //!< Pointer to the array definition (may be 0) //!< complex binary arrays)
int defSize_; //!< Size of the array definition array (may be 0) const ArrayDef* arrayDef_{}; //!< Pointer to the array definition (may be 0)
int setSize_; //!< Size of the array set (may be 0) int defSize_{}; //!< Size of the array definition array (may be 0)
int setSize_{}; //!< Size of the array set (may be 0)
Components elements_; //!< List of elements in this composite Components elements_; //!< List of elements in this composite
byte* origData_; //!< Pointer to the original data buffer (unencrypted) byte* origData_{}; //!< Pointer to the original data buffer (unencrypted)
uint32_t origSize_; //!< Size of the original data buffer uint32_t origSize_{}; //!< Size of the original data buffer
TiffComponent* pRoot_; //!< Pointer to the root component of the TIFF tree. (Only used for intrusive writing.) TiffComponent*
bool decoded_; //!< Flag to indicate if the array was decoded pRoot_{}; //!< Pointer to the root component of the TIFF tree. (Only used for intrusive writing.)
bool decoded_{}; //!< Flag to indicate if the array was decoded
}; // class TiffBinaryArray }; // class TiffBinaryArray
/*! /*!

@ -11,12 +11,11 @@
// ***************************************************************************** // *****************************************************************************
// namespace extensions // namespace extensions
namespace Exiv2 { namespace Exiv2::Internal {
/*! /*!
@brief Contains internal objects which are not published and are not part @brief Contains internal objects which are not published and are not part
of the <b>libexiv2</b> API. of the <b>libexiv2</b> API.
*/ */
namespace Internal {
// ***************************************************************************** // *****************************************************************************
// class definitions // class definitions
@ -270,16 +269,9 @@ namespace Exiv2 {
@return Byte order in which the data is encoded, invalidByteOrder if @return Byte order in which the data is encoded, invalidByteOrder if
decoding failed. decoding failed.
*/ */
static ByteOrder decode( static ByteOrder decode(ExifData& exifData, IptcData& iptcData, XmpData& xmpData, const byte* pData,
ExifData& exifData, uint32_t size, uint32_t root, FindDecoderFct findDecoderFct,
IptcData& iptcData, TiffHeaderBase* pHeader = nullptr);
XmpData& xmpData,
const byte* pData,
uint32_t size,
uint32_t root,
FindDecoderFct findDecoderFct,
TiffHeaderBase* pHeader =0
);
/*! /*!
@brief Encode TIFF metadata from the metadata containers into a @brief Encode TIFF metadata from the metadata containers into a
memory block \em blob. memory block \em blob.
@ -423,12 +415,12 @@ namespace Exiv2 {
//! Data structure for the offset list. //! Data structure for the offset list.
struct OffsetData { struct OffsetData {
//! Default constructor //! Default constructor
OffsetData() : origin_(0), target_(0), byteOrder_(littleEndian) {} OffsetData() : origin_(0), byteOrder_(littleEndian) {}
//! Constructor //! Constructor
OffsetData(uint32_t origin, ByteOrder byteOrder) : origin_(origin), target_(0), byteOrder_(byteOrder) {} OffsetData(uint32_t origin, ByteOrder byteOrder) : origin_(origin), byteOrder_(byteOrder) {}
// DATA // DATA
uint32_t origin_; //!< Origin address uint32_t origin_; //!< Origin address
uint32_t target_; //!< Target address uint32_t target_{}; //!< Target address
ByteOrder byteOrder_; //!< Byte order to use to encode target address ByteOrder byteOrder_; //!< Byte order to use to encode target address
}; };
//! Type of the list containing an identifier and an address pair. //! Type of the list containing an identifier and an address pair.
@ -453,6 +445,6 @@ namespace Exiv2 {
}; // class FindExifdatum }; // class FindExifdatum
}} // namespace Internal, Exiv2 } // namespace Exiv2::Internal
#endif // #ifndef TIFFIMAGE_INT_HPP_ #endif // #ifndef TIFFIMAGE_INT_HPP_

@ -669,10 +669,7 @@ namespace Exiv2::Internal {
setGo(geTraverse, !flag); setGo(geTraverse, !flag);
} }
bool TiffEncoder::dirty() const bool TiffEncoder::dirty() const { return dirty_ || !exifData_.empty(); }
{
return dirty_ || exifData_.count() > 0;
}
void TiffEncoder::visitEntry(TiffEntry* object) void TiffEncoder::visitEntry(TiffEntry* object)
{ {
@ -768,7 +765,7 @@ namespace Exiv2::Internal {
} }
if (del_) { if (del_) {
// Remove remaining synthesized tags // Remove remaining synthesized tags
static const char* synthesizedTags[] = { static constexpr auto synthesizedTags = std::array{
"Exif.MakerNote.Offset", "Exif.MakerNote.Offset",
}; };
for (auto&& synthesizedTag : synthesizedTags) { for (auto&& synthesizedTag : synthesizedTags) {
@ -1636,9 +1633,7 @@ namespace Exiv2::Internal {
if (cryptFct != nullptr) { if (cryptFct != nullptr) {
const byte* pData = object->pData(); const byte* pData = object->pData();
int32_t size = object->TiffEntryBase::doSize(); int32_t size = object->TiffEntryBase::doSize();
std::shared_ptr<DataBuf> buf = std::make_shared<DataBuf>( auto buf = std::make_shared<DataBuf>(cryptFct(object->tag(), pData, size, pRoot_));
cryptFct(object->tag(), pData, size, pRoot_)
);
if (!buf->empty()) if (!buf->empty())
object->setData(buf); object->setData(buf);
} }

@ -136,8 +136,7 @@ namespace Exiv2 {
//! @name Creators //! @name Creators
//@{ //@{
//! Constructor, taking \em tag and \em group of the component to find. //! Constructor, taking \em tag and \em group of the component to find.
TiffFinder(uint16_t tag, IfdId group) TiffFinder(uint16_t tag, IfdId group) : tag_(tag), group_(group) {}
: tag_(tag), group_(group), tiffComponent_(0) {}
//! Virtual destructor //! Virtual destructor
~TiffFinder() override = default; ~TiffFinder() override = default;
//@} //@}
@ -183,7 +182,7 @@ namespace Exiv2 {
private: private:
uint16_t tag_; uint16_t tag_;
IfdId group_; IfdId group_;
TiffComponent* tiffComponent_; TiffComponent* tiffComponent_{};
}; // class TiffFinder }; // class TiffFinder
/*! /*!
@ -324,7 +323,6 @@ namespace Exiv2 {
const TiffEntryBase* object); const TiffEntryBase* object);
//@} //@}
private:
// DATA // DATA
ExifData& exifData_; //!< Exif metadata container ExifData& exifData_; //!< Exif metadata container
IptcData& iptcData_; //!< IPTC metadata container IptcData& iptcData_; //!< IPTC metadata container
@ -415,10 +413,7 @@ namespace Exiv2 {
@note Encoder functions may use metadata other than \em datum. @note Encoder functions may use metadata other than \em datum.
*/ */
void encodeTiffComponent( void encodeTiffComponent(TiffEntryBase* object, const Exifdatum* datum = nullptr);
TiffEntryBase* object,
const Exifdatum* datum =0
);
//! Callback encoder function for an element of a binary array. //! Callback encoder function for an element of a binary array.
void encodeBinaryElement(TiffBinaryElement* object, const Exifdatum* datum); void encodeBinaryElement(TiffBinaryElement* object, const Exifdatum* datum);
@ -520,7 +515,6 @@ namespace Exiv2 {
bool isImageTag(uint16_t tag, IfdId group) const; bool isImageTag(uint16_t tag, IfdId group) const;
//@} //@}
private:
// DATA // DATA
ExifData exifData_; //!< Copy of the Exif data to encode ExifData exifData_; //!< Copy of the Exif data to encode
const IptcData& iptcData_; //!< IPTC data to encode, just a reference const IptcData& iptcData_; //!< IPTC data to encode, just a reference
@ -645,7 +639,7 @@ namespace Exiv2 {
Uses the \em state passed in, if any, and remembers it for use during Uses the \em state passed in, if any, and remembers it for use during
subsequent calls without any argument. subsequent calls without any argument.
*/ */
void setMnState(const TiffRwState* state =0); void setMnState(const TiffRwState* state = nullptr);
//! Set the state to the original state as set in the constructor. //! Set the state to the original state as set in the constructor.
void setOrigState(); void setOrigState();
//! Check IFD directory pointer \em start for circular reference //! Check IFD directory pointer \em start for circular reference

@ -64,6 +64,9 @@ namespace {
validator.check_internal(buf, buflen); validator.check_internal(buf, buflen);
} }
XMLValidator(const XMLValidator&) = delete;
XMLValidator& operator=(const XMLValidator&) = delete;
private: private:
// Private constructor, because this class is only constructed by // Private constructor, because this class is only constructed by
// the (static) check method. // the (static) check method.
@ -253,6 +256,10 @@ namespace {
{ {
if (xmpLockFct_) xmpLockFct_(pLockData_, false); if (xmpLockFct_) xmpLockFct_(pLockData_, false);
} }
AutoLock(const AutoLock&) = delete;
AutoLock& operator=(const AutoLock&) = delete;
private: private:
Exiv2::XmpParser::XmpLockFct xmpLockFct_; Exiv2::XmpParser::XmpLockFct xmpLockFct_;
void* pLockData_; void* pLockData_;
@ -268,6 +275,7 @@ namespace Exiv2 {
Impl(const XmpKey& key, const Value* pValue); //!< Constructor Impl(const XmpKey& key, const Value* pValue); //!< Constructor
Impl(const Impl& rhs); //!< Copy constructor Impl(const Impl& rhs); //!< Copy constructor
Impl& operator=(const Impl& rhs); //!< Assignment Impl& operator=(const Impl& rhs); //!< Assignment
~Impl() = default;
// DATA // DATA
XmpKey::UniquePtr key_; //!< Key XmpKey::UniquePtr key_; //!< Key

Loading…
Cancel
Save