diff options
author | weili <weili@chromium.org> | 2016-08-09 13:45:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-09 13:45:03 -0700 |
commit | e76203dbefd1df075a063ee019c3908513f6bee5 (patch) | |
tree | 2a763852e1d1de3eee6a67285ea96be2874bfb00 /xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h | |
parent | ad5ac7584844b03c5ceed082e5f5158a632405cc (diff) | |
download | pdfium-e76203dbefd1df075a063ee019c3908513f6bee5.tar.xz |
Use smart pointers for class owned pointers in xfa/fxbarcode
For classes under xfa/fxbarcode, use smart pointers instead
of raw pointer to make memory management easier.
Also fix some styling issues along the changes.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2221023003
Diffstat (limited to 'xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h')
-rw-r--r-- | xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h index cd788111ed..ec0f1ff549 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h @@ -7,20 +7,23 @@ #ifndef XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ #define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ +#include <memory> + #include "core/fxcrt/include/fx_basic.h" #include "xfa/fxbarcode/utils.h" class CBC_ReedSolomonGF256Poly; + class CBC_ReedSolomonGF256 { public: + explicit CBC_ReedSolomonGF256(int32_t primitive); + virtual ~CBC_ReedSolomonGF256(); + static void Initialize(); static void Finalize(); - static CBC_ReedSolomonGF256* QRCodeFild; - static CBC_ReedSolomonGF256* DataMatrixField; - CBC_ReedSolomonGF256(int32_t primitive); - virtual ~CBC_ReedSolomonGF256(); - CBC_ReedSolomonGF256Poly* GetZero(); - CBC_ReedSolomonGF256Poly* GetOne(); + + CBC_ReedSolomonGF256Poly* GetZero() const; + CBC_ReedSolomonGF256Poly* GetOne() const; CBC_ReedSolomonGF256Poly* BuildMonomial(int32_t degree, int32_t coefficient, int32_t& e); @@ -31,11 +34,14 @@ class CBC_ReedSolomonGF256 { int32_t Multiply(int32_t a, int32_t b); virtual void Init(); + static CBC_ReedSolomonGF256* QRCodeField; + static CBC_ReedSolomonGF256* DataMatrixField; + private: int32_t m_expTable[256]; int32_t m_logTable[256]; - CBC_ReedSolomonGF256Poly* m_zero; - CBC_ReedSolomonGF256Poly* m_one; + std::unique_ptr<CBC_ReedSolomonGF256Poly> m_zero; + std::unique_ptr<CBC_ReedSolomonGF256Poly> m_one; }; #endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ |