From 4473800c17b53bae6cf97345952f0a29cdde0907 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 17 Sep 2018 17:42:17 +0000 Subject: Initialize some 1D barcode classes in the header. Change-Id: Iaeb7f43e442ace403f1522268e63b1a59f223a9d Reviewed-on: https://pdfium-review.googlesource.com/42599 Reviewed-by: Henrique Nakashima Commit-Queue: Lei Zhang --- fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 5 ++--- fxbarcode/oned/BC_OnedCodaBarWriter.h | 6 +++--- fxbarcode/oned/BC_OnedCode128Writer.cpp | 2 +- fxbarcode/oned/BC_OnedCode39Writer.cpp | 4 ++-- fxbarcode/oned/BC_OnedCode39Writer.h | 2 +- fxbarcode/oned/BC_OnedEAN8Writer.cpp | 3 +-- fxbarcode/oned/BC_OnedEAN8Writer.h | 3 ++- 7 files changed, 12 insertions(+), 13 deletions(-) (limited to 'fxbarcode') diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index c51b1c2eb9..57e86a485b 100644 --- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -49,10 +49,9 @@ const char kCOntentChars[] = {'0', '1', '2', '3', '4', '5', '6', '7', } // namespace -CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() - : m_chStart('A'), m_chEnd('B'), m_iWideNarrRatio(2) {} +CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() = default; -CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {} +CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() = default; bool CBC_OnedCodaBarWriter::SetStartChar(char start) { if (!pdfium::ContainsValue(kStartEndChars, start)) diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.h b/fxbarcode/oned/BC_OnedCodaBarWriter.h index d3f5224e3a..4b4f066ad4 100644 --- a/fxbarcode/oned/BC_OnedCodaBarWriter.h +++ b/fxbarcode/oned/BC_OnedCodaBarWriter.h @@ -40,9 +40,9 @@ class CBC_OnedCodaBarWriter final : public CBC_OneDimWriter { WideString encodedContents(const WideStringView& contents); private: - char m_chStart; - char m_chEnd; - int8_t m_iWideNarrRatio; + char m_chStart = 'A'; + char m_chEnd = 'B'; + int8_t m_iWideNarrRatio = 2; }; #endif // FXBARCODE_ONED_BC_ONEDCODABARWRITER_H_ diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp index 034ffc3557..ad94d296ec 100644 --- a/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -81,7 +81,7 @@ CBC_OnedCode128Writer::CBC_OnedCode128Writer(BC_TYPE type) assert(m_codeFormat == BC_CODE128_B || m_codeFormat == BC_CODE128_C); } -CBC_OnedCode128Writer::~CBC_OnedCode128Writer() {} +CBC_OnedCode128Writer::~CBC_OnedCode128Writer() = default; bool CBC_OnedCode128Writer::CheckContentValidity( const WideStringView& contents) { diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp index 9152155e29..c800250978 100644 --- a/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -52,9 +52,9 @@ static_assert(FX_ArraySize(kOnedCode39CharacterEncoding) == 44, "Wrong size"); } // namespace -CBC_OnedCode39Writer::CBC_OnedCode39Writer() : m_iWideNarrRatio(3) {} +CBC_OnedCode39Writer::CBC_OnedCode39Writer() = default; -CBC_OnedCode39Writer::~CBC_OnedCode39Writer() {} +CBC_OnedCode39Writer::~CBC_OnedCode39Writer() = default; bool CBC_OnedCode39Writer::CheckContentValidity( const WideStringView& contents) { diff --git a/fxbarcode/oned/BC_OnedCode39Writer.h b/fxbarcode/oned/BC_OnedCode39Writer.h index 5c4a4d5dc8..0791062660 100644 --- a/fxbarcode/oned/BC_OnedCode39Writer.h +++ b/fxbarcode/oned/BC_OnedCode39Writer.h @@ -38,7 +38,7 @@ class CBC_OnedCode39Writer final : public CBC_OneDimWriter { void ToIntArray(int16_t a, int8_t* toReturn); char CalcCheckSum(const ByteString& contents); - int8_t m_iWideNarrRatio; + int8_t m_iWideNarrRatio = 3; }; #endif // FXBARCODE_ONED_BC_ONEDCODE39WRITER_H_ diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp index b953c121b0..1ff96a0e64 100644 --- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -46,10 +46,9 @@ const int8_t kOnedEAN8LPattern[10][4] = { CBC_OnedEAN8Writer::CBC_OnedEAN8Writer() { m_iDataLenth = 8; - m_codeWidth = 3 + (7 * 4) + 5 + (7 * 4) + 3; } -CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer() {} +CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer() = default; void CBC_OnedEAN8Writer::SetDataLength(int32_t length) { m_iDataLenth = 8; diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.h b/fxbarcode/oned/BC_OnedEAN8Writer.h index dfef89e1ee..269156a25e 100644 --- a/fxbarcode/oned/BC_OnedEAN8Writer.h +++ b/fxbarcode/oned/BC_OnedEAN8Writer.h @@ -42,7 +42,8 @@ class CBC_OnedEAN8Writer final : public CBC_OneDimWriter { int32_t multiple) override; private: - int32_t m_codeWidth; + static constexpr int32_t kDefaultCodeWidth = 3 + (7 * 4) + 5 + (7 * 4) + 3; + int32_t m_codeWidth = kDefaultCodeWidth; }; #endif // FXBARCODE_ONED_BC_ONEDEAN8WRITER_H_ -- cgit v1.2.3