summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/oned
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-03-28 12:06:45 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-28 19:22:50 +0000
commit8b6186f89002099d406508acecf4bccc4ef64c95 (patch)
treedf104ee415cfa90a53a23b88f1f66c3c2fd8d84e /xfa/fxbarcode/oned
parentb0baff546bdcd911c80007829d9af5f05d0c04b0 (diff)
downloadpdfium-8b6186f89002099d406508acecf4bccc4ef64c95.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxbarcode/oned')
-rw-r--r--xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp24
-rw-r--r--xfa/fxbarcode/oned/BC_OnedCode128Writer.h6
2 files changed, 16 insertions, 14 deletions
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<const int32_t*> patterns;
+ std::vector<const int32_t*> 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<const int32_t*>* patterns) {
+ std::vector<const int32_t*>* 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<const int32_t*>* patterns) {
+ std::vector<const int32_t*>* 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++;
diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.h b/xfa/fxbarcode/oned/BC_OnedCode128Writer.h
index 60a2f03acc..ff6e4d0fa5 100644
--- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.h
+++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
#define XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
+#include <vector>
+
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
@@ -43,9 +45,9 @@ class CBC_OnedCode128Writer : public CBC_OneDimWriter {
private:
bool IsDigits(const CFX_ByteString& contents, int32_t start, int32_t length);
int32_t Encode128B(const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns);
+ std::vector<const int32_t*>* patterns);
int32_t Encode128C(const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns);
+ std::vector<const int32_t*>* patterns);
BC_TYPE m_codeFormat;
};