Skip to content

Commit a8061e7

Browse files
committed
clang-tidy: default member init
Signed-off-by: Rosen Penev <[email protected]>
1 parent 151b54a commit a8061e7

File tree

7 files changed

+33
-54
lines changed

7 files changed

+33
-54
lines changed

app/actions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class Print : public Task {
162162
@return 1 if a line was written, 0 if the information was not found.
163163
*/
164164
int printTag(const Exiv2::ExifData& exifData, EasyAccessFct easyAccessFct, const std::string& label = "",
165-
EasyAccessFct easyAccessFctFallback = NULL) const;
165+
EasyAccessFct easyAccessFctFallback = nullptr) const;
166166

167167
private:
168168
std::string path_;

app/exiv2.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -176,26 +176,10 @@ int main(int argc, char* const argv[]) {
176176

177177
Params::Params() :
178178
optstring_(":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:"),
179-
help_(false),
180-
version_(false),
181-
verbose_(false),
182-
force_(false),
183-
binary_(false),
184-
unknown_(true),
185-
preserve_(false),
186-
timestamp_(false),
187-
timestampOnly_(false),
188-
fileExistsPolicy_(askPolicy),
189-
adjust_(false),
190-
printMode_(pmSummary),
191-
printItems_(0),
192-
printTags_(Exiv2::mdNone),
193-
action_(0),
179+
194180
target_(ctExif | ctIptc | ctComment | ctXmp),
195-
adjustment_(0),
196-
format_("%Y%m%d_%H%M%S"),
197-
formatSet_(false),
198-
first_(true) {
181+
182+
format_("%Y%m%d_%H%M%S") {
199183
yodAdjust_[yodYear] = emptyYodAdjust_[yodYear];
200184
yodAdjust_[yodMonth] = emptyYodAdjust_[yodMonth];
201185
yodAdjust_[yodDay] = emptyYodAdjust_[yodDay];

app/exiv2app.hpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ enum MetadataId {
3939
//! Structure for one parsed modification command
4040
struct ModifyCmd {
4141
//! C'tor
42-
ModifyCmd() :
43-
cmdId_(invalidCmdId), metadataId_(invalidMetadataId), typeId_(Exiv2::invalidTypeId), explicitType_(false) {
44-
}
45-
CmdId cmdId_; //!< Command identifier
46-
std::string key_; //!< Exiv2 key string
47-
MetadataId metadataId_; //!< Metadata identifier
48-
Exiv2::TypeId typeId_; //!< Exiv2 type identifier
42+
ModifyCmd() = default;
43+
CmdId cmdId_{invalidCmdId}; //!< Command identifier
44+
std::string key_; //!< Exiv2 key string
45+
MetadataId metadataId_{invalidMetadataId}; //!< Metadata identifier
46+
Exiv2::TypeId typeId_{Exiv2::invalidTypeId}; //!< Exiv2 type identifier
4947
//! Flag to indicate if the type was explicitly specified (true)
50-
bool explicitType_;
48+
bool explicitType_{false};
5149
std::string value_; //!< Data
5250
};
5351
//! Container for modification commands
@@ -182,28 +180,28 @@ class Params : public Util::Getopt {
182180
long adjustment_; //!< Adjustment value.
183181
};
184182

185-
bool help_; //!< Help option flag.
186-
bool version_; //!< Version option flag.
187-
bool verbose_; //!< Verbose (talkative) option flag.
188-
bool force_; //!< Force overwrites flag.
189-
bool binary_; //!< Suppress long binary values.
190-
bool unknown_; //!< Suppress unknown tags.
191-
bool preserve_; //!< Preserve timestamps flag.
192-
bool timestamp_; //!< Rename also sets the file timestamp.
193-
bool timestampOnly_; //!< Rename only sets the file timestamp.
194-
FileExistsPolicy fileExistsPolicy_; //!< What to do if file to rename exists.
195-
bool adjust_; //!< Adjustment flag.
196-
PrintMode printMode_; //!< Print mode.
197-
unsigned long printItems_; //!< Print items.
198-
unsigned long printTags_; //!< Print tags (bitmap of MetadataId flags).
183+
bool help_{false}; //!< Help option flag.
184+
bool version_{false}; //!< Version option flag.
185+
bool verbose_{false}; //!< Verbose (talkative) option flag.
186+
bool force_{false}; //!< Force overwrites flag.
187+
bool binary_{false}; //!< Suppress long binary values.
188+
bool unknown_{true}; //!< Suppress unknown tags.
189+
bool preserve_{false}; //!< Preserve timestamps flag.
190+
bool timestamp_{false}; //!< Rename also sets the file timestamp.
191+
bool timestampOnly_{false}; //!< Rename only sets the file timestamp.
192+
FileExistsPolicy fileExistsPolicy_{askPolicy}; //!< What to do if file to rename exists.
193+
bool adjust_{false}; //!< Adjustment flag.
194+
PrintMode printMode_{pmSummary}; //!< Print mode.
195+
unsigned long printItems_{0}; //!< Print items.
196+
unsigned long printTags_{Exiv2::mdNone}; //!< Print tags (bitmap of MetadataId flags).
199197
//! %Action (integer rather than TaskType to avoid dependency).
200-
int action_;
198+
int action_{0};
201199
int target_; //!< What common target to process.
202200

203-
long adjustment_; //!< Adjustment in seconds.
201+
long adjustment_{0}; //!< Adjustment in seconds.
204202
YodAdjust yodAdjust_[3]; //!< Year, month and day adjustment info.
205203
std::string format_; //!< Filename format (-r option arg).
206-
bool formatSet_; //!< Whether the format is set with -r
204+
bool formatSet_{false}; //!< Whether the format is set with -r
207205
CmdFiles cmdFiles_; //!< Names of the modification command files
208206
CmdLines cmdLines_; //!< Commands from the command line
209207
ModifyCmds modifyCmds_; //!< Parsed modification commands
@@ -219,7 +217,7 @@ class Params : public Util::Getopt {
219217
Exiv2::DataBuf stdinBuf; //!< DataBuf with the binary bytes from stdin
220218

221219
private:
222-
bool first_;
220+
bool first_{true};
223221

224222
Params();
225223

app/getopt.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ int getopt(int argc, char* const argv[], const char* optstring) {
7979

8080
// *****************************************************************************
8181
// class Getopt
82-
Getopt::Getopt() : errcnt_(0) {
83-
}
84-
8582
int Getopt::getopt(int argc, char* const argv[], const std::string& optstring) {
8683
progname_ = fs::path(argv[0]).filename().string();
8784
Util::optind = 0; // reset the Util::Getopt scanner

app/getopt.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int getopt(int argc, char* const argv[], const char* optstring);
2929
class Getopt {
3030
public:
3131
//! Default constructor.
32-
Getopt();
32+
Getopt() = default;
3333

3434
//! Destructor.
3535
virtual ~Getopt() = default;
@@ -96,7 +96,7 @@ class Getopt {
9696

9797
private:
9898
std::string progname_;
99-
int errcnt_;
99+
int errcnt_{0};
100100
};
101101

102102
}; // namespace Util

include/exiv2/value.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ class EXIV2API CommentValue : public StringValueBase {
582582

583583
public:
584584
// DATA
585-
ByteOrder byteOrder_; //!< Byte order of the comment string that was read
585+
ByteOrder byteOrder_{littleEndian}; //!< Byte order of the comment string that was read
586586

587587
}; // class CommentValue
588588

src/value.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,10 @@ CommentValue::CharsetId CommentValue::CharsetInfo::charsetIdByCode(const std::st
330330
return charsetTable_[i].charsetId_ == lastCharsetId ? invalidCharsetId : charsetTable_[i].charsetId_;
331331
}
332332

333-
CommentValue::CommentValue() : StringValueBase(Exiv2::undefined), byteOrder_(littleEndian) {
333+
CommentValue::CommentValue() : StringValueBase(Exiv2::undefined) {
334334
}
335335

336-
CommentValue::CommentValue(const std::string& comment) : StringValueBase(Exiv2::undefined), byteOrder_(littleEndian) {
336+
CommentValue::CommentValue(const std::string& comment) : StringValueBase(Exiv2::undefined) {
337337
read(comment);
338338
}
339339

0 commit comments

Comments
 (0)