Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy: default member init #2211

Merged
merged 3 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
27 changes: 6 additions & 21 deletions app/exiv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -1453,9 +1437,10 @@ bool parseLine(ModifyCmd& modifyCmd, const std::string& line, int num) {

CmdId commandId(const std::string& cmdString) {
int i = 0;
for (; cmdIdAndString[i].cmdId_ != invalidCmdId && cmdIdAndString[i].cmdString_ != cmdString; ++i) {
while (cmdIdAndString[i].first != invalidCmdId && cmdIdAndString[i].second != cmdString) {
++i;
}
return cmdIdAndString[i].cmdId_;
return cmdIdAndString[i].first;
}

std::string parseEscapes(const std::string& input) {
Expand Down
56 changes: 25 additions & 31 deletions app/exiv2app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,19 @@ 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
using ModifyCmds = std::vector<ModifyCmd>;
//! Structure to link command identifiers to strings
struct CmdIdAndString {
CmdId cmdId_; //!< Commands identifier
std::string cmdString_; //!< Command string
};

using CmdIdAndString = std::pair<CmdId, std::string>;
/*!
@brief Implements the command line handling for the program.

Expand Down Expand Up @@ -182,28 +176,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
Expand All @@ -219,7 +213,7 @@ class Params : public Util::Getopt {
Exiv2::DataBuf stdinBuf; //!< DataBuf with the binary bytes from stdin

private:
bool first_;
bool first_{true};

Params();

Expand Down
3 changes: 0 additions & 3 deletions app/getopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/getopt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -96,7 +96,7 @@ class Getopt {

private:
std::string progname_;
int errcnt_;
int errcnt_{0};
};

}; // namespace Util
Expand Down
2 changes: 1 addition & 1 deletion include/exiv2/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions src/tags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ void ExifTags::taglist(std::ostream& os, const std::string& groupName) {

//! %Internal Pimpl structure with private members and data of class ExifKey.
struct ExifKey::Impl {
//! @name Creators
//@{
Impl() = default; //!< Default constructor
//@}

//! @name Manipulators
//@{
/*!
Expand Down
4 changes: 2 additions & 2 deletions src/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down