diff --git a/app/actions.hpp b/app/actions.hpp index db8abe0c..809b8150 100644 --- a/app/actions.hpp +++ b/app/actions.hpp @@ -162,7 +162,7 @@ class Print : public Task { @return 1 if a line was written, 0 if the information was not found. */ int printTag(const Exiv2::ExifData& exifData, EasyAccessFct easyAccessFct, const std::string& label = "", - EasyAccessFct easyAccessFctFallback = NULL) const; + EasyAccessFct easyAccessFctFallback = nullptr) const; private: std::string path_; diff --git a/app/exiv2.cpp b/app/exiv2.cpp index 84459f60..126ca154 100644 --- a/app/exiv2.cpp +++ b/app/exiv2.cpp @@ -176,26 +176,10 @@ int main(int argc, char* const argv[]) { Params::Params() : optstring_(":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:"), - help_(false), - version_(false), - verbose_(false), - force_(false), - binary_(false), - unknown_(true), - preserve_(false), - timestamp_(false), - timestampOnly_(false), - fileExistsPolicy_(askPolicy), - adjust_(false), - printMode_(pmSummary), - printItems_(0), - printTags_(Exiv2::mdNone), - action_(0), + target_(ctExif | ctIptc | ctComment | ctXmp), - adjustment_(0), - format_("%Y%m%d_%H%M%S"), - formatSet_(false), - first_(true) { + + format_("%Y%m%d_%H%M%S") { yodAdjust_[yodYear] = emptyYodAdjust_[yodYear]; yodAdjust_[yodMonth] = emptyYodAdjust_[yodMonth]; yodAdjust_[yodDay] = emptyYodAdjust_[yodDay]; diff --git a/app/exiv2app.hpp b/app/exiv2app.hpp index e0628bf6..1f1fd2a4 100644 --- a/app/exiv2app.hpp +++ b/app/exiv2app.hpp @@ -39,15 +39,13 @@ enum MetadataId { //! Structure for one parsed modification command struct ModifyCmd { //! C'tor - ModifyCmd() : - cmdId_(invalidCmdId), metadataId_(invalidMetadataId), typeId_(Exiv2::invalidTypeId), explicitType_(false) { - } - CmdId cmdId_; //!< Command identifier - std::string key_; //!< Exiv2 key string - MetadataId metadataId_; //!< Metadata identifier - Exiv2::TypeId typeId_; //!< Exiv2 type identifier + ModifyCmd() = default; + CmdId cmdId_{invalidCmdId}; //!< Command identifier + std::string key_; //!< Exiv2 key string + MetadataId metadataId_{invalidMetadataId}; //!< Metadata identifier + Exiv2::TypeId typeId_{Exiv2::invalidTypeId}; //!< Exiv2 type identifier //! Flag to indicate if the type was explicitly specified (true) - bool explicitType_; + bool explicitType_{false}; std::string value_; //!< Data }; //! Container for modification commands @@ -182,28 +180,28 @@ class Params : public Util::Getopt { long adjustment_; //!< Adjustment value. }; - bool help_; //!< Help option flag. - bool version_; //!< Version option flag. - bool verbose_; //!< Verbose (talkative) option flag. - bool force_; //!< Force overwrites flag. - bool binary_; //!< Suppress long binary values. - bool unknown_; //!< Suppress unknown tags. - bool preserve_; //!< Preserve timestamps flag. - bool timestamp_; //!< Rename also sets the file timestamp. - bool timestampOnly_; //!< Rename only sets the file timestamp. - FileExistsPolicy fileExistsPolicy_; //!< What to do if file to rename exists. - bool adjust_; //!< Adjustment flag. - PrintMode printMode_; //!< Print mode. - unsigned long printItems_; //!< Print items. - unsigned long printTags_; //!< Print tags (bitmap of MetadataId flags). + bool help_{false}; //!< Help option flag. + bool version_{false}; //!< Version option flag. + bool verbose_{false}; //!< Verbose (talkative) option flag. + bool force_{false}; //!< Force overwrites flag. + bool binary_{false}; //!< Suppress long binary values. + bool unknown_{true}; //!< Suppress unknown tags. + bool preserve_{false}; //!< Preserve timestamps flag. + bool timestamp_{false}; //!< Rename also sets the file timestamp. + bool timestampOnly_{false}; //!< Rename only sets the file timestamp. + FileExistsPolicy fileExistsPolicy_{askPolicy}; //!< What to do if file to rename exists. + bool adjust_{false}; //!< Adjustment flag. + PrintMode printMode_{pmSummary}; //!< Print mode. + unsigned long printItems_{0}; //!< Print items. + unsigned long printTags_{Exiv2::mdNone}; //!< Print tags (bitmap of MetadataId flags). //! %Action (integer rather than TaskType to avoid dependency). - int action_; + int action_{0}; int target_; //!< What common target to process. - long adjustment_; //!< Adjustment in seconds. + long adjustment_{0}; //!< Adjustment in seconds. YodAdjust yodAdjust_[3]; //!< Year, month and day adjustment info. std::string format_; //!< Filename format (-r option arg). - bool formatSet_; //!< Whether the format is set with -r + bool formatSet_{false}; //!< Whether the format is set with -r CmdFiles cmdFiles_; //!< Names of the modification command files CmdLines cmdLines_; //!< Commands from the command line ModifyCmds modifyCmds_; //!< Parsed modification commands @@ -219,7 +217,7 @@ class Params : public Util::Getopt { Exiv2::DataBuf stdinBuf; //!< DataBuf with the binary bytes from stdin private: - bool first_; + bool first_{true}; Params(); diff --git a/app/getopt.cpp b/app/getopt.cpp index d8a57c26..6081657c 100644 --- a/app/getopt.cpp +++ b/app/getopt.cpp @@ -79,9 +79,6 @@ int getopt(int argc, char* const argv[], const char* optstring) { // ***************************************************************************** // class Getopt -Getopt::Getopt() : errcnt_(0) { -} - int Getopt::getopt(int argc, char* const argv[], const std::string& optstring) { progname_ = fs::path(argv[0]).filename().string(); Util::optind = 0; // reset the Util::Getopt scanner diff --git a/app/getopt.hpp b/app/getopt.hpp index 2b553a5d..d3ae6633 100644 --- a/app/getopt.hpp +++ b/app/getopt.hpp @@ -29,7 +29,7 @@ int getopt(int argc, char* const argv[], const char* optstring); class Getopt { public: //! Default constructor. - Getopt(); + Getopt() = default; //! Destructor. virtual ~Getopt() = default; @@ -96,7 +96,7 @@ class Getopt { private: std::string progname_; - int errcnt_; + int errcnt_{0}; }; }; // namespace Util diff --git a/include/exiv2/value.hpp b/include/exiv2/value.hpp index b22b47c9..44a6a380 100644 --- a/include/exiv2/value.hpp +++ b/include/exiv2/value.hpp @@ -582,7 +582,7 @@ class EXIV2API CommentValue : public StringValueBase { public: // DATA - ByteOrder byteOrder_; //!< Byte order of the comment string that was read + ByteOrder byteOrder_{littleEndian}; //!< Byte order of the comment string that was read }; // class CommentValue diff --git a/src/value.cpp b/src/value.cpp index 686b4fc9..5af114b0 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -330,10 +330,10 @@ CommentValue::CharsetId CommentValue::CharsetInfo::charsetIdByCode(const std::st return charsetTable_[i].charsetId_ == lastCharsetId ? invalidCharsetId : charsetTable_[i].charsetId_; } -CommentValue::CommentValue() : StringValueBase(Exiv2::undefined), byteOrder_(littleEndian) { +CommentValue::CommentValue() : StringValueBase(Exiv2::undefined) { } -CommentValue::CommentValue(const std::string& comment) : StringValueBase(Exiv2::undefined), byteOrder_(littleEndian) { +CommentValue::CommentValue(const std::string& comment) : StringValueBase(Exiv2::undefined) { read(comment); }