From 8b6186f89002099d406508acecf4bccc4ef64c95 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 28 Mar 2017 12:06:45 -0700 Subject: Remove CFX_ArrayTemplate from FX barcode code. This is now the last usage in pdfium, types to be removed in a follow-on CL. Change-Id: I16f67eb3eb99f21bb231829168203be125129ad7 Reviewed-on: https://pdfium-review.googlesource.com/3247 Reviewed-by: dsinclair Commit-Queue: dsinclair --- xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp') diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp index c1e28a50c1..7adbb1f55c 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -187,7 +187,7 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, e = BCExceptionContentsLengthShouldBetween1and80; return nullptr; } - CFX_ArrayTemplate patterns; + std::vector patterns; int32_t checkSum = 0; if (m_codeFormat == BC_CODE128_B) { checkSum = Encode128B(contents, &patterns); @@ -198,20 +198,20 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, return nullptr; } checkSum %= 103; - patterns.Add(CODE_PATTERNS[checkSum]); - patterns.Add(CODE_PATTERNS[CODE_STOP]); + patterns.push_back(CODE_PATTERNS[checkSum]); + patterns.push_back(CODE_PATTERNS[CODE_STOP]); m_iContentLen = contents.GetLength() + 3; int32_t codeWidth = 0; - for (int32_t k = 0; k < patterns.GetSize(); k++) { + for (size_t k = 0; k < patterns.size(); k++) { const int32_t* pattern = patterns[k]; - for (int32_t j = 0; j < 7; j++) { + for (size_t j = 0; j < 7; j++) { codeWidth += pattern[j]; } } outLength = codeWidth; uint8_t* result = FX_Alloc(uint8_t, outLength); int32_t pos = 0; - for (int32_t j = 0; j < patterns.GetSize(); j++) { + for (size_t j = 0; j < patterns.size(); j++) { const int32_t* pattern = patterns[j]; pos += AppendPattern(result, pos, pattern, 7, 1, e); if (e != BCExceptionNO) { @@ -224,17 +224,17 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, int32_t CBC_OnedCode128Writer::Encode128B( const CFX_ByteString& contents, - CFX_ArrayTemplate* patterns) { + std::vector* patterns) { int32_t checkSum = 0; int32_t checkWeight = 1; int32_t position = 0; - patterns->Add(CODE_PATTERNS[CODE_START_B]); + patterns->push_back(CODE_PATTERNS[CODE_START_B]); checkSum += CODE_START_B * checkWeight; while (position < contents.GetLength()) { int32_t patternIndex = 0; patternIndex = contents[position] - ' '; position += 1; - patterns->Add(CODE_PATTERNS[patternIndex]); + patterns->push_back(CODE_PATTERNS[patternIndex]); checkSum += patternIndex * checkWeight; if (position != 0) { checkWeight++; @@ -245,11 +245,11 @@ int32_t CBC_OnedCode128Writer::Encode128B( int32_t CBC_OnedCode128Writer::Encode128C( const CFX_ByteString& contents, - CFX_ArrayTemplate* patterns) { + std::vector* patterns) { int32_t checkSum = 0; int32_t checkWeight = 1; int32_t position = 0; - patterns->Add(CODE_PATTERNS[CODE_START_C]); + patterns->push_back(CODE_PATTERNS[CODE_START_C]); checkSum += CODE_START_C * checkWeight; while (position < contents.GetLength()) { int32_t patternIndex = 0; @@ -266,7 +266,7 @@ int32_t CBC_OnedCode128Writer::Encode128C( position += 2; } } - patterns->Add(CODE_PATTERNS[patternIndex]); + patterns->push_back(CODE_PATTERNS[patternIndex]); checkSum += patternIndex * checkWeight; if (position != 0) { checkWeight++; -- cgit v1.2.3