clang-tidy: use default member init

Found with modernize-use-default-member-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 4 years ago committed by Christoph Hasse
parent 17a8d743a5
commit e53548a95a

@ -992,10 +992,10 @@ namespace Exiv2 {
//! Simple Date helper structure //! Simple Date helper structure
struct EXIV2API Date { struct EXIV2API Date {
Date() : year(0), month(0), day(0) {} Date() = default;
int year; //!< Year int year{0}; //!< Year
int month; //!< Month int month{0}; //!< Month
int day; //!< Day int day{0}; //!< Day
}; };
//! @name Manipulators //! @name Manipulators
@ -1096,13 +1096,13 @@ namespace Exiv2 {
//! Simple Time helper structure //! Simple Time helper structure
struct Time struct Time
{ {
Time() : hour(0), minute(0), second(0), tzHour(0), tzMinute(0) {} Time() = default;
int hour; //!< Hour int hour{0}; //!< Hour
int minute; //!< Minute int minute{0}; //!< Minute
int second; //!< Second int second{0}; //!< Second
int tzHour; //!< Hours ahead or behind UTC int tzHour{0}; //!< Hours ahead or behind UTC
int tzMinute; //!< Minutes ahead or behind UTC int tzMinute{0}; //!< Minutes ahead or behind UTC
}; };
//! @name Manipulators //! @name Manipulators
@ -1321,9 +1321,9 @@ namespace Exiv2 {
// DATA // DATA
//! Pointer to the buffer, nullptr if none has been allocated //! Pointer to the buffer, nullptr if none has been allocated
byte* pDataArea_; byte* pDataArea_{nullptr};
//! The current size of the buffer //! The current size of the buffer
long sizeDataArea_; long sizeDataArea_{0};
}; // class ValueType }; // class ValueType
//! Unsigned short value type //! Unsigned short value type
@ -1493,28 +1493,24 @@ namespace Exiv2 {
return d2Data(buf, t, byteOrder); return d2Data(buf, t, byteOrder);
} }
template<typename T> template <typename T>
ValueType<T>::ValueType() ValueType<T>::ValueType() : Value(getType<T>())
: Value(getType<T>()), pDataArea_(nullptr), sizeDataArea_(0)
{ {
} }
template<typename T> template <typename T>
ValueType<T>::ValueType(TypeId typeId) ValueType<T>::ValueType(TypeId typeId) : Value(typeId)
: Value(typeId), pDataArea_(nullptr), sizeDataArea_(0)
{ {
} }
template<typename T> template <typename T>
ValueType<T>::ValueType(const byte* buf, long len, ByteOrder byteOrder, TypeId typeId) ValueType<T>::ValueType(const byte* buf, long len, ByteOrder byteOrder, TypeId typeId) : Value(typeId)
: Value(typeId), pDataArea_(nullptr), sizeDataArea_(0)
{ {
read(buf, len, byteOrder); read(buf, len, byteOrder);
} }
template<typename T> template <typename T>
ValueType<T>::ValueType(const T& val, TypeId typeId) ValueType<T>::ValueType(const T& val, TypeId typeId) : Value(typeId)
: Value(typeId), pDataArea_(nullptr), sizeDataArea_(0)
{ {
value_.push_back(val); value_.push_back(val);
} }
@ -1523,8 +1519,7 @@ namespace Exiv2 {
ValueType<T>::ValueType(const ValueType<T>& rhs) ValueType<T>::ValueType(const ValueType<T>& rhs)
: Value(rhs.typeId()) : Value(rhs.typeId())
, value_(rhs.value_) , value_(rhs.value_)
, pDataArea_(nullptr)
, sizeDataArea_(0)
{ {
if (rhs.sizeDataArea_ > 0) { if (rhs.sizeDataArea_ > 0) {
pDataArea_ = new byte[rhs.sizeDataArea_]; pDataArea_ = new byte[rhs.sizeDataArea_];

@ -166,7 +166,7 @@ namespace Exiv2 {
class EXIV2API XmpData { class EXIV2API XmpData {
public: public:
//! Default constructor //! Default constructor
XmpData() : xmpMetadata_(), xmpPacket_(), usePacket_(0) {} XmpData() = default;
//! XmpMetadata iterator type //! XmpMetadata iterator type
typedef XmpMetadata::iterator iterator; typedef XmpMetadata::iterator iterator;
@ -257,7 +257,7 @@ namespace Exiv2 {
// DATA // DATA
XmpMetadata xmpMetadata_; XmpMetadata xmpMetadata_;
std::string xmpPacket_ ; std::string xmpPacket_ ;
bool usePacket_ ; bool usePacket_{0};
}; // class XmpData }; // class XmpData
/*! /*!

Loading…
Cancel
Save