Remove class CBC_QRCoderECBlocks.

It was just a wrapper around a reference to a CBC_QRCoderECBlockData
structure that provided some non-virtual methods. Fold the methods
into CBC_QRCoderECBlockData itself.

-- Kill namespace fxbarcode with its one entry and make a longer
   name to avoid the uniqueness concern that caused the creation of
   the namespace in the first place.

-- Rename BC_QRCoderECBlocksData.* to BC_QRCoderECBlockData.* to
   match name of class inside it (no 's' after Block).

Change-Id: Ib03b167b20c28ed456409041bb438a44d47f5b64
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/119690
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxbarcode/BUILD.gn b/fxbarcode/BUILD.gn
index 0ca11c9..318cf9d 100644
--- a/fxbarcode/BUILD.gn
+++ b/fxbarcode/BUILD.gn
@@ -115,10 +115,8 @@
     "qrcode/BC_QRCoder.h",
     "qrcode/BC_QRCoderBitVector.cpp",
     "qrcode/BC_QRCoderBitVector.h",
-    "qrcode/BC_QRCoderECBlocks.cpp",
-    "qrcode/BC_QRCoderECBlocks.h",
-    "qrcode/BC_QRCoderECBlocksData.cpp",
-    "qrcode/BC_QRCoderECBlocksData.h",
+    "qrcode/BC_QRCoderECBlockData.cpp",
+    "qrcode/BC_QRCoderECBlockData.h",
     "qrcode/BC_QRCoderEncoder.cpp",
     "qrcode/BC_QRCoderEncoder.h",
     "qrcode/BC_QRCoderErrorCorrectionLevel.cpp",
diff --git a/fxbarcode/qrcode/BC_QRCoderECBlocksData.cpp b/fxbarcode/qrcode/BC_QRCoderECBlockData.cpp
similarity index 89%
rename from fxbarcode/qrcode/BC_QRCoderECBlocksData.cpp
rename to fxbarcode/qrcode/BC_QRCoderECBlockData.cpp
index 13b320e..be3d237 100644
--- a/fxbarcode/qrcode/BC_QRCoderECBlocksData.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderECBlockData.cpp
@@ -20,11 +20,9 @@
  * limitations under the License.
  */
 
-#include "fxbarcode/qrcode/BC_QRCoderECBlocksData.h"
+#include "fxbarcode/qrcode/BC_QRCoderECBlockData.h"
 
-namespace fxbarcode {
-
-const CBC_QRCoderECBlockData kECBData[40][4] = {
+const CBC_QRCoderECBlockData kQRCoderECBDataTable[40][4] = {
     {{7, 1, 19, 0, 0}, {10, 1, 16, 0, 0}, {13, 1, 13, 0, 0}, {17, 1, 9, 0, 0}},
     {{10, 1, 34, 0, 0},
      {16, 1, 28, 0, 0},
@@ -181,4 +179,19 @@
      {30, 20, 15, 61, 16}},
 };
 
-}  // namespace fxbarcode
+int32_t CBC_QRCoderECBlockData::GetECCodeWordsPerBlock() const {
+  return ecCodeWordsPerBlock;
+}
+
+int32_t CBC_QRCoderECBlockData::GetNumBlocks() const {
+  return count1 + count2;
+}
+
+int32_t CBC_QRCoderECBlockData::GetTotalECCodeWords() const {
+  return GetECCodeWordsPerBlock() * GetNumBlocks();
+}
+
+int32_t CBC_QRCoderECBlockData::GetTotalDataCodeWords() const {
+  return count1 * (dataCodeWords1 + GetECCodeWordsPerBlock()) +
+         count2 * (dataCodeWords2 + GetECCodeWordsPerBlock());
+}
diff --git a/fxbarcode/qrcode/BC_QRCoderECBlocksData.h b/fxbarcode/qrcode/BC_QRCoderECBlockData.h
similarity index 70%
rename from fxbarcode/qrcode/BC_QRCoderECBlocksData.h
rename to fxbarcode/qrcode/BC_QRCoderECBlockData.h
index 0597279..72d74c2 100644
--- a/fxbarcode/qrcode/BC_QRCoderECBlocksData.h
+++ b/fxbarcode/qrcode/BC_QRCoderECBlockData.h
@@ -10,17 +10,20 @@
 #include <stdint.h>
 
 struct CBC_QRCoderECBlockData {
+  int32_t GetNumBlocks() const;
+  int32_t GetTotalECCodeWords() const;
+  int32_t GetTotalDataCodeWords() const;
+
   uint8_t ecCodeWordsPerBlock;
   uint8_t count1;
   uint8_t dataCodeWords1;
   uint8_t count2;
   uint8_t dataCodeWords2;
+
+ private:
+  int32_t GetECCodeWordsPerBlock() const;
 };
 
-namespace fxbarcode {
-
-extern const CBC_QRCoderECBlockData kECBData[40][4];
-
-}  // namespace fxbarcode
+extern const CBC_QRCoderECBlockData kQRCoderECBDataTable[40][4];
 
 #endif  // FXBARCODE_QRCODE_BC_QRCODERECBLOCKSDATA_H_
diff --git a/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp b/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
deleted file mode 100644
index a32c409..0000000
--- a/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2014 The PDFium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
-
-#include "fxbarcode/qrcode/BC_QRCoderECBlocksData.h"
-
-CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(const CBC_QRCoderECBlockData& data)
-    : m_data(data) {}
-
-CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks() = default;
-
-int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() const {
-  return m_data.ecCodeWordsPerBlock;
-}
-
-int32_t CBC_QRCoderECBlocks::GetNumBlocks() const {
-  return m_data.count1 + m_data.count2;
-}
-
-int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords() const {
-  return GetECCodeWordsPerBlock() * GetNumBlocks();
-}
-
-int32_t CBC_QRCoderECBlocks::GetTotalDataCodeWords() const {
-  return m_data.count1 * (m_data.dataCodeWords1 + GetECCodeWordsPerBlock()) +
-         m_data.count2 * (m_data.dataCodeWords2 + GetECCodeWordsPerBlock());
-}
diff --git a/fxbarcode/qrcode/BC_QRCoderECBlocks.h b/fxbarcode/qrcode/BC_QRCoderECBlocks.h
deleted file mode 100644
index 2fd6a3f..0000000
--- a/fxbarcode/qrcode/BC_QRCoderECBlocks.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2014 The PDFium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
-#define FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
-
-#include <stdint.h>
-
-struct CBC_QRCoderECBlockData;
-
-class CBC_QRCoderECBlocks {
- public:
-  explicit CBC_QRCoderECBlocks(const CBC_QRCoderECBlockData& data);
-  ~CBC_QRCoderECBlocks();
-
-  int32_t GetNumBlocks() const;
-  int32_t GetTotalECCodeWords() const;
-  int32_t GetTotalDataCodeWords() const;
-
- private:
-  int32_t GetECCodeWordsPerBlock() const;
-
-  const CBC_QRCoderECBlockData& m_data;
-};
-
-#endif  // FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index ef1309d..572025f 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -45,7 +45,7 @@
 #include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
 #include "fxbarcode/qrcode/BC_QRCoder.h"
 #include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
-#include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
+#include "fxbarcode/qrcode/BC_QRCoderECBlockData.h"
 #include "fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
 #include "fxbarcode/qrcode/BC_QRCoderMatrixUtil.h"
 #include "fxbarcode/qrcode/BC_QRCoderMode.h"
diff --git a/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/fxbarcode/qrcode/BC_QRCoderVersion.cpp
index b31fdd4..b474fb3 100644
--- a/fxbarcode/qrcode/BC_QRCoderVersion.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderVersion.cpp
@@ -32,7 +32,7 @@
 
 #include "fxbarcode/common/BC_CommonBitMatrix.h"
 #include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
-#include "fxbarcode/qrcode/BC_QRCoderECBlocksData.h"
+#include "fxbarcode/qrcode/BC_QRCoderECBlockData.h"
 #include "fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
 
 namespace {
@@ -44,10 +44,10 @@
 CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber,
                                        const CBC_QRCoderECBlockData data[4])
     : m_versionNumber(versionNumber) {
-  m_ecBlocksArray[0] = std::make_unique<CBC_QRCoderECBlocks>(data[0]);
-  m_ecBlocksArray[1] = std::make_unique<CBC_QRCoderECBlocks>(data[1]);
-  m_ecBlocksArray[2] = std::make_unique<CBC_QRCoderECBlocks>(data[2]);
-  m_ecBlocksArray[3] = std::make_unique<CBC_QRCoderECBlocks>(data[3]);
+  m_ecBlocksArray[0] = std::make_unique<CBC_QRCoderECBlockData>(data[0]);
+  m_ecBlocksArray[1] = std::make_unique<CBC_QRCoderECBlockData>(data[1]);
+  m_ecBlocksArray[2] = std::make_unique<CBC_QRCoderECBlockData>(data[2]);
+  m_ecBlocksArray[3] = std::make_unique<CBC_QRCoderECBlockData>(data[3]);
   m_totalCodeWords = m_ecBlocksArray[0]->GetTotalDataCodeWords();
 }
 
@@ -70,7 +70,7 @@
   if (g_VERSION->empty()) {
     for (int i = 0; i < kMaxVersion; ++i) {
       g_VERSION->push_back(
-          std::make_unique<CBC_QRCoderVersion>(i + 1, fxbarcode::kECBData[i]));
+          std::make_unique<CBC_QRCoderVersion>(i + 1, kQRCoderECBDataTable[i]));
     }
   }
   if (versionNumber < 1 || versionNumber > kMaxVersion)
@@ -90,7 +90,7 @@
   return 17 + 4 * m_versionNumber;
 }
 
-const CBC_QRCoderECBlocks* CBC_QRCoderVersion::GetECBlocksForLevel(
+const CBC_QRCoderECBlockData* CBC_QRCoderVersion::GetECBlocksForLevel(
     const CBC_QRCoderErrorCorrectionLevel& ecLevel) const {
   return m_ecBlocksArray[ecLevel.Ordinal()].get();
 }
diff --git a/fxbarcode/qrcode/BC_QRCoderVersion.h b/fxbarcode/qrcode/BC_QRCoderVersion.h
index 151cc0c..ea77f54 100644
--- a/fxbarcode/qrcode/BC_QRCoderVersion.h
+++ b/fxbarcode/qrcode/BC_QRCoderVersion.h
@@ -10,7 +10,7 @@
 #include <array>
 #include <memory>
 
-#include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
+#include "fxbarcode/qrcode/BC_QRCoderECBlockData.h"
 
 class CBC_QRCoderErrorCorrectionLevel;
 
@@ -30,13 +30,13 @@
   int32_t GetVersionNumber() const;
   int32_t GetTotalCodeWords() const;
   int32_t GetDimensionForVersion() const;
-  const CBC_QRCoderECBlocks* GetECBlocksForLevel(
+  const CBC_QRCoderECBlockData* GetECBlocksForLevel(
       const CBC_QRCoderErrorCorrectionLevel& ecLevel) const;
 
  private:
   const int32_t m_versionNumber;
   int32_t m_totalCodeWords;
-  std::array<std::unique_ptr<CBC_QRCoderECBlocks>, 4> m_ecBlocksArray;
+  std::array<std::unique_ptr<CBC_QRCoderECBlockData>, 4> m_ecBlocksArray;
 };
 
 #endif  // FXBARCODE_QRCODE_BC_QRCODERVERSION_H_