summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-15 04:31:10 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-15 04:31:10 +0000
commit0a815ae46f53330b69c585c708a4ebc5b85ecdb4 (patch)
treec60a518f95ba65ceec63d4913c4ae4cdb7318219
parent79d9be89e4c6c69c9a5b851c7b1d691b29ea55fd (diff)
downloadpdfium-0a815ae46f53330b69c585c708a4ebc5b85ecdb4.tar.xz
Remove dead CBC_QRCoderEncoder code.
Change-Id: I096ba8681d779bb0cc1d7aaaedcd9f68020d5b37 Reviewed-on: https://pdfium-review.googlesource.com/42452 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--fxbarcode/qrcode/BC_QRCoderEncoder.cpp103
-rw-r--r--fxbarcode/qrcode/BC_QRCoderEncoder.h7
-rw-r--r--fxbarcode/utils.h1
3 files changed, 3 insertions, 108 deletions
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 9c600b01b0..c17e841f21 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -25,6 +25,7 @@
#include <algorithm>
#include <memory>
#include <utility>
+#include <vector>
#include "fxbarcode/BC_UtilCodingConvert.h"
#include "fxbarcode/common/BC_CommonByteArray.h"
@@ -246,49 +247,6 @@ std::unique_ptr<CBC_CommonByteArray> GenerateECBytes(
return ecBytes;
}
-int32_t GetSpanByVersion(CBC_QRCoderMode* modeFirst,
- CBC_QRCoderMode* modeSecond,
- int32_t versionNum,
- int32_t& e) {
- 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 <= CBC_QRCoderVersion::kMaxVersion)
- return 16;
- e = BCExceptionNoSuchVersion;
- return 0;
- }
- if (modeSecond == CBC_QRCoderMode::sALPHANUMERIC &&
- modeFirst == CBC_QRCoderMode::sNUMERIC) {
- if (versionNum >= 1 && versionNum <= 9)
- return 13;
- if (versionNum >= 10 && versionNum <= 26)
- return 15;
- if (versionNum >= 27 && versionNum <= CBC_QRCoderVersion::kMaxVersion)
- return 17;
- e = BCExceptionNoSuchVersion;
- return 0;
- }
- if (modeSecond == CBC_QRCoderMode::sBYTE &&
- modeFirst == CBC_QRCoderMode::sNUMERIC) {
- if (versionNum >= 1 && versionNum <= 9)
- return 6;
- if (versionNum >= 10 && versionNum <= 26)
- return 8;
- if (versionNum >= 27 && versionNum <= CBC_QRCoderVersion::kMaxVersion)
- return 9;
- e = BCExceptionNoSuchVersion;
- return 0;
- }
- return -1;
-}
-
int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix) {
return CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(matrix) +
CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(matrix) +
@@ -368,61 +326,6 @@ bool TerminateBits(int32_t numDataBytes, CBC_QRCoderBitVector* bits) {
return bits->Size() == capacity;
}
-void MergeString(std::vector<ModeStringPair>* result,
- int32_t versionNum,
- int32_t& e) {
- size_t mergeNum = 0;
- for (size_t i = 0; i + 1 < result->size(); i++) {
- auto& element1 = (*result)[i];
- auto& element2 = (*result)[i + 1];
- if (element1.first == CBC_QRCoderMode::sALPHANUMERIC) {
- int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sALPHANUMERIC,
- CBC_QRCoderMode::sBYTE, versionNum, e);
- if (e != BCExceptionNO)
- return;
- if (element2.first == CBC_QRCoderMode::sBYTE && tmp >= 0 &&
- element1.second.GetLength() < static_cast<size_t>(tmp)) {
- element2.second = element1.second + element2.second;
- result->erase(result->begin() + i);
- i--;
- mergeNum++;
- }
- } else if (element1.first == CBC_QRCoderMode::sBYTE) {
- if (element2.first == CBC_QRCoderMode::sBYTE) {
- element1.second += element2.second;
- result->erase(result->begin() + i + 1);
- i--;
- mergeNum++;
- }
- } else if (element1.first == CBC_QRCoderMode::sNUMERIC) {
- int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC,
- CBC_QRCoderMode::sBYTE, versionNum, e);
- if (e != BCExceptionNO)
- return;
- if (element2.first == CBC_QRCoderMode::sBYTE && tmp >= 0 &&
- element1.second.GetLength() < static_cast<size_t>(tmp)) {
- element2.second = element1.second + element2.second;
- result->erase(result->begin() + i);
- i--;
- mergeNum++;
- }
- tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC,
- CBC_QRCoderMode::sALPHANUMERIC, versionNum, e);
- if (e != BCExceptionNO)
- return;
- if (element2.first == CBC_QRCoderMode::sALPHANUMERIC && tmp >= 0 &&
- element1.second.GetLength() < static_cast<size_t>(tmp)) {
- element2.second = element1.second + element2.second;
- result->erase(result->begin() + i);
- i--;
- mergeNum++;
- }
- }
- }
- if (mergeNum != 0)
- MergeString(result, versionNum, e);
-}
-
void SplitString(const ByteString& content,
std::vector<ModeStringPair>* result) {
size_t index = 0;
@@ -559,10 +462,6 @@ bool InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
} // namespace
-CBC_QRCoderEncoder::CBC_QRCoderEncoder() {}
-
-CBC_QRCoderEncoder::~CBC_QRCoderEncoder() {}
-
// static
bool CBC_QRCoderEncoder::Encode(const WideString& content,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.h b/fxbarcode/qrcode/BC_QRCoderEncoder.h
index 3acbd1bde8..42790027e4 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.h
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.h
@@ -7,9 +7,6 @@
#ifndef FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
#define FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
-#include <utility>
-#include <vector>
-
#include "core/fxcrt/fx_string.h"
class CBC_QRCoder;
@@ -17,8 +14,8 @@ class CBC_QRCoderErrorCorrectionLevel;
class CBC_QRCoderEncoder {
public:
- CBC_QRCoderEncoder();
- ~CBC_QRCoderEncoder();
+ CBC_QRCoderEncoder() = delete;
+ ~CBC_QRCoderEncoder() = delete;
static bool Encode(const WideString& content,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
diff --git a/fxbarcode/utils.h b/fxbarcode/utils.h
index a8060290cd..865db65f26 100644
--- a/fxbarcode/utils.h
+++ b/fxbarcode/utils.h
@@ -48,7 +48,6 @@ enum BCFORMAT {
#define BCExceptionAIsZero 37
#define BCExceptionValueMustBeEither0or1 50
#define BCExceptionBadIndexException 52
-#define BCExceptionNoSuchVersion 58
#define BCExceptionUnsupportedMode 64
#define BCExceptionInvalidateCharacter 65
#define BCExceptionInvalidateMaskPattern 68