diff options
author | Lei Zhang <thestig@chromium.org> | 2017-04-27 23:58:03 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-28 19:12:30 +0000 |
commit | 60cd033adf6c469ff47bdaf85a66b5817fdd188b (patch) | |
tree | a91b3cee7aaeb0dc650fd857bfd3476da848eacf /fxbarcode/datamatrix/BC_C40Encoder.cpp | |
parent | 7831f57f04ad3f581222b0a23eeb736601f98e96 (diff) | |
download | pdfium-60cd033adf6c469ff47bdaf85a66b5817fdd188b.tar.xz |
Remove dead dimensions code in fxbarcode.chromium/3084
Remove more exceptions.
Change-Id: I3b8b8b9837b0010b1e0060ddd56e93c78f9f0fb5
Reviewed-on: https://pdfium-review.googlesource.com/4410
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxbarcode/datamatrix/BC_C40Encoder.cpp')
-rw-r--r-- | fxbarcode/datamatrix/BC_C40Encoder.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/fxbarcode/datamatrix/BC_C40Encoder.cpp b/fxbarcode/datamatrix/BC_C40Encoder.cpp index 7c3f4e7d7a..e8aa679e28 100644 --- a/fxbarcode/datamatrix/BC_C40Encoder.cpp +++ b/fxbarcode/datamatrix/BC_C40Encoder.cpp @@ -20,14 +20,30 @@ * limitations under the License. */ -#include "fxbarcode/BC_Dimension.h" -#include "fxbarcode/common/BC_CommonBitMatrix.h" #include "fxbarcode/datamatrix/BC_C40Encoder.h" + +#include "fxbarcode/common/BC_CommonBitMatrix.h" #include "fxbarcode/datamatrix/BC_Encoder.h" #include "fxbarcode/datamatrix/BC_EncoderContext.h" #include "fxbarcode/datamatrix/BC_HighLevelEncoder.h" #include "fxbarcode/datamatrix/BC_SymbolInfo.h" #include "fxbarcode/datamatrix/BC_SymbolShapeHint.h" +#include "fxbarcode/utils.h" + +namespace { + +CFX_WideString EncodeToCodewords(const CFX_WideString& sb, int32_t startPos) { + wchar_t c1 = sb.GetAt(startPos); + wchar_t c2 = sb.GetAt(startPos + 1); + wchar_t c3 = sb.GetAt(startPos + 2); + int32_t v = (1600 * c1) + (40 * c2) + c3 + 1; + wchar_t cw[2]; + cw[0] = static_cast<wchar_t>(v / 256); + cw[1] = static_cast<wchar_t>(v % 256); + return CFX_WideString(cw); +} + +} // namespace CBC_C40Encoder::CBC_C40Encoder() {} CBC_C40Encoder::~CBC_C40Encoder() {} @@ -85,7 +101,7 @@ void CBC_C40Encoder::Encode(CBC_EncoderContext& context, int32_t& e) { } void CBC_C40Encoder::writeNextTriplet(CBC_EncoderContext& context, CFX_WideString& buffer) { - context.writeCodewords(encodeToCodewords(buffer, 0)); + context.writeCodewords(EncodeToCodewords(buffer, 0)); buffer.Delete(0, 3); } void CBC_C40Encoder::handleEOD(CBC_EncoderContext& context, @@ -186,15 +202,3 @@ int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext& context, context.resetSymbolInfo(); return lastCharSize; } -CFX_WideString CBC_C40Encoder::encodeToCodewords(CFX_WideString sb, - int32_t startPos) { - wchar_t c1 = sb.GetAt(startPos); - wchar_t c2 = sb.GetAt(startPos + 1); - wchar_t c3 = sb.GetAt(startPos + 2); - int32_t v = (1600 * c1) + (40 * c2) + c3 + 1; - wchar_t cw1 = (wchar_t)(v / 256); - wchar_t cw2 = (wchar_t)(v % 256); - CFX_WideString b1(cw1); - CFX_WideString b2(cw2); - return b1 + b2; -} |