clang-tidy: use default member init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 3 years ago
parent 8a9f6ac2b8
commit bae7da19ca

@ -737,7 +737,7 @@ class EXIV2API XPathIo : public FileIo {
private: private:
// True if the file is a temporary file and it should be deleted in destructor. // True if the file is a temporary file and it should be deleted in destructor.
bool isTemp_; bool isTemp_{true};
std::string tempFilePath_; std::string tempFilePath_;
}; // class XPathIo }; // class XPathIo
#endif #endif

@ -467,8 +467,8 @@ class EXIV2API Image {
DataBuf iccProfile_; //!< ICC buffer (binary data) DataBuf iccProfile_; //!< ICC buffer (binary data)
std::string comment_; //!< User comment std::string comment_; //!< User comment
std::string xmpPacket_; //!< XMP packet std::string xmpPacket_; //!< XMP packet
uint32_t pixelWidth_; //!< image pixel width uint32_t pixelWidth_{0}; //!< image pixel width
uint32_t pixelHeight_; //!< image pixel height uint32_t pixelHeight_{0}; //!< image pixel height
NativePreviewList nativePreviews_; //!< list of native previews NativePreviewList nativePreviews_; //!< list of native previews
//! Return tag name for given tag id. //! Return tag name for given tag id.
@ -482,10 +482,10 @@ class EXIV2API Image {
ImageType imageType_; //!< Image type ImageType imageType_; //!< Image type
uint16_t supportedMetadata_; //!< Bitmap with all supported metadata types uint16_t supportedMetadata_; //!< Bitmap with all supported metadata types
bool writeXmpFromPacket_; //!< Determines the source when writing XMP bool writeXmpFromPacket_; //!< Determines the source when writing XMP
ByteOrder byteOrder_; //!< Byte order ByteOrder byteOrder_{invalidByteOrder}; //!< Byte order
std::map<int, std::string> tags_; //!< Map of tags std::map<int, std::string> 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 }; // class Image

@ -87,8 +87,8 @@ class EXIV2API TiffImage : public Image {
// DATA // DATA
mutable std::string primaryGroup_; //!< The primary group mutable std::string primaryGroup_; //!< The primary group
mutable std::string mimeType_; //!< The MIME type mutable std::string mimeType_; //!< The MIME type
mutable uint32_t pixelWidthPrimary_; //!< Width of the primary image in pixels mutable uint32_t pixelWidthPrimary_{0}; //!< Width of the primary image in pixels
mutable uint32_t pixelHeightPrimary_; //!< Height of the primary image in pixels mutable uint32_t pixelHeightPrimary_{0}; //!< Height of the primary image in pixels
}; // class TiffImage }; // class TiffImage

@ -229,7 +229,7 @@ class EXIV2API Value {
*/ */
Value& operator=(const Value&) = default; Value& operator=(const Value&) = default;
// DATA // DATA
mutable bool ok_; //!< Indicates the status of the previous to<Type> conversion mutable bool ok_{true}; //!< Indicates the status of the previous to<Type> conversion
private: private:
//! Internal virtual copy constructor. //! Internal virtual copy constructor.
@ -648,8 +648,8 @@ class EXIV2API XmpValue : public Value {
private: private:
// DATA // DATA
XmpArrayType xmpArrayType_; //!< Type of XMP array XmpArrayType xmpArrayType_{xaNone}; //!< Type of XMP array
XmpStruct xmpStruct_; //!< XMP structure indicator XmpStruct xmpStruct_{xsNone}; //!< XMP structure indicator
}; // class XmpValue }; // class XmpValue

@ -899,7 +899,7 @@ void XPathIo::ReadDataUri(const std::string& path) {
} }
#else #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(); tempFilePath_ = path();
} }
@ -994,13 +994,13 @@ class RemoteIo::Impl {
// 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.
BlockMap* blocksMap_; //!< An array contains all blocksMap BlockMap* blocksMap_{nullptr}; //!< An array contains all blocksMap
size_t size_; //!< The file size size_t size_{0}; //!< The file size
size_t idx_; //!< Index into the memory area size_t idx_{0}; //!< Index into the memory area
bool isMalloced_; //!< Was the blocksMap_ allocated? bool isMalloced_{false}; //!< Was the blocksMap_ allocated?
bool eof_; //!< EOF indicator bool eof_{false}; //!< EOF indicator
Protocol protocol_; //!< the protocol of url Protocol protocol_; //!< the protocol of url
size_t totalRead_; //!< bytes requested from host size_t totalRead_{0}; //!< bytes requested from host
// METHODS // METHODS
/*! /*!
@ -1042,15 +1042,7 @@ class RemoteIo::Impl {
}; // class RemoteIo::Impl }; // class RemoteIo::Impl
RemoteIo::Impl::Impl(const std::string& url, size_t blockSize) : RemoteIo::Impl::Impl(const std::string& url, size_t blockSize) :
path_(url), path_(url), blockSize_(blockSize), protocol_(fileProtocol(url)) {
blockSize_(blockSize),
blocksMap_(nullptr),
size_(0),
idx_(0),
isMalloced_(false),
eof_(false),
protocol_(fileProtocol(url)),
totalRead_(0) {
} }
size_t RemoteIo::Impl::populateBlocks(size_t lowBlock, size_t highBlock) { size_t RemoteIo::Impl::populateBlocks(size_t lowBlock, size_t highBlock) {

@ -116,17 +116,13 @@ std::string pathOfFileUrl(const std::string& url) {
namespace Exiv2 { namespace Exiv2 {
Image::Image(ImageType type, uint16_t supportedMetadata, BasicIo::UniquePtr io) : Image::Image(ImageType type, uint16_t supportedMetadata, BasicIo::UniquePtr io) :
io_(std::move(io)), io_(std::move(io)),
pixelWidth_(0),
pixelHeight_(0),
imageType_(type), imageType_(type),
supportedMetadata_(supportedMetadata), supportedMetadata_(supportedMetadata),
#ifdef EXV_HAVE_XMP_TOOLKIT #ifdef EXV_HAVE_XMP_TOOLKIT
writeXmpFromPacket_(false), writeXmpFromPacket_(false) {
#else #else
writeXmpFromPacket_(true), writeXmpFromPacket_(true) {
#endif #endif
byteOrder_(invalidByteOrder),
init_(true) {
} }
void Image::printStructure(std::ostream&, PrintStructureOption, int /*depth*/) { void Image::printStructure(std::ostream&, PrintStructureOption, int /*depth*/) {

@ -101,16 +101,16 @@ class Loader {
const Image& image_; const Image& image_;
//! Preview image width //! Preview image width
size_t width_; size_t width_{0};
//! Preview image length //! Preview image length
size_t height_; size_t height_{0};
//! Preview image size in bytes //! Preview image size in bytes
size_t size_; size_t size_{0};
//! True if the source image contains a preview image of given type //! True if the source image contains a preview image of given type
bool valid_; bool valid_{false};
}; };
//! Loader for native previews //! Loader for native previews
@ -163,7 +163,7 @@ class LoaderExifJpeg : public Loader {
static const Param param_[]; static const Param param_[];
//! Offset value //! Offset value
size_t offset_; size_t offset_{0};
}; };
//! Function to create new LoaderExifJpeg //! Function to create new LoaderExifJpeg
@ -335,8 +335,7 @@ Loader::UniquePtr Loader::create(PreviewId id, const Image& image) {
return loader; return loader;
} }
Loader::Loader(PreviewId id, const Image& image) : Loader::Loader(PreviewId id, const Image& image) : id_(id), image_(image) {
id_(id), image_(image), width_(0), height_(0), size_(0), valid_(false) {
} }
PreviewProperties Loader::getProperties() const { PreviewProperties Loader::getProperties() const {
@ -457,7 +456,7 @@ bool LoaderNative::readDimensions() {
return true; 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(); const ExifData& exifData = image_.exifData();
auto pos = exifData.findKey(ExifKey(param_[parIdx].offsetKey_)); auto pos = exifData.findKey(ExifKey(param_[parIdx].offsetKey_));
if (pos != exifData.end() && pos->count() > 0) { if (pos != exifData.end() && pos->count() > 0) {

@ -28,7 +28,7 @@ bool TiffMappingInfo::operator==(const TiffMappingInfo::Key& key) const {
} }
IoWrapper::IoWrapper(BasicIo& io, const byte* pHeader, size_t size, OffsetWriter* pow) : 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) if (!pHeader_ || size_ == 0)
wroteHeader_ = true; 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) : 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, 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 // We'll figure out the correct cfg later
} }
TiffBinaryElement::TiffBinaryElement(uint16_t tag, IfdId group) : TiffBinaryElement::TiffBinaryElement(uint16_t tag, IfdId group) : TiffEntryBase(tag, group) {
TiffEntryBase(tag, group), elByteOrder_(invalidByteOrder) {
elDef_.idx_ = 0; elDef_.idx_ = 0;
elDef_.tiffType_ = ttUndefined; elDef_.tiffType_ = ttUndefined;
elDef_.count_ = 0; elDef_.count_ = 0;

@ -137,7 +137,7 @@ class IoWrapper {
BasicIo& io_; //! Reference for the IO instance. BasicIo& io_; //! Reference for the IO instance.
const byte* pHeader_; //! Pointer to the header data. const byte* pHeader_; //! Pointer to the header data.
size_t size_; //! Size of the header data. size_t size_; //! Size of the header data.
bool wroteHeader_; //! Indicates if the header has been written. bool wroteHeader_{false}; //! Indicates if the header has been written.
OffsetWriter* pow_; //! Pointer to an offset-writer, if any, or 0 OffsetWriter* pow_; //! Pointer to an offset-writer, if any, or 0
}; // class IoWrapper }; // class IoWrapper
@ -1232,7 +1232,7 @@ class TiffIfdMakernote : public TiffComponent {
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_{invalidByteOrder}; //!< Byte order for the image
}; // class TiffIfdMakernote }; // class TiffIfdMakernote
@ -1497,7 +1497,7 @@ class TiffBinaryElement : public TiffEntryBase {
private: private:
// DATA // DATA
ArrayDef elDef_; //!< The array element definition ArrayDef elDef_; //!< The array element definition
ByteOrder elByteOrder_; //!< Byte order to read/write the element ByteOrder elByteOrder_{invalidByteOrder}; //!< Byte order to read/write the element
}; // class TiffBinaryElement }; // class TiffBinaryElement

@ -39,7 +39,7 @@ namespace Exiv2 {
using namespace Internal; using namespace Internal;
TiffImage::TiffImage(BasicIo::UniquePtr io, bool /*create*/) : 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 } // TiffImage::TiffImage
//! Structure for TIFF compression to MIME type mappings //! Structure for TIFF compression to MIME type mappings

@ -193,8 +193,7 @@ TiffDecoder::TiffDecoder(ExifData& exifData, IptcData& iptcData, XmpData& xmpDat
iptcData_(iptcData), iptcData_(iptcData),
xmpData_(xmpData), xmpData_(xmpData),
pRoot_(pRoot), pRoot_(pRoot),
findDecoderFct_(std::move(findDecoderFct)), findDecoderFct_(std::move(findDecoderFct)) {
decodedIptc_(false) {
// #1402 Fujifilm RAF. Search for the make // #1402 Fujifilm RAF. Search for the make
// Find camera make in existing metadata (read from the JPEG) // Find camera make in existing metadata (read from the JPEG)
ExifKey key("Exif.Image.Make"); ExifKey key("Exif.Image.Make");
@ -454,15 +453,11 @@ TiffEncoder::TiffEncoder(ExifData exifData, const IptcData& iptcData, const XmpD
exifData_(std::move(exifData)), exifData_(std::move(exifData)),
iptcData_(iptcData), iptcData_(iptcData),
xmpData_(xmpData), xmpData_(xmpData),
del_(true),
pHeader_(pHeader), pHeader_(pHeader),
pRoot_(pRoot), pRoot_(pRoot),
isNewImage_(isNewImage), isNewImage_(isNewImage),
pPrimaryGroups_(pPrimaryGroups), pPrimaryGroups_(pPrimaryGroups),
pSourceTree_(nullptr), findEncoderFct_(std::move(findEncoderFct)) {
findEncoderFct_(std::move(findEncoderFct)),
dirty_(false),
writeMethod_(wmNonIntrusive) {
byteOrder_ = pHeader->byteOrder(); byteOrder_ = pHeader->byteOrder();
origByteOrder_ = byteOrder_; origByteOrder_ = byteOrder_;
@ -994,13 +989,7 @@ void TiffEncoder::add(TiffComponent* pRootDir, TiffComponent* pSourceDir, uint32
} // TiffEncoder::add } // TiffEncoder::add
TiffReader::TiffReader(const byte* pData, size_t size, TiffComponent* pRoot, TiffRwState state) : TiffReader::TiffReader(const byte* pData, size_t size, TiffComponent* pRoot, TiffRwState state) :
pData_(pData), pData_(pData), size_(size), pLast_(pData + size), pRoot_(pRoot), origState_(state), mnState_(state) {
size_(size),
pLast_(pData + size),
pRoot_(pRoot),
origState_(state),
mnState_(state),
postProc_(false) {
pState_ = &origState_; pState_ = &origState_;
} // TiffReader::TiffReader } // TiffReader::TiffReader

@ -317,7 +317,7 @@ class TiffDecoder : public TiffVisitor {
TiffComponent* pRoot_; //!< Root element of the composite TiffComponent* pRoot_; //!< Root element of the composite
FindDecoderFct findDecoderFct_; //!< Ptr to the function to find special decoding functions FindDecoderFct findDecoderFct_; //!< Ptr to the function to find special decoding functions
std::string make_; //!< Camera make, determined from the tags to decode 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 }; // class TiffDecoder
@ -506,18 +506,18 @@ class TiffEncoder : public TiffVisitor {
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
const XmpData& xmpData_; //!< XMP 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 bool del_{true}; //!< Indicates if Exif data entries should be deleted after encoding
const TiffHeaderBase* pHeader_; //!< TIFF image header const TiffHeaderBase* pHeader_; //!< TIFF image header
TiffComponent* pRoot_; //!< Root element of the composite TiffComponent* pRoot_; //!< Root element of the composite
const bool isNewImage_; //!< True if the TIFF image is created from scratch bool isNewImage_; //!< True if the TIFF image is created from scratch
const PrimaryGroups* pPrimaryGroups_; //!< List of primary image groups const PrimaryGroups* pPrimaryGroups_; //!< List of primary image groups
TiffComponent* pSourceTree_; //!< Parsed source tree for reference TiffComponent* pSourceTree_{nullptr}; //!< Parsed source tree for reference
ByteOrder byteOrder_; //!< Byteorder for encoding ByteOrder byteOrder_; //!< Byteorder for encoding
ByteOrder origByteOrder_; //!< Byteorder as set in the c'tor ByteOrder origByteOrder_; //!< Byteorder as set in the c'tor
const FindEncoderFct findEncoderFct_; //!< Ptr to the function to find special encoding functions FindEncoderFct findEncoderFct_; //!< Ptr to the function to find special encoding functions
std::string make_; //!< Camera make, determined from the tags to encode std::string make_; //!< Camera make, determined from the tags to encode
bool dirty_; //!< Signals if any tag is deleted or allocated bool dirty_{false}; //!< Signals if any tag is deleted or allocated
WriteMethod writeMethod_; //!< Write method used. WriteMethod writeMethod_{wmNonIntrusive}; //!< Write method used.
}; // class TiffEncoder }; // class TiffEncoder
@ -669,7 +669,7 @@ class TiffReader : public TiffVisitor {
DirList dirList_; //!< List of IFD pointers and their groups DirList dirList_; //!< List of IFD pointers and their groups
IdxSeq idxSeq_; //!< Sequences for group, used for the entry's idx IdxSeq idxSeq_; //!< Sequences for group, used for the entry's idx
PostList postList_; //!< List of components with deferred reading PostList postList_; //!< List of components with deferred reading
bool postProc_; //!< True in postProcessList() bool postProc_{false}; //!< True in postProcessList()
}; // class TiffReader }; // class TiffReader
} // namespace Internal } // namespace Internal

@ -15,7 +15,7 @@
// ***************************************************************************** // *****************************************************************************
// class member definitions // class member definitions
namespace Exiv2 { namespace Exiv2 {
Value::Value(TypeId typeId) : ok_(true), type_(typeId) { Value::Value(TypeId typeId) : type_(typeId) {
} }
Value::UniquePtr Value::create(TypeId typeId) { Value::UniquePtr Value::create(TypeId typeId) {
@ -448,7 +448,7 @@ CommentValue* CommentValue::clone_() const {
return new CommentValue(*this); 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) { void XmpValue::setXmpArrayType(XmpArrayType xmpArrayType) {

Loading…
Cancel
Save