summaryrefslogtreecommitdiff
path: root/fxbarcode/oned/BC_OnedEAN13Writer.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-01 13:30:19 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-01 17:48:53 +0000
commit7558414b8aa1d14ce02e360dd88e4f421cee8725 (patch)
tree2514a4cbf682f4222d22fc7974ca4ab6937bf2d3 /fxbarcode/oned/BC_OnedEAN13Writer.cpp
parentdce09b18b48837d8006694b9dc3b2d026e5e7869 (diff)
downloadpdfium-7558414b8aa1d14ce02e360dd88e4f421cee8725.tar.xz
Prepare for converting FX_STRSIZE int->size_t
When turning on this conversion a number of typing issues and other nits where found in the code base that can be merged in without actually changing the underlying type. Landing these changes before the type change CL, since there is a high likelihood that the type change will need to be rolled back, since it is high risk. BUG=pdfium:828 Change-Id: I587443d9090055963446485a1aacb8772eb5ca64 Reviewed-on: https://pdfium-review.googlesource.com/12810 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fxbarcode/oned/BC_OnedEAN13Writer.cpp')
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 9a48c1ebae..6d8d51d495 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -27,6 +27,7 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/fx_extension.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "fxbarcode/BC_Writer.h"
#include "fxbarcode/oned/BC_OneDimWriter.h"
@@ -81,15 +82,14 @@ int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString& contents) {
FX_STRSIZE j = 1;
for (FX_STRSIZE i = 0; i < contents.GetLength(); i++) {
if (j % 2) {
- odd += FXSYS_atoi(contents.Mid(i, 1).c_str());
+ odd += FXSYS_DecimalCharToInt(contents[i]);
} else {
- even += FXSYS_atoi(contents.Mid(i, 1).c_str());
+ even += FXSYS_DecimalCharToInt(contents[i]);
}
j++;
}
- int32_t checksum = (odd * 3 + even) % 10;
- checksum = (10 - checksum) % 10;
- return (checksum);
+ int32_t checksum = 10 - (odd * 3 + even) % 10;
+ return checksum;
}
uint8_t* CBC_OnedEAN13Writer::EncodeWithHint(const CFX_ByteString& contents,