From 29b8ad0b130ec6ed4f72ebd0c0a4f9e6a5b03467 Mon Sep 17 00:00:00 2001 From: weili Date: Tue, 14 Jun 2016 18:20:04 -0700 Subject: Make code compile with clang_use_chrome_plugin (part III) This change contains files in xfa/fxbarcode directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2067903002 --- xfa/fxbarcode/common/BC_CommonBitArray.h | 5 +++-- xfa/fxbarcode/common/BC_CommonBitMatrix.h | 6 ++++-- xfa/fxbarcode/common/BC_CommonBitSource.h | 3 ++- xfa/fxbarcode/common/BC_CommonByteArray.h | 13 +++++++------ xfa/fxbarcode/common/BC_CommonByteMatrix.h | 1 + xfa/fxbarcode/common/BC_CommonCharacterSetECI.h | 4 ++-- xfa/fxbarcode/common/BC_CommonDecoderResult.h | 1 + xfa/fxbarcode/common/BC_CommonECI.h | 3 ++- xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h | 1 + xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h | 9 ++++++--- xfa/fxbarcode/common/BC_WhiteRectangleDetector.h | 5 +++-- 11 files changed, 32 insertions(+), 19 deletions(-) (limited to 'xfa/fxbarcode/common') diff --git a/xfa/fxbarcode/common/BC_CommonBitArray.h b/xfa/fxbarcode/common/BC_CommonBitArray.h index 1c89500138..04cb96b752 100644 --- a/xfa/fxbarcode/common/BC_CommonBitArray.h +++ b/xfa/fxbarcode/common/BC_CommonBitArray.h @@ -11,10 +11,11 @@ class CBC_CommonBitArray { public: - CBC_CommonBitArray(CBC_CommonBitArray* array); - CBC_CommonBitArray(int32_t size); + explicit CBC_CommonBitArray(CBC_CommonBitArray* array); + explicit CBC_CommonBitArray(int32_t size); CBC_CommonBitArray(); virtual ~CBC_CommonBitArray(); + int32_t GetSize(); CFX_Int32Array& GetBits(); int32_t GetSizeInBytes(); diff --git a/xfa/fxbarcode/common/BC_CommonBitMatrix.h b/xfa/fxbarcode/common/BC_CommonBitMatrix.h index ebf7454dca..48a26b9f8c 100644 --- a/xfa/fxbarcode/common/BC_CommonBitMatrix.h +++ b/xfa/fxbarcode/common/BC_CommonBitMatrix.h @@ -15,6 +15,10 @@ class CBC_CommonBitMatrix { public: CBC_CommonBitMatrix(); virtual ~CBC_CommonBitMatrix(); + + virtual void Init(int32_t dimension); + virtual void Init(int32_t width, int32_t height); + FX_BOOL Get(int32_t x, int32_t y); void Set(int32_t x, int32_t y); void Flip(int32_t x, int32_t y); @@ -32,8 +36,6 @@ class CBC_CommonBitMatrix { int32_t GetHeight(); int32_t GetRowSize(); int32_t GetDimension(int32_t& e); - virtual void Init(int32_t dimension); - virtual void Init(int32_t width, int32_t height); int32_t* GetBits(); private: diff --git a/xfa/fxbarcode/common/BC_CommonBitSource.h b/xfa/fxbarcode/common/BC_CommonBitSource.h index f33e077c68..7c6736cba3 100644 --- a/xfa/fxbarcode/common/BC_CommonBitSource.h +++ b/xfa/fxbarcode/common/BC_CommonBitSource.h @@ -13,7 +13,8 @@ class CBC_CommonBitSource { public: CBC_CommonBitSource(CFX_ByteArray* bytes); - virtual ~CBC_CommonBitSource(); + ~CBC_CommonBitSource(); + int32_t ReadBits(int32_t numBits, int32_t& e); int32_t Available(); int32_t getByteOffset(); diff --git a/xfa/fxbarcode/common/BC_CommonByteArray.h b/xfa/fxbarcode/common/BC_CommonByteArray.h index eaf68d9f41..2570f81c0f 100644 --- a/xfa/fxbarcode/common/BC_CommonByteArray.h +++ b/xfa/fxbarcode/common/BC_CommonByteArray.h @@ -10,16 +10,12 @@ #include "core/fxcrt/include/fx_basic.h" class CBC_CommonByteArray { - private: - int32_t m_size; - int32_t m_index; - uint8_t* m_bytes; - public: CBC_CommonByteArray(); - CBC_CommonByteArray(int32_t size); + explicit CBC_CommonByteArray(int32_t size); CBC_CommonByteArray(uint8_t* byteArray, int32_t size); virtual ~CBC_CommonByteArray(); + int32_t At(int32_t index); void Set(int32_t index, int32_t value); int32_t Size(); @@ -28,6 +24,11 @@ class CBC_CommonByteArray { void Reserve(int32_t capacity); void Set(uint8_t* source, int32_t offset, int32_t count); void Set(CFX_ByteArray* source, int32_t offset, int32_t count); + + private: + int32_t m_size; + int32_t m_index; + uint8_t* m_bytes; }; #endif // XFA_FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_ diff --git a/xfa/fxbarcode/common/BC_CommonByteMatrix.h b/xfa/fxbarcode/common/BC_CommonByteMatrix.h index 74e1203481..9bc2a88e8a 100644 --- a/xfa/fxbarcode/common/BC_CommonByteMatrix.h +++ b/xfa/fxbarcode/common/BC_CommonByteMatrix.h @@ -15,6 +15,7 @@ class CBC_CommonByteMatrix { public: CBC_CommonByteMatrix(int32_t width, int32_t height); virtual ~CBC_CommonByteMatrix(); + int32_t GetHeight(); int32_t GetWidth(); uint8_t Get(int32_t x, int32_t y); diff --git a/xfa/fxbarcode/common/BC_CommonCharacterSetECI.h b/xfa/fxbarcode/common/BC_CommonCharacterSetECI.h index 5bd77e4fd1..a2fe0ed2fe 100644 --- a/xfa/fxbarcode/common/BC_CommonCharacterSetECI.h +++ b/xfa/fxbarcode/common/BC_CommonCharacterSetECI.h @@ -13,10 +13,10 @@ class CBC_CommonCharacterSetECI : public CBC_CommonECI { public: CBC_CommonCharacterSetECI(int32_t value, CFX_ByteString encodingName); - virtual ~CBC_CommonCharacterSetECI(); + ~CBC_CommonCharacterSetECI() override; + CFX_ByteString GetEncodingName(); static void AddCharacterSet(int32_t value, CFX_ByteString encodingName); - int32_t GetValue(); static CBC_CommonCharacterSetECI* GetCharacterSetECIByValue(int32_t value); static CBC_CommonCharacterSetECI* GetCharacterSetECIByName( const CFX_ByteString& name); diff --git a/xfa/fxbarcode/common/BC_CommonDecoderResult.h b/xfa/fxbarcode/common/BC_CommonDecoderResult.h index cec7431119..bcb65df9fa 100644 --- a/xfa/fxbarcode/common/BC_CommonDecoderResult.h +++ b/xfa/fxbarcode/common/BC_CommonDecoderResult.h @@ -16,6 +16,7 @@ class CBC_CommonDecoderResult { public: CBC_CommonDecoderResult(); virtual ~CBC_CommonDecoderResult(); + const CFX_ByteArray& GetRawBytes(); const CFX_ByteString& GetText(); const CFX_Int32Array& GetByteSegments(); diff --git a/xfa/fxbarcode/common/BC_CommonECI.h b/xfa/fxbarcode/common/BC_CommonECI.h index 20b3e76bb3..5bc4c1485c 100644 --- a/xfa/fxbarcode/common/BC_CommonECI.h +++ b/xfa/fxbarcode/common/BC_CommonECI.h @@ -14,7 +14,8 @@ class CBC_CommonECI { CBC_CommonECI(int32_t value); virtual ~CBC_CommonECI(); - int32_t GetValue(); + virtual int32_t GetValue(); + static CBC_CommonECI* GetEICByValue(int32_t value, int32_t& e); private: diff --git a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h b/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h index d701b7ec34..8a5fd26f22 100644 --- a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h +++ b/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h @@ -21,6 +21,7 @@ class CBC_CommonPerspectiveTransform { FX_FLOAT a23, FX_FLOAT a33); virtual ~CBC_CommonPerspectiveTransform(); + static CBC_CommonPerspectiveTransform* QuadrilateralToQuadrilateral( FX_FLOAT x0, FX_FLOAT y0, diff --git a/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h b/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h index 01ac9a6c2a..786e8e0a53 100644 --- a/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h +++ b/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h @@ -17,13 +17,16 @@ class CBC_LuminanceSource; class CBC_GlobalHistogramBinarizer : public CBC_Binarizer { public: CBC_GlobalHistogramBinarizer(CBC_LuminanceSource* source); - virtual ~CBC_GlobalHistogramBinarizer(); + ~CBC_GlobalHistogramBinarizer() override; void InitArrays(int32_t luminanceSize); - CBC_CommonBitMatrix* GetBlackMatrix(int32_t& e); + + // CBC_Binarizer + CBC_CommonBitMatrix* GetBlackMatrix(int32_t& e) override; CBC_CommonBitArray* GetBlackRow(int32_t y, CBC_CommonBitArray* row, - int32_t& e); + int32_t& e) override; + static int32_t EstimateBlackPoint(CFX_Int32Array& buckets, int32_t& e); private: diff --git a/xfa/fxbarcode/common/BC_WhiteRectangleDetector.h b/xfa/fxbarcode/common/BC_WhiteRectangleDetector.h index f3ac77a9c0..427d7b85ca 100644 --- a/xfa/fxbarcode/common/BC_WhiteRectangleDetector.h +++ b/xfa/fxbarcode/common/BC_WhiteRectangleDetector.h @@ -14,18 +14,19 @@ class CBC_ResultPoint; class CBC_WhiteRectangleDetector { public: - CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image); + explicit CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image); CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image, int32_t initSize, int32_t x, int32_t y); virtual ~CBC_WhiteRectangleDetector(); + virtual void Init(int32_t& e); CFX_ArrayTemplate* Detect(int32_t& e); private: - int32_t Round(float d); + int32_t Round(FX_FLOAT d); CBC_ResultPoint* GetBlackPointOnSegment(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, -- cgit v1.2.3