diff --git a/include/exiv2/basicio.hpp b/include/exiv2/basicio.hpp index 869a8044..e12aa08a 100644 --- a/include/exiv2/basicio.hpp +++ b/include/exiv2/basicio.hpp @@ -737,7 +737,7 @@ class EXIV2API XPathIo : public FileIo { private: // True if the file is a temporary file and it should be deleted in destructor. - bool isTemp_; + bool isTemp_{true}; std::string tempFilePath_; }; // class XPathIo #endif diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp index 2a968fc3..8e0166b1 100644 --- a/include/exiv2/image.hpp +++ b/include/exiv2/image.hpp @@ -467,8 +467,8 @@ class EXIV2API Image { DataBuf iccProfile_; //!< ICC buffer (binary data) std::string comment_; //!< User comment std::string xmpPacket_; //!< XMP packet - uint32_t pixelWidth_; //!< image pixel width - uint32_t pixelHeight_; //!< image pixel height + uint32_t pixelWidth_{0}; //!< image pixel width + uint32_t pixelHeight_{0}; //!< image pixel height NativePreviewList nativePreviews_; //!< list of native previews //! Return tag name for given tag id. @@ -479,13 +479,13 @@ class EXIV2API Image { private: // DATA - ImageType imageType_; //!< Image type - uint16_t supportedMetadata_; //!< Bitmap with all supported metadata types - bool writeXmpFromPacket_; //!< Determines the source when writing XMP - ByteOrder byteOrder_; //!< Byte order + ImageType imageType_; //!< Image type + uint16_t supportedMetadata_; //!< Bitmap with all supported metadata types + bool writeXmpFromPacket_; //!< Determines the source when writing XMP + ByteOrder byteOrder_{invalidByteOrder}; //!< Byte order std::map tags_; //!< Map of tags - bool init_; //!< Flag marking if map of tags needs to be initialized + bool init_{true}; //!< Flag marking if map of tags needs to be initialized }; // class Image diff --git a/include/exiv2/tiffimage.hpp b/include/exiv2/tiffimage.hpp index 121c9021..75fe93eb 100644 --- a/include/exiv2/tiffimage.hpp +++ b/include/exiv2/tiffimage.hpp @@ -85,10 +85,10 @@ class EXIV2API TiffImage : public Image { //@} // DATA - mutable std::string primaryGroup_; //!< The primary group - mutable std::string mimeType_; //!< The MIME type - mutable uint32_t pixelWidthPrimary_; //!< Width of the primary image in pixels - mutable uint32_t pixelHeightPrimary_; //!< Height of the primary image in pixels + mutable std::string primaryGroup_; //!< The primary group + mutable std::string mimeType_; //!< The MIME type + mutable uint32_t pixelWidthPrimary_{0}; //!< Width of the primary image in pixels + mutable uint32_t pixelHeightPrimary_{0}; //!< Height of the primary image in pixels }; // class TiffImage diff --git a/include/exiv2/value.hpp b/include/exiv2/value.hpp index 7152cd69..9cf37588 100644 --- a/include/exiv2/value.hpp +++ b/include/exiv2/value.hpp @@ -229,7 +229,7 @@ class EXIV2API Value { */ Value& operator=(const Value&) = default; // DATA - mutable bool ok_; //!< Indicates the status of the previous to conversion + mutable bool ok_{true}; //!< Indicates the status of the previous to conversion private: //! Internal virtual copy constructor. @@ -648,8 +648,8 @@ class EXIV2API XmpValue : public Value { private: // DATA - XmpArrayType xmpArrayType_; //!< Type of XMP array - XmpStruct xmpStruct_; //!< XMP structure indicator + XmpArrayType xmpArrayType_{xaNone}; //!< Type of XMP array + XmpStruct xmpStruct_{xsNone}; //!< XMP structure indicator }; // class XmpValue diff --git a/src/basicio.cpp b/src/basicio.cpp index 6539b762..b75ee5ef 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -899,7 +899,7 @@ void XPathIo::ReadDataUri(const std::string& path) { } #else -XPathIo::XPathIo(const std::string& orgPath) : FileIo(XPathIo::writeDataToFile(orgPath)), isTemp_(true) { +XPathIo::XPathIo(const std::string& orgPath) : FileIo(XPathIo::writeDataToFile(orgPath)) { tempFilePath_ = path(); } @@ -992,15 +992,15 @@ class RemoteIo::Impl { Impl& operator=(const Impl&) = delete; // DATA - std::string path_; //!< (Standard) path - size_t blockSize_; //!< Size of the block memory. - BlockMap* blocksMap_; //!< An array contains all blocksMap - size_t size_; //!< The file size - size_t idx_; //!< Index into the memory area - bool isMalloced_; //!< Was the blocksMap_ allocated? - bool eof_; //!< EOF indicator - Protocol protocol_; //!< the protocol of url - size_t totalRead_; //!< bytes requested from host + std::string path_; //!< (Standard) path + size_t blockSize_; //!< Size of the block memory. + BlockMap* blocksMap_{nullptr}; //!< An array contains all blocksMap + size_t size_{0}; //!< The file size + size_t idx_{0}; //!< Index into the memory area + bool isMalloced_{false}; //!< Was the blocksMap_ allocated? + bool eof_{false}; //!< EOF indicator + Protocol protocol_; //!< the protocol of url + size_t totalRead_{0}; //!< bytes requested from host // METHODS /*! @@ -1042,15 +1042,7 @@ class RemoteIo::Impl { }; // class RemoteIo::Impl RemoteIo::Impl::Impl(const std::string& url, size_t blockSize) : - path_(url), - blockSize_(blockSize), - blocksMap_(nullptr), - size_(0), - idx_(0), - isMalloced_(false), - eof_(false), - protocol_(fileProtocol(url)), - totalRead_(0) { + path_(url), blockSize_(blockSize), protocol_(fileProtocol(url)) { } size_t RemoteIo::Impl::populateBlocks(size_t lowBlock, size_t highBlock) { diff --git a/src/image.cpp b/src/image.cpp index 208fe9c2..b91ca3e7 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -116,17 +116,13 @@ std::string pathOfFileUrl(const std::string& url) { namespace Exiv2 { Image::Image(ImageType type, uint16_t supportedMetadata, BasicIo::UniquePtr io) : io_(std::move(io)), - pixelWidth_(0), - pixelHeight_(0), imageType_(type), supportedMetadata_(supportedMetadata), #ifdef EXV_HAVE_XMP_TOOLKIT - writeXmpFromPacket_(false), + writeXmpFromPacket_(false) { #else - writeXmpFromPacket_(true), + writeXmpFromPacket_(true) { #endif - byteOrder_(invalidByteOrder), - init_(true) { } void Image::printStructure(std::ostream&, PrintStructureOption, int /*depth*/) { diff --git a/src/preview.cpp b/src/preview.cpp index c13e0c5d..2d578006 100644 --- a/src/preview.cpp +++ b/src/preview.cpp @@ -101,16 +101,16 @@ class Loader { const Image& image_; //! Preview image width - size_t width_; + size_t width_{0}; //! Preview image length - size_t height_; + size_t height_{0}; //! Preview image size in bytes - size_t size_; + size_t size_{0}; //! True if the source image contains a preview image of given type - bool valid_; + bool valid_{false}; }; //! Loader for native previews @@ -163,7 +163,7 @@ class LoaderExifJpeg : public Loader { static const Param param_[]; //! Offset value - size_t offset_; + size_t offset_{0}; }; //! Function to create new LoaderExifJpeg @@ -335,8 +335,7 @@ Loader::UniquePtr Loader::create(PreviewId id, const Image& image) { return loader; } -Loader::Loader(PreviewId id, const Image& image) : - id_(id), image_(image), width_(0), height_(0), size_(0), valid_(false) { +Loader::Loader(PreviewId id, const Image& image) : id_(id), image_(image) { } PreviewProperties Loader::getProperties() const { @@ -457,7 +456,7 @@ bool LoaderNative::readDimensions() { return true; } -LoaderExifJpeg::LoaderExifJpeg(PreviewId id, const Image& image, int parIdx) : Loader(id, image), offset_(0) { +LoaderExifJpeg::LoaderExifJpeg(PreviewId id, const Image& image, int parIdx) : Loader(id, image) { const ExifData& exifData = image_.exifData(); auto pos = exifData.findKey(ExifKey(param_[parIdx].offsetKey_)); if (pos != exifData.end() && pos->count() > 0) { diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 903391ba..f488c5e6 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -28,7 +28,7 @@ bool TiffMappingInfo::operator==(const TiffMappingInfo::Key& key) const { } IoWrapper::IoWrapper(BasicIo& io, const byte* pHeader, size_t size, OffsetWriter* pow) : - io_(io), pHeader_(pHeader), size_(size), wroteHeader_(false), pow_(pow) { + io_(io), pHeader_(pHeader), size_(size), pow_(pow) { if (!pHeader_ || size_ == 0) wroteHeader_ = true; } @@ -73,7 +73,7 @@ TiffMnEntry::TiffMnEntry(uint16_t tag, IfdId group, IfdId mnGroup) : } TiffIfdMakernote::TiffIfdMakernote(uint16_t tag, IfdId group, IfdId mnGroup, MnHeader* pHeader, bool hasNext) : - TiffComponent(tag, group), pHeader_(pHeader), ifd_(tag, mnGroup, hasNext), imageByteOrder_(invalidByteOrder) { + TiffComponent(tag, group), pHeader_(pHeader), ifd_(tag, mnGroup, hasNext) { } TiffBinaryArray::TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg* arrayCfg, const ArrayDef* arrayDef, @@ -90,8 +90,7 @@ TiffBinaryArray::TiffBinaryArray(uint16_t tag, IfdId group, const ArraySet* arra // We'll figure out the correct cfg later } -TiffBinaryElement::TiffBinaryElement(uint16_t tag, IfdId group) : - TiffEntryBase(tag, group), elByteOrder_(invalidByteOrder) { +TiffBinaryElement::TiffBinaryElement(uint16_t tag, IfdId group) : TiffEntryBase(tag, group) { elDef_.idx_ = 0; elDef_.tiffType_ = ttUndefined; elDef_.count_ = 0; diff --git a/src/tiffcomposite_int.hpp b/src/tiffcomposite_int.hpp index f18ee31f..0f8a04a2 100644 --- a/src/tiffcomposite_int.hpp +++ b/src/tiffcomposite_int.hpp @@ -134,12 +134,12 @@ class IoWrapper { private: // DATA - BasicIo& io_; //! Reference for the IO instance. - const byte* pHeader_; //! Pointer to the header data. - size_t size_; //! Size of the header data. - bool wroteHeader_; //! Indicates if the header has been written. - OffsetWriter* pow_; //! Pointer to an offset-writer, if any, or 0 -}; // class IoWrapper + BasicIo& io_; //! Reference for the IO instance. + const byte* pHeader_; //! Pointer to the header data. + size_t size_; //! Size of the header data. + bool wroteHeader_{false}; //! Indicates if the header has been written. + OffsetWriter* pow_; //! Pointer to an offset-writer, if any, or 0 +}; // class IoWrapper /*! @brief Interface class for components of a TIFF directory hierarchy @@ -1229,10 +1229,10 @@ class TiffIfdMakernote : public TiffComponent { private: // DATA - MnHeader* pHeader_; //!< Makernote header - TiffDirectory ifd_; //!< Makernote IFD - uint32_t mnOffset_{}; //!< Makernote offset - ByteOrder imageByteOrder_; //!< Byte order for the image + MnHeader* pHeader_; //!< Makernote header + TiffDirectory ifd_; //!< Makernote IFD + uint32_t mnOffset_{}; //!< Makernote offset + ByteOrder imageByteOrder_{invalidByteOrder}; //!< Byte order for the image }; // class TiffIfdMakernote @@ -1496,8 +1496,8 @@ class TiffBinaryElement : public TiffEntryBase { private: // DATA - ArrayDef elDef_; //!< The array element definition - ByteOrder elByteOrder_; //!< Byte order to read/write the element + ArrayDef elDef_; //!< The array element definition + ByteOrder elByteOrder_{invalidByteOrder}; //!< Byte order to read/write the element }; // class TiffBinaryElement diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp index fadf8c80..1e6938d4 100644 --- a/src/tiffimage.cpp +++ b/src/tiffimage.cpp @@ -39,7 +39,7 @@ namespace Exiv2 { using namespace Internal; TiffImage::TiffImage(BasicIo::UniquePtr io, bool /*create*/) : - Image(ImageType::tiff, mdExif | mdIptc | mdXmp, std::move(io)), pixelWidthPrimary_(0), pixelHeightPrimary_(0) { + Image(ImageType::tiff, mdExif | mdIptc | mdXmp, std::move(io)) { } // TiffImage::TiffImage //! Structure for TIFF compression to MIME type mappings diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index b7a39ceb..61ea1d29 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -193,8 +193,7 @@ TiffDecoder::TiffDecoder(ExifData& exifData, IptcData& iptcData, XmpData& xmpDat iptcData_(iptcData), xmpData_(xmpData), pRoot_(pRoot), - findDecoderFct_(std::move(findDecoderFct)), - decodedIptc_(false) { + findDecoderFct_(std::move(findDecoderFct)) { // #1402 Fujifilm RAF. Search for the make // Find camera make in existing metadata (read from the JPEG) ExifKey key("Exif.Image.Make"); @@ -454,15 +453,11 @@ TiffEncoder::TiffEncoder(ExifData exifData, const IptcData& iptcData, const XmpD exifData_(std::move(exifData)), iptcData_(iptcData), xmpData_(xmpData), - del_(true), pHeader_(pHeader), pRoot_(pRoot), isNewImage_(isNewImage), pPrimaryGroups_(pPrimaryGroups), - pSourceTree_(nullptr), - findEncoderFct_(std::move(findEncoderFct)), - dirty_(false), - writeMethod_(wmNonIntrusive) { + findEncoderFct_(std::move(findEncoderFct)) { byteOrder_ = pHeader->byteOrder(); origByteOrder_ = byteOrder_; @@ -994,13 +989,7 @@ void TiffEncoder::add(TiffComponent* pRootDir, TiffComponent* pSourceDir, uint32 } // TiffEncoder::add TiffReader::TiffReader(const byte* pData, size_t size, TiffComponent* pRoot, TiffRwState state) : - pData_(pData), - size_(size), - pLast_(pData + size), - pRoot_(pRoot), - origState_(state), - mnState_(state), - postProc_(false) { + pData_(pData), size_(size), pLast_(pData + size), pRoot_(pRoot), origState_(state), mnState_(state) { pState_ = &origState_; } // TiffReader::TiffReader diff --git a/src/tiffvisitor_int.hpp b/src/tiffvisitor_int.hpp index 8dceb456..40fbc45a 100644 --- a/src/tiffvisitor_int.hpp +++ b/src/tiffvisitor_int.hpp @@ -317,7 +317,7 @@ class TiffDecoder : public TiffVisitor { TiffComponent* pRoot_; //!< Root element of the composite FindDecoderFct findDecoderFct_; //!< Ptr to the function to find special decoding functions std::string make_; //!< Camera make, determined from the tags to decode - bool decodedIptc_; //!< Indicates if IPTC has been decoded yet + bool decodedIptc_{false}; //!< Indicates if IPTC has been decoded yet }; // class TiffDecoder @@ -503,21 +503,21 @@ class TiffEncoder : public TiffVisitor { //@} // DATA - ExifData exifData_; //!< Copy of the Exif data to encode - const IptcData& iptcData_; //!< IPTC data to encode, just a reference - const XmpData& xmpData_; //!< XMP data to encode, just a reference - bool del_; //!< Indicates if Exif data entries should be deleted after encoding - const TiffHeaderBase* pHeader_; //!< TIFF image header - TiffComponent* pRoot_; //!< Root element of the composite - const bool isNewImage_; //!< True if the TIFF image is created from scratch - const PrimaryGroups* pPrimaryGroups_; //!< List of primary image groups - TiffComponent* pSourceTree_; //!< Parsed source tree for reference - ByteOrder byteOrder_; //!< Byteorder for encoding - ByteOrder origByteOrder_; //!< Byteorder as set in the c'tor - const FindEncoderFct findEncoderFct_; //!< Ptr to the function to find special encoding functions - std::string make_; //!< Camera make, determined from the tags to encode - bool dirty_; //!< Signals if any tag is deleted or allocated - WriteMethod writeMethod_; //!< Write method used. + ExifData exifData_; //!< Copy of the Exif data to encode + const IptcData& iptcData_; //!< IPTC data to encode, just a reference + const XmpData& xmpData_; //!< XMP data to encode, just a reference + bool del_{true}; //!< Indicates if Exif data entries should be deleted after encoding + const TiffHeaderBase* pHeader_; //!< TIFF image header + TiffComponent* pRoot_; //!< Root element of the composite + bool isNewImage_; //!< True if the TIFF image is created from scratch + const PrimaryGroups* pPrimaryGroups_; //!< List of primary image groups + TiffComponent* pSourceTree_{nullptr}; //!< Parsed source tree for reference + ByteOrder byteOrder_; //!< Byteorder for encoding + ByteOrder origByteOrder_; //!< Byteorder as set in the c'tor + FindEncoderFct findEncoderFct_; //!< Ptr to the function to find special encoding functions + std::string make_; //!< Camera make, determined from the tags to encode + bool dirty_{false}; //!< Signals if any tag is deleted or allocated + WriteMethod writeMethod_{wmNonIntrusive}; //!< Write method used. }; // class TiffEncoder @@ -669,7 +669,7 @@ class TiffReader : public TiffVisitor { DirList dirList_; //!< List of IFD pointers and their groups IdxSeq idxSeq_; //!< Sequences for group, used for the entry's idx PostList postList_; //!< List of components with deferred reading - bool postProc_; //!< True in postProcessList() + bool postProc_{false}; //!< True in postProcessList() }; // class TiffReader } // namespace Internal diff --git a/src/value.cpp b/src/value.cpp index 526c57e7..06880825 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -15,7 +15,7 @@ // ***************************************************************************** // class member definitions namespace Exiv2 { -Value::Value(TypeId typeId) : ok_(true), type_(typeId) { +Value::Value(TypeId typeId) : type_(typeId) { } Value::UniquePtr Value::create(TypeId typeId) { @@ -448,7 +448,7 @@ CommentValue* CommentValue::clone_() const { return new CommentValue(*this); } -XmpValue::XmpValue(TypeId typeId) : Value(typeId), xmpArrayType_(xaNone), xmpStruct_(xsNone) { +XmpValue::XmpValue(TypeId typeId) : Value(typeId) { } void XmpValue::setXmpArrayType(XmpArrayType xmpArrayType) {