Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Unified Diff: xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp

Issue 2221023003: Use smart pointers for class owned pointers in xfa/fxbarcode (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h ('k') | xfa/fxbarcode/oned/BC_OneDimWriter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
index da0ad3ff054a0063c799aca1f30a2ef8ec838565..c9425dfa1958df4871a1ed1768a47624bc609da2 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -23,18 +23,19 @@
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeFild = nullptr;
+CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeField = nullptr;
CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = nullptr;
+
void CBC_ReedSolomonGF256::Initialize() {
- QRCodeFild = new CBC_ReedSolomonGF256(0x011D);
- QRCodeFild->Init();
+ QRCodeField = new CBC_ReedSolomonGF256(0x011D);
+ QRCodeField->Init();
DataMatrixField = new CBC_ReedSolomonGF256(0x012D);
DataMatrixField->Init();
}
void CBC_ReedSolomonGF256::Finalize() {
- delete QRCodeFild;
- QRCodeFild = nullptr;
+ delete QRCodeField;
+ QRCodeField = nullptr;
delete DataMatrixField;
DataMatrixField = nullptr;
}
@@ -53,20 +54,22 @@ CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive) {
}
m_logTable[0] = 0;
}
+
void CBC_ReedSolomonGF256::Init() {
- m_zero = new CBC_ReedSolomonGF256Poly(this, 0);
- m_one = new CBC_ReedSolomonGF256Poly(this, 1);
-}
-CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() {
- delete m_zero;
- delete m_one;
+ m_zero.reset(new CBC_ReedSolomonGF256Poly(this, 0));
+ m_one.reset(new CBC_ReedSolomonGF256Poly(this, 1));
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() {
- return m_zero;
+
+CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() {}
+
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() const {
+ return m_zero.get();
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() {
- return m_one;
+
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() const {
+ return m_one.get();
}
+
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(
int32_t degree,
int32_t coefficient,
@@ -88,12 +91,15 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(
BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return temp;
}
+
int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) {
return a ^ b;
}
+
int32_t CBC_ReedSolomonGF256::Exp(int32_t a) {
return m_expTable[a];
}
+
int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t& e) {
if (a == 0) {
e = BCExceptionAIsZero;
@@ -101,6 +107,7 @@ int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t& e) {
}
return m_logTable[a];
}
+
int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t& e) {
if (a == 0) {
e = BCExceptionAIsZero;
@@ -108,6 +115,7 @@ int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t& e) {
}
return m_expTable[255 - m_logTable[a]];
}
+
int32_t CBC_ReedSolomonGF256::Multiply(int32_t a, int32_t b) {
if (a == 0 || b == 0) {
return 0;
« no previous file with comments | « xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h ('k') | xfa/fxbarcode/oned/BC_OneDimWriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698