summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/datamatrix
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode/datamatrix')
-rw-r--r--xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp6
-rw-r--r--xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp27
-rw-r--r--xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp3
-rw-r--r--xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp6
-rw-r--r--xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp3
-rw-r--r--xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp6
-rw-r--r--xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp3
-rw-r--r--xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp3
8 files changed, 38 insertions, 19 deletions
diff --git a/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp b/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp
index 8858f60012..50f02ca52d 100644
--- a/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_C40Encoder.cpp
@@ -163,7 +163,8 @@ int32_t CBC_C40Encoder::encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) {
sb += (FX_WCHAR)0x001e;
int32_t len = 2;
len += encodeChar((c - 128), sb, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, 0);
+ if (e != BCExceptionNO)
+ return 0;
return len;
} else {
e = BCExceptionIllegalArgument;
@@ -180,7 +181,8 @@ int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext& context,
context.m_pos--;
FX_WCHAR c = context.getCurrentChar();
lastCharSize = encodeChar(c, removed, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, -1);
+ if (e != BCExceptionNO)
+ return -1;
context.resetSymbolInfo();
return lastCharSize;
}
diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
index 1fe8018631..30ec1eef74 100644
--- a/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp
@@ -54,7 +54,8 @@ uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents,
int32_t& e) {
if (outWidth < 0 || outHeight < 0) {
e = BCExceptionHeightAndWidthMustBeAtLeast1;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
}
CBC_SymbolShapeHint::SymbolShapeHint shape =
CBC_SymbolShapeHint::FORCE_SQUARE;
@@ -63,20 +64,25 @@ uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString& contents,
CFX_WideString ecLevel;
CFX_WideString encoded = CBC_HighLevelEncoder::encodeHighLevel(
contents, ecLevel, shape, minSize, maxSize, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
CBC_SymbolInfo* symbolInfo = CBC_SymbolInfo::lookup(
encoded.GetLength(), shape, minSize, maxSize, true, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
CFX_WideString codewords =
CBC_ErrorCorrection::encodeECC200(encoded, symbolInfo, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
CBC_DefaultPlacement* placement =
new CBC_DefaultPlacement(codewords, symbolInfo->getSymbolDataWidth(e),
symbolInfo->getSymbolDataHeight(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
placement->place();
CBC_CommonByteMatrix* bytematrix = encodeLowLevel(placement, symbolInfo, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
outWidth = bytematrix->GetWidth();
outHeight = bytematrix->GetHeight();
uint8_t* result = FX_Alloc2D(uint8_t, outWidth, outHeight);
@@ -90,12 +96,15 @@ CBC_CommonByteMatrix* CBC_DataMatrixWriter::encodeLowLevel(
CBC_SymbolInfo* symbolInfo,
int32_t& e) {
int32_t symbolWidth = symbolInfo->getSymbolDataWidth(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
int32_t symbolHeight = symbolInfo->getSymbolDataHeight(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
CBC_CommonByteMatrix* matrix = new CBC_CommonByteMatrix(
symbolInfo->getSymbolWidth(e), symbolInfo->getSymbolHeight(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
matrix->Init();
int32_t matrixY = 0;
for (int32_t y = 0; y < symbolHeight; y++) {
diff --git a/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp b/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp
index c395f3a914..b01b3120e3 100644
--- a/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_EncoderContext.cpp
@@ -100,7 +100,8 @@ void CBC_EncoderContext::updateSymbolInfo(int32_t len, int32_t& e) {
if (!m_symbolInfo || len > m_symbolInfo->m_dataCapacity) {
m_symbolInfo =
CBC_SymbolInfo::lookup(len, m_shape, m_minSize, m_maxSize, true, e);
- BC_EXCEPTION_CHECK_ReturnVoid(e);
+ if (e != BCExceptionNO)
+ return;
}
}
void CBC_EncoderContext::resetSymbolInfo() {
diff --git a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index 7782830940..17eec1ee4f 100644
--- a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -129,7 +129,8 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
if (blockCount == 1) {
CFX_WideString ecc =
createECCBlock(codewords, symbolInfo->m_errorCodewords, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, CFX_WideString());
+ if (e != BCExceptionNO)
+ return CFX_WideString();
sb += ecc;
} else {
CFX_ArrayTemplate<int32_t> dataSizes;
@@ -152,7 +153,8 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
temp += (FX_WCHAR)codewords.GetAt(d);
}
CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e);
- BC_EXCEPTION_CHECK_ReturnValue(e, CFX_WideString());
+ if (e != BCExceptionNO)
+ return CFX_WideString();
int32_t pos = 0;
for (int32_t l = block; l < errorSizes[block] * blockCount;
l += blockCount) {
diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index 4b4b246038..abd3584761 100644
--- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -79,7 +79,8 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
CBC_Dimension* maxSize,
int32_t& e) {
CBC_EncoderContext context(msg, ecLevel, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, CFX_WideString());
+ if (e != BCExceptionNO)
+ return CFX_WideString();
context.setSymbolShape(shape);
context.setSizeConstraints(minSize, maxSize);
if ((msg.Mid(0, 6) == MACRO_05_HEADER) &&
diff --git a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp
index 77a809a511..ae74b8b2d4 100644
--- a/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_SymbolInfo.cpp
@@ -151,12 +151,14 @@ CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
}
if (minSize && (symbol->getSymbolWidth(e) < minSize->getWidth() ||
symbol->getSymbolHeight(e) < minSize->getHeight())) {
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
continue;
}
if (maxSize && (symbol->getSymbolWidth(e) > maxSize->getWidth() ||
symbol->getSymbolHeight(e) > maxSize->getHeight())) {
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
+ if (e != BCExceptionNO)
+ return nullptr;
continue;
}
if (dataCodewords <= symbol->m_dataCapacity) {
diff --git a/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp
index c8b37e9c85..e3eb4a8c4e 100644
--- a/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_TextEncoder.cpp
@@ -90,7 +90,8 @@ int32_t CBC_TextEncoder::encodeChar(FX_WCHAR c,
sb += (FX_WCHAR)0x001e;
int32_t len = 2;
len += encodeChar((FX_WCHAR)(c - 128), sb, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, -1);
+ if (e != BCExceptionNO)
+ return -1;
return len;
}
CBC_HighLevelEncoder::illegalCharacter(c, e);
diff --git a/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp b/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp
index 9ebfc46700..d77af9318a 100644
--- a/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_X12Encoder.cpp
@@ -94,7 +94,8 @@ int32_t CBC_X12Encoder::encodeChar(FX_WCHAR c, CFX_WideString& sb, int32_t& e) {
sb += (FX_WCHAR)(c - 65 + 14);
} else {
CBC_HighLevelEncoder::illegalCharacter(c, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, -1);
+ if (e != BCExceptionNO)
+ return -1;
}
return 1;
}