From e86d2f1acbd1e1d1ddae1a105b7c87f17b643f62 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 24 May 2017 00:52:54 -0700 Subject: Cleanup CBC_SymbolInfo::lookup(). Remove unused variants and simplify the one remaining variant. Change-Id: I9b6e596b479f95319a3b69f5db2c4d1b2cff4ebf Reviewed-on: https://pdfium-review.googlesource.com/5834 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- fxbarcode/datamatrix/BC_DataMatrixWriter.cpp | 2 +- fxbarcode/datamatrix/BC_EncoderContext.cpp | 2 +- fxbarcode/datamatrix/BC_SymbolInfo.cpp | 22 +--------------------- fxbarcode/datamatrix/BC_SymbolInfo.h | 9 --------- 4 files changed, 3 insertions(+), 32 deletions(-) (limited to 'fxbarcode') diff --git a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp index 0177053941..19b6346f0a 100644 --- a/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp +++ b/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp @@ -123,7 +123,7 @@ uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents, if (e != BCExceptionNO) return nullptr; CBC_SymbolInfo* symbolInfo = - CBC_SymbolInfo::lookup(encoded.GetLength(), shape, true, e); + CBC_SymbolInfo::lookup(encoded.GetLength(), shape, e); if (e != BCExceptionNO) return nullptr; CFX_WideString codewords = diff --git a/fxbarcode/datamatrix/BC_EncoderContext.cpp b/fxbarcode/datamatrix/BC_EncoderContext.cpp index b4719656b2..1c39be1aec 100644 --- a/fxbarcode/datamatrix/BC_EncoderContext.cpp +++ b/fxbarcode/datamatrix/BC_EncoderContext.cpp @@ -91,7 +91,7 @@ void CBC_EncoderContext::updateSymbolInfo(int32_t& e) { } void CBC_EncoderContext::updateSymbolInfo(int32_t len, int32_t& e) { if (!m_symbolInfo || len > m_symbolInfo->dataCapacity()) { - m_symbolInfo = CBC_SymbolInfo::lookup(len, m_shape, true, e); + m_symbolInfo = CBC_SymbolInfo::lookup(len, m_shape, e); if (e != BCExceptionNO) return; } diff --git a/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/fxbarcode/datamatrix/BC_SymbolInfo.cpp index 1d5a84f5c4..ac4815a71f 100644 --- a/fxbarcode/datamatrix/BC_SymbolInfo.cpp +++ b/fxbarcode/datamatrix/BC_SymbolInfo.cpp @@ -111,27 +111,8 @@ CBC_SymbolInfo::CBC_SymbolInfo(int32_t dataCapacity, CBC_SymbolInfo::~CBC_SymbolInfo() {} -CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, int32_t& e) { - return lookup(dataCodewords, FORCE_NONE, true, e); -} - -CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, - SymbolShapeHint shape, - int32_t& e) { - return lookup(dataCodewords, shape, true, e); -} - -CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, - bool allowRectangular, - bool fail, - int32_t& e) { - SymbolShapeHint shape = allowRectangular ? FORCE_NONE : FORCE_SQUARE; - return lookup(dataCodewords, shape, fail, e); -} - CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, SymbolShapeHint shape, - bool fail, int32_t& e) { for (size_t i = 0; i < kSymbolsCount; i++) { CBC_SymbolInfo* symbol = g_symbols[i]; @@ -142,8 +123,7 @@ CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, if (dataCodewords <= symbol->dataCapacity()) return symbol; } - if (fail) - e = BCExceptionIllegalDataCodewords; + e = BCExceptionIllegalDataCodewords; return nullptr; } diff --git a/fxbarcode/datamatrix/BC_SymbolInfo.h b/fxbarcode/datamatrix/BC_SymbolInfo.h index 7b536eccc7..55046f8fbe 100644 --- a/fxbarcode/datamatrix/BC_SymbolInfo.h +++ b/fxbarcode/datamatrix/BC_SymbolInfo.h @@ -23,18 +23,9 @@ class CBC_SymbolInfo { static void Initialize(); static void Finalize(); static void overrideSymbolSet(CBC_SymbolInfo* override); - static CBC_SymbolInfo* lookup(int32_t dataCodewords, int32_t& e); static CBC_SymbolInfo* lookup(int32_t dataCodewords, SymbolShapeHint shape, int32_t& e); - static CBC_SymbolInfo* lookup(int32_t dataCodewords, - bool allowRectangular, - bool fail, - int32_t& e); - static CBC_SymbolInfo* lookup(int32_t dataCodewords, - SymbolShapeHint shape, - bool fail, - int32_t& e); int32_t getSymbolDataWidth() const; int32_t getSymbolDataHeight() const; -- cgit v1.2.3