From 7558414b8aa1d14ce02e360dd88e4f421cee8725 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Fri, 1 Sep 2017 13:30:19 -0400 Subject: 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 Reviewed-by: Tom Sepez Reviewed-by: Henrique Nakashima --- fxbarcode/oned/BC_OnedEAN13Writer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fxbarcode') 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 #include +#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, -- cgit v1.2.3