Remove redundant tests exposed by inlining macros in fxbarcode

Remove some unused #defines as well.

Change-Id: Ie7dc1ae85100eae24f18a3ecd456e3c8d8043a43
Reviewed-on: https://pdfium-review.googlesource.com/2490
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
index 25b4c85..7698890 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
@@ -61,14 +61,12 @@
                                     int32_t& e) {
   if (ecBytes == 0) {
     e = BCExceptionNoCorrectionBytes;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t dataBytes = toEncode->GetSize() - ecBytes;
   if (dataBytes <= 0) {
     e = BCExceptionNoDataBytesProvided;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   CBC_ReedSolomonGF256Poly* generator = BuildGenerator(ecBytes, e);
   if (e != BCExceptionNO)
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
index 0fe215b..ce84d8e 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -78,8 +78,7 @@
     int32_t& e) {
   if (degree < 0) {
     e = BCExceptionDegreeIsNegative;
-    if (e != BCExceptionNO)
-      return nullptr;
+    return nullptr;
   }
   if (coefficient == 0) {
     CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e);
@@ -108,8 +107,7 @@
 int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t& e) {
   if (a == 0) {
     e = BCExceptionAIsZero;
-    if (e != BCExceptionNO)
-      return 0;
+    return 0;
   }
   return m_logTable[a];
 }
@@ -117,8 +115,7 @@
 int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t& e) {
   if (a == 0) {
     e = BCExceptionAIsZero;
-    if (e != BCExceptionNO)
-      return 0;
+    return 0;
   }
   return m_expTable[255 - m_logTable[a]];
 }
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index e37d62e..a0bbc02 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -42,8 +42,7 @@
                                     int32_t& e) {
   if (!coefficients || coefficients->GetSize() == 0) {
     e = BCExceptionCoefficientsSizeIsNull;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   m_field = field;
   int32_t coefficientsLength = coefficients->GetSize();
diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
index 30ec1ee..f1ce798 100644
--- a/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
@@ -54,8 +54,7 @@
                                       int32_t& e) {
   if (outWidth < 0 || outHeight < 0) {
     e = BCExceptionHeightAndWidthMustBeAtLeast1;
-    if (e != BCExceptionNO)
-      return nullptr;
+    return nullptr;
   }
   CBC_SymbolShapeHint::SymbolShapeHint shape =
       CBC_SymbolShapeHint::FORCE_SQUARE;
diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
index 617dd17..8a6499c 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
@@ -85,8 +85,7 @@
       break;
     default: {
       e = BCExceptionUnSupportEclevel;
-      if (e != BCExceptionNO)
-        return nullptr;
+      return nullptr;
     }
   }
   CBC_QRCoder qr;
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoder.cpp
index bb0001d..a5c8497 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoder.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoder.cpp
@@ -85,8 +85,7 @@
   int32_t value = m_matrix->Get(x, y);
   if (!(value == 0 || value == 1)) {
     e = BCExceptionValueMustBeEither0or1;
-    if (e != BCExceptionNO)
-      return 0;
+    return 0;
   }
   return value;
 }
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
index bdf73a9..e4140a8 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderBitVector.cpp
@@ -43,8 +43,7 @@
 int32_t CBC_QRCoderBitVector::At(int32_t index, int32_t& e) {
   if (index < 0 || index >= m_sizeInBits) {
     e = BCExceptionBadIndexException;
-    if (e != BCExceptionNO)
-      return 0;
+    return 0;
   }
   int32_t value = m_array[index >> 3] & 0xff;
   return (value >> (7 - (index & 0x7))) & 1;
@@ -58,8 +57,7 @@
 void CBC_QRCoderBitVector::AppendBit(int32_t bit, int32_t& e) {
   if (!(bit == 0 || bit == 1)) {
     e = BCExceptionBadValueException;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t numBitsInLastByte = m_sizeInBits & 0x7;
   if (numBitsInLastByte == 0) {
@@ -74,8 +72,7 @@
                                       int32_t& e) {
   if (numBits < 0 || numBits > 32) {
     e = BCExceptionBadNumBitsException;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t numBitsLeft = numBits;
   while (numBitsLeft > 0) {
@@ -107,8 +104,7 @@
 void CBC_QRCoderBitVector::XOR(CBC_QRCoderBitVector* other, int32_t& e) {
   if (m_sizeInBits != other->Size()) {
     e = BCExceptioncanNotOperatexorOperator;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t sizeInBytes = (m_sizeInBits + 7) >> 3;
   for (int32_t i = 0; i < sizeInBytes; ++i) {
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index d8f5f4e..2c262f0 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -139,8 +139,7 @@
         return;
     } else {
       e = BCExceptionUnknown;
-      if (e != BCExceptionNO)
-        return;
+      return;
     }
   }
 }
@@ -215,48 +214,41 @@
                                              CBC_QRCoderMode* modeSecond,
                                              int32_t versionNum,
                                              int32_t& e) {
-  if (versionNum == 0) {
+  if (versionNum == 0)
+    return 0;
+
+  if (modeFirst == CBC_QRCoderMode::sALPHANUMERIC &&
+      modeSecond == CBC_QRCoderMode::sBYTE) {
+    if (versionNum >= 1 && versionNum <= 9)
+      return 11;
+    if (versionNum >= 10 && versionNum <= 26)
+      return 15;
+    if (versionNum >= 27 && versionNum <= 40)
+      return 16;
+    e = BCExceptionNoSuchVersion;
     return 0;
   }
-  if ((modeFirst == CBC_QRCoderMode::sALPHANUMERIC) &&
-      (modeSecond == CBC_QRCoderMode::sBYTE)) {
-    if (versionNum >= 1 && versionNum <= 9) {
-      return 11;
-    } else if (versionNum >= 10 && versionNum <= 26) {
-      return 15;
-    } else if (versionNum >= 27 && versionNum <= 40) {
-      return 16;
-    } else {
-      e = BCExceptionNoSuchVersion;
-      if (e != BCExceptionNO)
-        return 0;
-    }
-  } else if ((modeSecond == CBC_QRCoderMode::sALPHANUMERIC) &&
-             (modeFirst == CBC_QRCoderMode::sNUMERIC)) {
-    if (versionNum >= 1 && versionNum <= 9) {
+  if (modeSecond == CBC_QRCoderMode::sALPHANUMERIC &&
+      modeFirst == CBC_QRCoderMode::sNUMERIC) {
+    if (versionNum >= 1 && versionNum <= 9)
       return 13;
-    } else if (versionNum >= 10 && versionNum <= 26) {
+    if (versionNum >= 10 && versionNum <= 26)
       return 15;
-    } else if (versionNum >= 27 && versionNum <= 40) {
+    if (versionNum >= 27 && versionNum <= 40)
       return 17;
-    } else {
-      e = BCExceptionNoSuchVersion;
-      if (e != BCExceptionNO)
-        return 0;
-    }
-  } else if ((modeSecond == CBC_QRCoderMode::sBYTE) &&
-             (modeFirst == CBC_QRCoderMode::sNUMERIC)) {
-    if (versionNum >= 1 && versionNum <= 9) {
+    e = BCExceptionNoSuchVersion;
+    return 0;
+  }
+  if (modeSecond == CBC_QRCoderMode::sBYTE &&
+      modeFirst == CBC_QRCoderMode::sNUMERIC) {
+    if (versionNum >= 1 && versionNum <= 9)
       return 6;
-    } else if (versionNum >= 10 && versionNum <= 26) {
+    if (versionNum >= 10 && versionNum <= 26)
       return 8;
-    } else if (versionNum >= 27 && versionNum <= 40) {
+    if (versionNum >= 27 && versionNum <= 40)
       return 9;
-    } else {
-      e = BCExceptionNoSuchVersion;
-      if (e != BCExceptionNO)
-        return 0;
-    }
+    e = BCExceptionNoSuchVersion;
+    return 0;
   }
   return -1;
 }
@@ -338,18 +330,16 @@
   int32_t numEcBytes = ecBlocks->GetTotalECCodeWords();
   int32_t numRSBlocks = ecBlocks->GetNumBlocks();
   int32_t numDataBytes = numBytes - numEcBytes;
-  if (numDataBytes >= numInputBytes + 3) {
-    qrCode->SetVersion(versionNumber);
-    qrCode->SetNumTotalBytes(numBytes);
-    qrCode->SetNumDataBytes(numDataBytes);
-    qrCode->SetNumRSBlocks(numRSBlocks);
-    qrCode->SetNumECBytes(numEcBytes);
-    qrCode->SetMatrixWidth(version->GetDimensionForVersion());
+  if (numDataBytes < numInputBytes + 3) {
+    e = BCExceptionCannotFindBlockInfo;
     return;
   }
-  e = BCExceptionCannotFindBlockInfo;
-  if (e != BCExceptionNO)
-    return;
+  qrCode->SetVersion(versionNumber);
+  qrCode->SetNumTotalBytes(numBytes);
+  qrCode->SetNumDataBytes(numDataBytes);
+  qrCode->SetNumRSBlocks(numRSBlocks);
+  qrCode->SetNumECBytes(numEcBytes);
+  qrCode->SetMatrixWidth(version->GetDimensionForVersion());
 }
 
 void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(
@@ -397,6 +387,7 @@
                         &finalBits, e);
   if (e != BCExceptionNO)
     return;
+
   std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix(
       qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()));
   matrix->Init();
@@ -404,18 +395,17 @@
       &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
   if (e != BCExceptionNO)
     return;
+
   qrCode->SetMaskPattern(maskPattern);
   CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
                                      qrCode->GetVersion(),
                                      qrCode->GetMaskPattern(), matrix.get(), e);
   if (e != BCExceptionNO)
     return;
+
   qrCode->SetMatrix(std::move(matrix));
-  if (!qrCode->IsValid()) {
+  if (!qrCode->IsValid())
     e = BCExceptionInvalidQRCode;
-    if (e != BCExceptionNO)
-      return;
-  }
 }
 
 void CBC_QRCoderEncoder::EncodeWithAutoVersion(
@@ -482,6 +472,7 @@
                         &finalBits, e);
   if (e != BCExceptionNO)
     return;
+
   std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix(
       qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()));
   matrix->Init();
@@ -489,17 +480,16 @@
       &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
   if (e != BCExceptionNO)
     return;
+
   qrCode->SetMaskPattern(maskPattern);
   CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
                                      qrCode->GetVersion(),
                                      qrCode->GetMaskPattern(), matrix.get(), e);
   if (e != BCExceptionNO)
     return qrCode->SetMatrix(std::move(matrix));
-  if (!qrCode->IsValid()) {
+
+  if (!qrCode->IsValid())
     e = BCExceptionInvalidQRCode;
-    if (e != BCExceptionNO)
-      return;
-  }
 }
 
 void CBC_QRCoderEncoder::Encode(const CFX_WideString& content,
@@ -542,6 +532,7 @@
                         &finalBits, e);
   if (e != BCExceptionNO)
     return;
+
   std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix(
       qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()));
   matrix->Init();
@@ -549,17 +540,16 @@
       &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
   if (e != BCExceptionNO)
     return;
+
   qrCode->SetMaskPattern(maskPattern);
   CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
                                      qrCode->GetVersion(),
                                      qrCode->GetMaskPattern(), matrix.get(), e);
   if (e != BCExceptionNO)
     return qrCode->SetMatrix(std::move(matrix));
-  if (!qrCode->IsValid()) {
+
+  if (!qrCode->IsValid())
     e = BCExceptionInvalidQRCode;
-    if (e != BCExceptionNO)
-      return;
-  }
 }
 
 void CBC_QRCoderEncoder::TerminateBits(int32_t numDataBytes,
@@ -568,8 +558,7 @@
   int32_t capacity = numDataBytes << 3;
   if (bits->Size() > capacity) {
     e = BCExceptionDataTooMany;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   for (int32_t i = 0; i < 4 && bits->Size() < capacity; ++i) {
     bits->AppendBit(0, e);
@@ -587,8 +576,7 @@
   }
   if (bits->Size() % 8 != 0) {
     e = BCExceptionDigitLengthMustBe8;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t numPaddingBytes = numDataBytes - bits->sizeInBytes();
   for (int32_t k = 0; k < numPaddingBytes; ++k) {
@@ -602,11 +590,8 @@
         return;
     }
   }
-  if (bits->Size() != capacity) {
+  if (bits->Size() != capacity)
     e = BCExceptionBitsNotEqualCacity;
-    if (e != BCExceptionNO)
-      return;
-  }
 }
 
 int32_t CBC_QRCoderEncoder::ChooseMaskPattern(
@@ -674,31 +659,18 @@
                                      CBC_QRCoderBitVector* bits,
                                      CFX_ByteString encoding,
                                      int32_t& e) {
-  if (mode == CBC_QRCoderMode::sNUMERIC) {
+  if (mode == CBC_QRCoderMode::sNUMERIC)
     AppendNumericBytes(content, bits, e);
-    if (e != BCExceptionNO)
-      return;
-  } else if (mode == CBC_QRCoderMode::sALPHANUMERIC) {
+  else if (mode == CBC_QRCoderMode::sALPHANUMERIC)
     AppendAlphaNumericBytes(content, bits, e);
-    if (e != BCExceptionNO)
-      return;
-  } else if (mode == CBC_QRCoderMode::sBYTE) {
+  else if (mode == CBC_QRCoderMode::sBYTE)
     Append8BitBytes(content, bits, encoding, e);
-    if (e != BCExceptionNO)
-      return;
-  } else if (mode == CBC_QRCoderMode::sKANJI) {
+  else if (mode == CBC_QRCoderMode::sKANJI)
     AppendKanjiBytes(content, bits, e);
-    if (e != BCExceptionNO)
-      return;
-  } else if (mode == CBC_QRCoderMode::sGBK) {
+  else if (mode == CBC_QRCoderMode::sGBK)
     AppendGBKBytes(content, bits, e);
-    if (e != BCExceptionNO)
-      return;
-  } else {
+  else
     e = BCExceptionUnsupportedMode;
-    if (e != BCExceptionNO)
-      return;
-  }
 }
 
 void CBC_QRCoderEncoder::AppendNumericBytes(const CFX_ByteString& content,
@@ -739,15 +711,13 @@
     int32_t code1 = GetAlphaNumericCode(content[i]);
     if (code1 == -1) {
       e = BCExceptionInvalidateCharacter;
-      if (e != BCExceptionNO)
-        return;
+      return;
     }
     if (i + 1 < length) {
       int32_t code2 = GetAlphaNumericCode(content[i + 1]);
       if (code2 == -1) {
         e = BCExceptionInvalidateCharacter;
-        if (e != BCExceptionNO)
-          return;
+        return;
       }
       bits->AppendBits(code1 * 45 + code2, 11, e);
       if (e != BCExceptionNO)
@@ -775,8 +745,7 @@
       value -= 0xA6A1;
     } else {
       e = BCExceptionInvalidateCharacter;
-      if (e != BCExceptionNO)
-        return;
+      return;
     }
     value = (uint32_t)((value >> 8) * 0x60) + (uint32_t)(value & 0xff);
     bits->AppendBits(value, 13, e);
@@ -819,8 +788,7 @@
       value -= 0xc140;
     } else {
       e = BCExceptionInvalidateCharacter;
-      if (e != BCExceptionNO)
-        return;
+      return;
     }
     value = (uint32_t)((value >> 8) * 0xc0) + (uint32_t)(value & 0xff);
     bits->AppendBits(value, 13, e);
@@ -857,19 +825,14 @@
     }
   }
   e = BCExceptionCannotFindBlockInfo;
-  if (e != BCExceptionNO)
-    return;
 }
 
 void CBC_QRCoderEncoder::AppendModeInfo(CBC_QRCoderMode* mode,
                                         CBC_QRCoderBitVector* bits,
                                         int32_t& e) {
   bits->AppendBits(mode->GetBits(), 4, e);
-  if (mode == CBC_QRCoderMode::sGBK) {
+  if (mode == CBC_QRCoderMode::sGBK)
     bits->AppendBits(1, 4, e);
-    if (e != BCExceptionNO)
-      return;
-  }
 }
 
 void CBC_QRCoderEncoder::AppendLengthInfo(int32_t numLetters,
@@ -892,8 +855,6 @@
       return;
   }
   bits->AppendBits(numLetters, numBits, e);
-  if (e != BCExceptionNO)
-    return;
 }
 
 void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
@@ -904,8 +865,7 @@
                                                int32_t& e) {
   if (bits->sizeInBytes() != numDataBytes) {
     e = BCExceptionBitsBytesNotMatch;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t dataBytesOffset = 0;
   int32_t maxNumDataBytes = 0;
@@ -932,8 +892,7 @@
   }
   if (numDataBytes != dataBytesOffset) {
     e = BCExceptionBytesNotMatchOffset;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   for (int32_t x = 0; x < maxNumDataBytes; x++) {
     for (int32_t j = 0; j < blocks.GetSize(); j++) {
@@ -958,11 +917,8 @@
   for (int32_t k = 0; k < blocks.GetSize(); k++) {
     delete blocks[k];
   }
-  if (numTotalBytes != result->sizeInBytes()) {
+  if (numTotalBytes != result->sizeInBytes())
     e = BCExceptionSizeInBytesDiffer;
-    if (e != BCExceptionNO)
-      return;
-  }
 }
 
 void CBC_QRCoderEncoder::GetNumDataBytesAndNumECBytesForBlockID(
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp
index acc0cc9..7953701 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp
@@ -128,8 +128,7 @@
                                          int32_t& e) {
   if (!CBC_QRCoder::IsValidMaskPattern(maskPattern)) {
     e = (BCExceptionInvalidateMaskPattern);
-    if (e != BCExceptionNO)
-      return false;
+    return false;
   }
   int32_t intermediate = 0, temp = 0;
   switch (maskPattern) {
@@ -162,8 +161,7 @@
       break;
     default: {
       e = BCExceptionInvalidateMaskPattern;
-      if (e != BCExceptionNO)
-        return false;
+      return false;
     }
   }
   return intermediate == 0;
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
index 757f4ef..d48d81c 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp
@@ -79,8 +79,7 @@
                                         int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   matrix->clear((uint8_t)-1);
 }
@@ -93,8 +92,7 @@
     int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   ClearMatrix(matrix, e);
   if (e != BCExceptionNO)
@@ -117,8 +115,7 @@
                                                int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   EmbedPositionDetectionPatternsAndSeparators(matrix, e);
   if (e != BCExceptionNO)
@@ -140,8 +137,7 @@
     int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   CBC_QRCoderBitVector typeInfoBits;
   typeInfoBits.Init();
@@ -171,8 +167,7 @@
                                                   int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   if (version < 7) {
     return;
@@ -200,8 +195,7 @@
                                           int32_t& e) {
   if (!matrix || !dataBits) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t bitIndex = 0;
   int32_t direction = -1;
@@ -265,13 +259,11 @@
     int32_t& e) {
   if (!bits) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   if (!CBC_QRCoder::IsValidMaskPattern(maskPattern)) {
     e = BCExceptionBadMask;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t typeInfo = (ecLevel->GetBits() << 3) | maskPattern;
   if (e != BCExceptionNO)
@@ -289,33 +281,30 @@
   bits->XOR(&maskBits, e);
   if (e != BCExceptionNO)
     return;
-  if (bits->Size() != 15) {
+  if (bits->Size() != 15)
     e = BCExceptionBitSizeNot15;
-    if (e != BCExceptionNO)
-      return;
-  }
 }
+
 void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(int32_t version,
                                                 CBC_QRCoderBitVector* bits,
                                                 int32_t& e) {
   if (!bits) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   bits->AppendBits(version, 6, e);
   if (e != BCExceptionNO)
     return;
+
   int32_t bchCode = CalculateBCHCode(version, VERSION_INFO_POLY);
   bits->AppendBits(bchCode, 12, e);
   if (e != BCExceptionNO)
     return;
-  if (bits->Size() != 18) {
+
+  if (bits->Size() != 18)
     e = BCExceptionBitSizeNot18;
-    if (e != BCExceptionNO)
-      return;
-  }
 }
+
 bool CBC_QRCoderMatrixUtil::IsEmpty(int32_t value) {
   return (uint8_t)value == 0xff;
 }
@@ -323,27 +312,25 @@
   return ((uint8_t)value == 0xff || (uint8_t)value == 0x00 ||
           (uint8_t)value == 0x01);
 }
+
 void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix,
                                                 int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   for (int32_t i = 8; i < matrix->GetWidth() - 8; i++) {
     int32_t bit = (i + 1) % 2;
     if (!IsValidValue(matrix->Get(i, 6))) {
       e = BCExceptionInvalidateImageData;
-      if (e != BCExceptionNO)
-        return;
+      return;
     }
     if (IsEmpty(matrix->Get(i, 6))) {
       matrix->Set(i, 6, bit);
     }
     if (!IsValidValue(matrix->Get(6, i))) {
       e = BCExceptionInvalidateImageData;
-      if (e != BCExceptionNO)
-        return;
+      return;
     }
     if (IsEmpty(matrix->Get(6, i))) {
       matrix->Set(6, i, bit);
@@ -355,13 +342,11 @@
     int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   if (matrix->Get(8, matrix->GetHeight() - 8) == 0) {
     e = BCExceptionHeight_8BeZero;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   matrix->Set(8, matrix->GetHeight() - 8, 1);
 }
@@ -372,14 +357,12 @@
     int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   for (int32_t x = 0; x < 8; x++) {
     if (!IsEmpty(matrix->Get(xStart + x, yStart))) {
       e = BCExceptionInvalidateData;
-      if (e != BCExceptionNO)
-        return;
+      return;
     }
     matrix->Set(xStart + x, yStart, HORIZONTAL_SEPARATION_PATTERN[0][x]);
   }
@@ -391,14 +374,12 @@
     int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   for (int32_t y = 0; y < 7; y++) {
     if (!IsEmpty(matrix->Get(xStart, yStart + y))) {
       e = BCExceptionInvalidateData;
-      if (e != BCExceptionNO)
-        return;
+      return;
     }
     matrix->Set(xStart, yStart + y, VERTICAL_SEPARATION_PATTERN[y][0]);
   }
@@ -417,8 +398,7 @@
     for (int32_t x = 0; x < 5; x++) {
       if (!IsEmpty(matrix->Get(xStart + x, y + yStart))) {
         e = BCExceptionInvalidateData;
-        if (e != BCExceptionNO)
-          return;
+        return;
       }
       matrix->Set(xStart + x, yStart + y, POSITION_ADJUSTMENT_PATTERN[y][x]);
     }
@@ -431,15 +411,13 @@
     int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   for (int32_t y = 0; y < 7; y++) {
     for (int32_t x = 0; x < 7; x++) {
       if (!IsEmpty(matrix->Get(xStart + x, yStart + y))) {
         e = BCExceptionInvalidateData;
-        if (e != BCExceptionNO)
-          return;
+        return;
       }
       matrix->Set(xStart + x, yStart + y, POSITION_DETECTION_PATTERN[y][x]);
     }
@@ -450,8 +428,7 @@
     int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   int32_t pdpWidth = 7;
   EmbedPositionDetectionPattern(0, 0, matrix, e);
@@ -493,8 +470,7 @@
     int32_t& e) {
   if (!matrix) {
     e = BCExceptionNullPointer;
-    if (e != BCExceptionNO)
-      return;
+    return;
   }
   if (version < 2) {
     return;
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp
index 87f32ed..a1283dd 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderMode.cpp
@@ -98,13 +98,10 @@
       return sFNC1_SECOND_POSITION;
     case 0x0D:
       return sGBK;
-    default: {
+    default:
       e = BCExceptionUnsupportedMode;
-      if (e != BCExceptionNO)
-        return nullptr;
-    }
+      return nullptr;
   }
-  return nullptr;
 }
 
 int32_t CBC_QRCoderMode::GetBits() const {
@@ -119,8 +116,7 @@
                                                int32_t& e) const {
   if (m_characterCountBitsForVersions.empty()) {
     e = BCExceptionCharacterNotThisMode;
-    if (e != BCExceptionNO)
-      return 0;
+    return 0;
   }
   int32_t number = version->GetVersionNumber();
   int32_t offset;
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
index 5851691..befdc17 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
@@ -372,8 +372,7 @@
     int32_t& e) {
   if ((dimension % 4) != 1) {
     e = BCExceptionRead;
-    if (e != BCExceptionNO)
-      return nullptr;
+    return nullptr;
   }
   CBC_QRCoderVersion* qcv = GetVersionForNumber((dimension - 17) >> 2, e);
   if (e != BCExceptionNO)
@@ -783,8 +782,7 @@
   }
   if (versionNumber < 1 || versionNumber > 40) {
     e = BCExceptionIllegalArgument;
-    if (e != BCExceptionNO)
-      return nullptr;
+    return nullptr;
   }
   return (*VERSION)[versionNumber - 1];
 }
diff --git a/xfa/fxbarcode/utils.h b/xfa/fxbarcode/utils.h
index e5f8e9f..1cb8d85 100644
--- a/xfa/fxbarcode/utils.h
+++ b/xfa/fxbarcode/utils.h
@@ -165,9 +165,5 @@
 #define BCExceptiontNotFoundInstance 104
 #define BCExceptionNotFoundInstance 105
 #define BCExceptionCannotMetadata 106
-#define TWO_DIGIT_DATA_LENGTH_SIZE 24
-#define THREE_DIGIT_DATA_LENGTH_SIZE 23
-#define THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH_SIZE 57
-#define FOUR_DIGIT_DATA_LENGTH_SIZE 17
 
 #endif  // XFA_FXBARCODE_UTILS_H_