summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/common/reedsolomon
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-09 18:39:33 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-09 18:39:33 -0700
commit6dc1d7753691c0ff2f390e8ffd95a3182064487e (patch)
tree43d77664973a76c107832ae7b3c3e0f04bba1fe0 /xfa/fxbarcode/common/reedsolomon
parentfcf61b39ee597c73e80ba789833fb7fe49878422 (diff)
downloadpdfium-6dc1d7753691c0ff2f390e8ffd95a3182064487e.tar.xz
Get rid of NULLs in xfa/fxbarcode/
Review-Url: https://codereview.chromium.org/2048983002
Diffstat (limited to 'xfa/fxbarcode/common/reedsolomon')
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp4
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp8
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp10
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp18
4 files changed, 20 insertions, 20 deletions
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
index 40e5fa6625..352dc3dab1 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
@@ -44,10 +44,10 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(int32_t degree,
temp.Add(m_field->Exp(d - 1));
CBC_ReedSolomonGF256Poly temp_poly;
temp_poly.Init(m_field, &temp, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
CBC_ReedSolomonGF256Poly* nextGenerator =
lastGenerator->Multiply(&temp_poly, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
m_cachedGenerators.Add(nextGenerator);
lastGenerator = nextGenerator;
}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp
index f31a54747f..8788afbda8 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp
@@ -181,13 +181,13 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorLocations(
for (int32_t i = 1; i < 256 && ie < numErrors; i++) {
if (errorLocator->EvaluateAt(i) == 0) {
(*result)[ie] = m_field->Inverse(i, ie);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
ie++;
}
}
if (ie != numErrors) {
e = BCExceptionDegreeNotMatchRoots;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
}
return result.release();
}
@@ -202,7 +202,7 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes(
std::unique_ptr<CFX_Int32Array> result(tempArray);
for (int32_t i = 0; i < s; i++) {
int32_t xiInverse = m_field->Inverse(errorLocations->operator[](i), e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
int32_t denominator = 1;
for (int32_t j = 0; j < s; j++) {
if (i != j) {
@@ -213,7 +213,7 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes(
}
}
int32_t temp = m_field->Inverse(denominator, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
(*result)[i] =
m_field->Multiply(errorEvaluator->EvaluateAt(xiInverse), temp);
}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
index 33771418d4..da0ad3ff05 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -23,8 +23,8 @@
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeFild = NULL;
-CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = NULL;
+CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeFild = nullptr;
+CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = nullptr;
void CBC_ReedSolomonGF256::Initialize() {
QRCodeFild = new CBC_ReedSolomonGF256(0x011D);
QRCodeFild->Init();
@@ -73,11 +73,11 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(
int32_t& e) {
if (degree < 0) {
e = BCExceptionDegreeIsNegative;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
}
if (coefficient == 0) {
CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return temp;
}
CFX_Int32Array coefficients;
@@ -85,7 +85,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(
coefficients[0] = coefficient;
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(this, &coefficients, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return temp;
}
int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) {
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index aec4a1ca22..0e376ce1a8 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -28,19 +28,19 @@
CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field,
int32_t coefficients) {
- if (field == NULL) {
+ if (!field)
return;
- }
+
m_field = field;
m_coefficients.Add(coefficients);
}
CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly() {
- m_field = NULL;
+ m_field = nullptr;
}
void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field,
CFX_Int32Array* coefficients,
int32_t& e) {
- if (coefficients == NULL || coefficients->GetSize() == 0) {
+ if (!coefficients || coefficients->GetSize() == 0) {
e = BCExceptionCoefficientsSizeIsNull;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
@@ -98,7 +98,7 @@ int32_t CBC_ReedSolomonGF256Poly::EvaluateAt(int32_t a) {
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Clone(int32_t& e) {
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &m_coefficients, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return temp;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
@@ -132,7 +132,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &sumDiff, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return temp;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
@@ -159,7 +159,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &product, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return temp;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar,
@@ -177,7 +177,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar,
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &product, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return temp;
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
@@ -199,7 +199,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &product, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return temp;
}