summaryrefslogtreecommitdiff
path: root/fxbarcode/oned
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode/oned')
-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,