clang-tidy: default init various members
Found with cppcoreguidelines-pro-type-member-init Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
dd25d9999b
commit
2205a14a06
@ -195,13 +195,9 @@ 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:"),
|
||||
|
||||
target_(ctExif | ctIptc | ctComment | ctXmp),
|
||||
|
||||
yodAdjust_(emptyYodAdjust_),
|
||||
format_("%Y%m%d_%H%M%S") {
|
||||
yodAdjust_[yodYear] = emptyYodAdjust_[yodYear];
|
||||
yodAdjust_[yodMonth] = emptyYodAdjust_[yodMonth];
|
||||
yodAdjust_[yodDay] = emptyYodAdjust_[yodDay];
|
||||
}
|
||||
|
||||
Params& Params::instance() {
|
||||
|
||||
@ -21,10 +21,10 @@ namespace Exiv2 {
|
||||
|
||||
//! Native preview information. This is meant to be used only by the PreviewManager.
|
||||
struct NativePreview {
|
||||
size_t position_; //!< Position
|
||||
size_t size_; //!< Size
|
||||
size_t width_; //!< Width
|
||||
size_t height_; //!< Height
|
||||
size_t position_{}; //!< Position
|
||||
size_t size_{}; //!< Size
|
||||
size_t width_{}; //!< Width
|
||||
size_t height_{}; //!< Height
|
||||
std::string filter_; //!< Filter
|
||||
std::string mimeType_; //!< MIME type
|
||||
};
|
||||
|
||||
@ -23,10 +23,10 @@ using PreviewId = int;
|
||||
struct EXIV2API PreviewProperties {
|
||||
std::string mimeType_; //!< Preview image mime type.
|
||||
std::string extension_; //!< Preview image extension.
|
||||
size_t size_; //!< Preview image size in bytes.
|
||||
size_t width_; //!< Preview image width in pixels or 0 for unknown width.
|
||||
size_t height_; //!< Preview image height in pixels or 0 for unknown height.
|
||||
PreviewId id_; //!< Identifies type of preview image.
|
||||
size_t size_{}; //!< Preview image size in bytes.
|
||||
size_t width_{}; //!< Preview image width in pixels or 0 for unknown width.
|
||||
size_t height_{}; //!< Preview image height in pixels or 0 for unknown height.
|
||||
PreviewId id_{}; //!< Identifies type of preview image.
|
||||
};
|
||||
|
||||
//! Container type to hold all preview images metadata.
|
||||
|
||||
@ -500,7 +500,7 @@ void IptcDataSets::dataSetList(std::ostream& os) {
|
||||
}
|
||||
}
|
||||
|
||||
IptcKey::IptcKey(std::string key) : key_(std::move(key)) {
|
||||
IptcKey::IptcKey(std::string key) : tag_(0), record_(0), key_(std::move(key)) {
|
||||
decomposeKey();
|
||||
}
|
||||
|
||||
|
||||
@ -34,10 +34,7 @@ TEST(ADateValue, canBeConstructedWithInvalidDate) {
|
||||
|
||||
TEST(ADateValue, setsValidDateCorrectly) {
|
||||
DateValue dateValue;
|
||||
DateValue::Date date;
|
||||
date.year = 2018;
|
||||
date.month = 4;
|
||||
date.day = 2;
|
||||
DateValue::Date date = {2018, 4, 2};
|
||||
|
||||
dateValue.setDate(date);
|
||||
ASSERT_EQ(2018, dateValue.getDate().year);
|
||||
@ -48,10 +45,7 @@ TEST(ADateValue, setsValidDateCorrectly) {
|
||||
/// \todo Probably we should avoid this ...
|
||||
TEST(ADateValue, setsInvalidDateCorrectly) {
|
||||
DateValue dateValue;
|
||||
DateValue::Date date;
|
||||
date.year = 2018;
|
||||
date.month = 13;
|
||||
date.day = 69;
|
||||
DateValue::Date date = {2018, 13, 69};
|
||||
|
||||
dateValue.setDate(date);
|
||||
ASSERT_EQ(2018, dateValue.getDate().year);
|
||||
@ -154,8 +148,7 @@ TEST(ADateValue, writesVeryOldDateToExtendedFormat) {
|
||||
|
||||
TEST(ADateValue, copiesToByteBufferWithBasicFormat) {
|
||||
const DateValue dateValue(2021, 12, 1);
|
||||
std::array<byte, 8> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 8> buf = {};
|
||||
|
||||
const byte expectedDate[10] = {'2', '0', '2', '1', '1', '2', '0', '1'};
|
||||
ASSERT_EQ(8, dateValue.copy(buf.data()));
|
||||
|
||||
@ -43,8 +43,7 @@ TEST(MemIo_Default, seekToEndPositionAndReadTriggersEof) {
|
||||
ASSERT_EQ(0, io.seek(0, BasicIo::end));
|
||||
ASSERT_EQ(0, io.tell());
|
||||
|
||||
std::array<byte, 64> buf2;
|
||||
buf2.fill(0);
|
||||
std::array<byte, 64> buf2 = {};
|
||||
ASSERT_EQ(0, io.read(buf2.data(), 1)); // Note that we cannot even read 1 byte being at the end
|
||||
ASSERT_TRUE(io.eof());
|
||||
}
|
||||
@ -52,16 +51,14 @@ TEST(MemIo_Default, seekToEndPositionAndReadTriggersEof) {
|
||||
// -------------------------
|
||||
|
||||
TEST(MemIo, isNotAtEofInitially) {
|
||||
std::array<byte, 64> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 64> buf = {};
|
||||
|
||||
MemIo io(buf.data(), buf.size());
|
||||
ASSERT_FALSE(io.eof());
|
||||
}
|
||||
|
||||
TEST(MemIo, seekBeyondBufferSizeReturns1AndSetsEofToTrue) {
|
||||
std::array<byte, 64> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 64> buf = {};
|
||||
|
||||
MemIo io(buf.data(), buf.size());
|
||||
ASSERT_EQ(1, io.seek(65, BasicIo::beg));
|
||||
@ -69,8 +66,7 @@ TEST(MemIo, seekBeyondBufferSizeReturns1AndSetsEofToTrue) {
|
||||
}
|
||||
|
||||
TEST(MemIo, seekBefore0Returns1ButItDoesNotSetEofToTrue) {
|
||||
std::array<byte, 64> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 64> buf = {};
|
||||
|
||||
MemIo io(buf.data(), buf.size());
|
||||
ASSERT_EQ(1, io.seek(-1, BasicIo::beg));
|
||||
@ -88,8 +84,7 @@ TEST(MemIo, seekBeyondBoundsDoesNotMoveThePosition) {
|
||||
}
|
||||
|
||||
TEST(MemIo, seekInsideBoundsMoveThePosition) {
|
||||
std::array<byte, 64> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 64> buf = {};
|
||||
|
||||
MemIo io(buf.data(), buf.size());
|
||||
ASSERT_EQ(0, io.tell());
|
||||
@ -98,8 +93,7 @@ TEST(MemIo, seekInsideBoundsMoveThePosition) {
|
||||
}
|
||||
|
||||
TEST(MemIo, seekInsideBoundsUsingBeg_resetsThePosition) {
|
||||
std::array<byte, 64> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 64> buf = {};
|
||||
|
||||
MemIo io(buf.data(), buf.size());
|
||||
std::vector<std::int64_t> positions{0, 8, 16, 32, 64};
|
||||
@ -110,8 +104,7 @@ TEST(MemIo, seekInsideBoundsUsingBeg_resetsThePosition) {
|
||||
}
|
||||
|
||||
TEST(MemIo, seekInsideBoundsUsingCur_shiftThePosition) {
|
||||
std::array<byte, 64> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 64> buf = {};
|
||||
|
||||
MemIo io(buf.data(), buf.size());
|
||||
std::vector<std::int64_t> shifts{4, 4, 8, 16, 32};
|
||||
@ -123,8 +116,7 @@ TEST(MemIo, seekInsideBoundsUsingCur_shiftThePosition) {
|
||||
}
|
||||
|
||||
TEST(MemIo, seekToEndPosition_doesNotTriggerEof) {
|
||||
std::array<byte, 64> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 64> buf = {};
|
||||
|
||||
MemIo io(buf.data(), buf.size());
|
||||
ASSERT_EQ(0, io.tell());
|
||||
@ -134,15 +126,13 @@ TEST(MemIo, seekToEndPosition_doesNotTriggerEof) {
|
||||
}
|
||||
|
||||
TEST(MemIo, seekToEndPositionAndReadTriggersEof) {
|
||||
std::array<byte, 64> buf;
|
||||
buf.fill(0);
|
||||
std::array<byte, 64> buf = {};
|
||||
|
||||
MemIo io(buf.data(), buf.size());
|
||||
ASSERT_EQ(0, io.seek(0, BasicIo::end));
|
||||
ASSERT_EQ(64, io.tell());
|
||||
|
||||
std::array<byte, 64> buf2;
|
||||
buf2.fill(0);
|
||||
std::array<byte, 64> buf2 = {};
|
||||
ASSERT_EQ(0, io.read(buf2.data(), 1)); // Note that we cannot even read 1 byte being at the end
|
||||
ASSERT_TRUE(io.eof());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user