summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/common
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-20 15:38:29 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-20 15:38:30 -0700
commit038aa531bcf1a76764d3cef46fd9b8e08b166dae (patch)
treed1ef7d15ff37e4c98d1d7522b225755ba99bc330 /xfa/fxbarcode/common
parentdc3ccdfb49c4d533d524d2084a7ebe5117f35934 (diff)
downloadpdfium-038aa531bcf1a76764d3cef46fd9b8e08b166dae.tar.xz
Clean up XFA code which causes warnings
This is part of efforts to bring XFA to chromium_code standard. The warnings are from unreachable code, or using potentially uninitialized variables, or using assignment within a condition. This change list only contains easy to fix cases. More cleanups will follow. BUG=pdfium:29 Review-Url: https://codereview.chromium.org/1998873002
Diffstat (limited to 'xfa/fxbarcode/common')
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp41
1 files changed, 15 insertions, 26 deletions
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index b3c4326ed6..aec4a1ca22 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -104,14 +104,11 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Clone(int32_t& e) {
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
CBC_ReedSolomonGF256Poly* other,
int32_t& e) {
- if (IsZero()) {
+ if (IsZero())
return other->Clone(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- }
- if (other->IsZero()) {
+ if (other->IsZero())
return Clone(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- }
+
CFX_Int32Array smallerCoefficients;
smallerCoefficients.Copy(m_coefficients);
CFX_Int32Array largerCoefficients;
@@ -141,11 +138,9 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
CBC_ReedSolomonGF256Poly* other,
int32_t& e) {
- if (IsZero() || other->IsZero()) {
- CBC_ReedSolomonGF256Poly* temp = m_field->GetZero()->Clone(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- return temp;
- }
+ if (IsZero() || other->IsZero())
+ return m_field->GetZero()->Clone(e);
+
CFX_Int32Array aCoefficients;
aCoefficients.Copy(m_coefficients);
int32_t aLength = m_coefficients.GetSize();
@@ -169,15 +164,11 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
}
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar,
int32_t& e) {
- if (scalar == 0) {
- CBC_ReedSolomonGF256Poly* temp = m_field->GetZero()->Clone(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- return temp;
- }
- if (scalar == 1) {
+ if (scalar == 0)
+ return m_field->GetZero()->Clone(e);
+ if (scalar == 1)
return Clone(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- }
+
int32_t size = m_coefficients.GetSize();
CFX_Int32Array product;
product.SetSize(size);
@@ -195,13 +186,11 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
int32_t& e) {
if (degree < 0) {
e = BCExceptionDegreeIsNegative;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- }
- if (coefficient == 0) {
- CBC_ReedSolomonGF256Poly* temp = m_field->GetZero()->Clone(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- return temp;
+ return nullptr;
}
+ if (coefficient == 0)
+ return m_field->GetZero()->Clone(e);
+
int32_t size = m_coefficients.GetSize();
CFX_Int32Array product;
product.SetSize(size + degree);
@@ -219,7 +208,7 @@ CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
int32_t& e) {
if (other->IsZero()) {
e = BCExceptionDivideByZero;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ return nullptr;
}
std::unique_ptr<CBC_ReedSolomonGF256Poly> quotient(
m_field->GetZero()->Clone(e));