summaryrefslogtreecommitdiff
path: root/fxbarcode
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode')
-rw-r--r--fxbarcode/datamatrix/BC_HighLevelEncoder.cpp4
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.cpp6
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.cpp9
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.cpp5
4 files changed, 13 insertions, 11 deletions
diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index 8b8b413c9b..d2f40dd060 100644
--- a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -76,12 +76,12 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
return CFX_WideString();
context.setAllowRectangular(allowRectangular);
- if ((msg.Left(6) == MACRO_05_HEADER) && (msg.Right(1) == MACRO_TRAILER)) {
+ if ((msg.Left(6) == MACRO_05_HEADER) && (msg.Last() == MACRO_TRAILER)) {
context.writeCodeword(MACRO_05);
context.setSkipAtEnd(2);
context.m_pos += 6;
} else if ((msg.Left(6) == MACRO_06_HEADER) &&
- (msg.Right(1) == MACRO_TRAILER)) {
+ (msg.Last() == MACRO_TRAILER)) {
context.writeCodeword(MACRO_06);
context.setSkipAtEnd(2);
context.m_pos += 6;
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index 6d8d51d495..dddb9cc24d 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -109,7 +109,7 @@ uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const CFX_ByteString& contents,
return nullptr;
m_iDataLenth = 13;
- int32_t firstDigit = FXSYS_atoi(contents.Left(1).c_str());
+ int32_t firstDigit = FXSYS_DecimalCharToInt(contents.First());
int32_t parities = FIRST_DIGIT_ENCODINGS[firstDigit];
outLength = m_codeWidth;
std::unique_ptr<uint8_t, FxFreeDeleter> result(
@@ -122,7 +122,7 @@ uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const CFX_ByteString& contents,
int32_t i = 0;
for (i = 1; i <= 6; i++) {
- int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
+ int32_t digit = FXSYS_DecimalCharToInt(contents[i]);
if ((parities >> (6 - i) & 1) == 1) {
digit += 10;
}
@@ -135,7 +135,7 @@ uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const CFX_ByteString& contents,
return nullptr;
for (i = 7; i <= 12; i++) {
- int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
+ int32_t digit = FXSYS_DecimalCharToInt(contents[i]);
pos += AppendPattern(result.get(), pos, L_PATTERNS[digit], 4, 1, e);
if (e != BCExceptionNO)
return nullptr;
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 6810e9e285..3fcb1e8350 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.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/common/BC_CommonBitMatrix.h"
@@ -87,9 +88,9 @@ int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString& contents) {
int32_t even = 0;
for (FX_STRSIZE i = contents.GetLength(); i > 0; i--) {
if (i % 2) {
- odd += FXSYS_atoi(contents.Mid(i - 1, 1).c_str());
+ odd += FXSYS_DecimalCharToInt(contents[i - 1]);
} else {
- even += FXSYS_atoi(contents.Mid(i - 1, 1).c_str());
+ even += FXSYS_DecimalCharToInt(contents[i - 1]);
}
}
int32_t checksum = (odd * 3 + even) % 10;
@@ -124,7 +125,7 @@ uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const CFX_ByteString& contents,
int32_t i = 0;
for (i = 0; i <= 3; i++) {
- int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
+ int32_t digit = FXSYS_DecimalCharToInt(contents[i]);
pos += AppendPattern(result.get(), pos, L_PATTERNS[digit], 4, 0, e);
if (e != BCExceptionNO)
return nullptr;
@@ -134,7 +135,7 @@ uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const CFX_ByteString& contents,
return nullptr;
for (i = 4; i <= 7; i++) {
- int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str());
+ int32_t digit = FXSYS_DecimalCharToInt(contents[i]);
pos += AppendPattern(result.get(), pos, L_PATTERNS[digit], 4, 1, e);
if (e != BCExceptionNO)
return nullptr;
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 5782fe4e1a..fac4a1b0a3 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -24,6 +24,7 @@
#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"
@@ -72,9 +73,9 @@ int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) {
FX_STRSIZE j = 1;
for (FX_STRSIZE i = contents.GetLength(); i > 0; i--) {
if (j % 2) {
- odd += FXSYS_atoi(contents.Mid(i - 1, 1).c_str());
+ odd += FXSYS_DecimalCharToInt(contents[i - 1]);
} else {
- even += FXSYS_atoi(contents.Mid(i - 1, 1).c_str());
+ even += FXSYS_DecimalCharToInt(contents[i - 1]);
}
j++;
}