diff options
Diffstat (limited to 'xfa/src/fxbarcode')
219 files changed, 3430 insertions, 3430 deletions
diff --git a/xfa/src/fxbarcode/BC_BarCode.cpp b/xfa/src/fxbarcode/BC_BarCode.cpp index 063f8b5d8d..d87a0ce045 100644 --- a/xfa/src/fxbarcode/BC_BarCode.cpp +++ b/xfa/src/fxbarcode/BC_BarCode.cpp @@ -86,35 +86,35 @@ CBC_CodeBase :: CBC_CodeBase() CBC_CodeBase :: ~CBC_CodeBase()
{
}
-FX_BOOL CBC_CodeBase::SetCharEncoding(FX_INT32 encoding)
+FX_BOOL CBC_CodeBase::SetCharEncoding(int32_t encoding)
{
if (m_pBCWriter) {
return m_pBCWriter->SetCharEncoding(encoding);
}
return FALSE;
}
-FX_BOOL CBC_CodeBase::SetModuleHeight(FX_INT32 moduleHeight)
+FX_BOOL CBC_CodeBase::SetModuleHeight(int32_t moduleHeight)
{
if (m_pBCWriter) {
return m_pBCWriter->SetModuleHeight(moduleHeight);
}
return FALSE;
}
-FX_BOOL CBC_CodeBase::SetModuleWidth(FX_INT32 moduleWidth)
+FX_BOOL CBC_CodeBase::SetModuleWidth(int32_t moduleWidth)
{
if (m_pBCWriter) {
return m_pBCWriter->SetModuleWidth(moduleWidth);
}
return FALSE;
}
-FX_BOOL CBC_CodeBase::SetHeight(FX_INT32 height)
+FX_BOOL CBC_CodeBase::SetHeight(int32_t height)
{
if (m_pBCWriter) {
return m_pBCWriter->SetHeight(height);
}
return FALSE;
}
-FX_BOOL CBC_CodeBase::SetWidth(FX_INT32 width)
+FX_BOOL CBC_CodeBase::SetWidth(int32_t width)
{
if (m_pBCWriter) {
return m_pBCWriter->SetWidth(width);
@@ -160,7 +160,7 @@ void CBC_OneCode::SetPrintChecksum(FX_BOOL checksum) ((CBC_OneDimWriter*)m_pBCWriter)->SetPrintChecksum(checksum);
}
}
-void CBC_OneCode::SetDataLength(FX_INT32 length)
+void CBC_OneCode::SetDataLength(int32_t length)
{
if (m_pBCWriter) {
((CBC_OneDimWriter*)m_pBCWriter)->SetDataLength(length);
@@ -185,7 +185,7 @@ void CBC_OneCode::SetFontSize(FX_FLOAT size) ((CBC_OneDimWriter*)m_pBCWriter)->SetFontSize(size);
}
}
-void CBC_OneCode::SetFontStyle(FX_INT32 style)
+void CBC_OneCode::SetFontStyle(int32_t style)
{
if (m_pBCWriter) {
((CBC_OneDimWriter*)m_pBCWriter)->SetFontStyle(style);
@@ -223,46 +223,46 @@ CBC_Code39::~CBC_Code39() m_pBCWriter = NULL;
}
}
-FX_BOOL CBC_Code39::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_Code39::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
if(contents.IsEmpty()) {
e = BCExceptionNoContents;
return FALSE;
}
BCFORMAT format = BCFORMAT_CODE_39;
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
CFX_WideString filtercontents = ((CBC_OnedCode39Writer*)m_pBCWriter)->FilterContents(contents);
CFX_WideString renderContents = ((CBC_OnedCode39Writer*)m_pBCWriter)->RenderTextContents(contents);
m_renderContents = renderContents;
CFX_ByteString byteString = filtercontents.UTF8Encode();
- FX_BYTE *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
+ uint8_t *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_OneDimWriter*)m_pBCWriter)->RenderResult(renderContents, data, outWidth, isDevice, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_Code39::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_Code39::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
CFX_WideString renderCon = ((CBC_OnedCode39Writer*)m_pBCWriter)->encodedContents(m_renderContents, e);
((CBC_OneDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx, renderCon, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_Code39::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_Code39::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
CFX_WideString renderCon = ((CBC_OnedCode39Writer*)m_pBCWriter)->encodedContents(m_renderContents, e);
((CBC_OneDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, renderCon, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_Code39::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_Code39::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_Code39::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_Code39::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -278,7 +278,7 @@ FX_BOOL CBC_Code39::SetTextLocation(BC_TEXT_LOC location) }
return FALSE;
}
-FX_BOOL CBC_Code39::SetWideNarrowRatio(FX_INT32 ratio)
+FX_BOOL CBC_Code39::SetWideNarrowRatio(int32_t ratio)
{
if (m_pBCWriter) {
return ((CBC_OnedCode39Writer*)m_pBCWriter)->SetWideNarrowRatio(ratio);
@@ -319,52 +319,52 @@ FX_BOOL CBC_Codabar::SetTextLocation(BC_TEXT_LOC location) {
return ((CBC_OnedCodaBarWriter*) m_pBCWriter)->SetTextLocation(location);
}
-FX_BOOL CBC_Codabar::SetWideNarrowRatio(FX_INT32 ratio)
+FX_BOOL CBC_Codabar::SetWideNarrowRatio(int32_t ratio)
{
if (m_pBCWriter) {
return ((CBC_OnedCodaBarWriter*) m_pBCWriter)->SetWideNarrowRatio(ratio);
}
return FALSE;
}
-FX_BOOL CBC_Codabar::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_Codabar::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
if(contents.IsEmpty()) {
e = BCExceptionNoContents;
return FALSE;
}
BCFORMAT format = BCFORMAT_CODABAR;
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
CFX_WideString filtercontents = ((CBC_OneDimWriter*)m_pBCWriter)->FilterContents(contents);
CFX_ByteString byteString = filtercontents.UTF8Encode();
m_renderContents = filtercontents;
- FX_BYTE *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
+ uint8_t *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_OneDimWriter*)m_pBCWriter)->RenderResult(filtercontents, data, outWidth, isDevice, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_Codabar::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_Codabar::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
CFX_WideString renderCon = ((CBC_OnedCodaBarWriter*)m_pBCWriter)->encodedContents(m_renderContents);
((CBC_OneDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx, renderCon, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_Codabar::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_Codabar::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
CFX_WideString renderCon = ((CBC_OnedCodaBarWriter*)m_pBCWriter)->encodedContents(m_renderContents);
((CBC_OneDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, renderCon, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_Codabar::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_Codabar::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_Codabar::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_Codabar::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -396,15 +396,15 @@ FX_BOOL CBC_Code128::SetTextLocation(BC_TEXT_LOC location) }
return FALSE;
}
-FX_BOOL CBC_Code128::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_Code128::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
if(contents.IsEmpty()) {
e = BCExceptionNoContents;
return FALSE;
}
BCFORMAT format = BCFORMAT_CODE_128;
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
CFX_WideString content = contents;
if (contents.GetLength() % 2 && ((CBC_OnedCode128Writer *)m_pBCWriter)->GetType() == BC_CODE128_C) {
content += '0';
@@ -412,31 +412,31 @@ FX_BOOL CBC_Code128::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e) CFX_WideString encodeContents = ((CBC_OnedCode128Writer*)m_pBCWriter)->FilterContents(content);
m_renderContents = encodeContents;
CFX_ByteString byteString = encodeContents.UTF8Encode();
- FX_BYTE *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
+ uint8_t *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_OneDimWriter*)m_pBCWriter)->RenderResult(encodeContents, data, outWidth, isDevice, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_Code128::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_Code128::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
((CBC_OneDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx, m_renderContents, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_Code128::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_Code128::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
((CBC_OneDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, m_renderContents, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_Code128::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_Code128::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_Code128::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_Code128::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -464,13 +464,13 @@ CBC_EAN8::~CBC_EAN8() CFX_WideString CBC_EAN8::Preprocess(FX_WSTR contents)
{
CFX_WideString encodeContents = ((CBC_OnedEAN8Writer*)m_pBCWriter)->FilterContents(contents);
- FX_INT32 length = encodeContents.GetLength();
+ int32_t length = encodeContents.GetLength();
if (length <= 7) {
- for (FX_INT32 i = 0; i < 7 - length; i++) {
+ for (int32_t i = 0; i < 7 - length; i++) {
encodeContents = FX_WCHAR('0') + encodeContents;
}
CFX_ByteString byteString = encodeContents.UTF8Encode();
- FX_INT32 checksum = ((CBC_OnedEAN8Writer *)m_pBCWriter)->CalcChecksum(byteString);
+ int32_t checksum = ((CBC_OnedEAN8Writer *)m_pBCWriter)->CalcChecksum(byteString);
encodeContents += FX_WCHAR(checksum - 0 + '0');
}
if (length > 8) {
@@ -478,43 +478,43 @@ CFX_WideString CBC_EAN8::Preprocess(FX_WSTR contents) }
return encodeContents;
}
-FX_BOOL CBC_EAN8::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_EAN8::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
if(contents.IsEmpty()) {
e = BCExceptionNoContents;
return FALSE;
}
BCFORMAT format = BCFORMAT_EAN_8;
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
CFX_WideString encodeContents = Preprocess(contents);
CFX_ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
- FX_BYTE *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
+ uint8_t *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_OneDimWriter*)m_pBCWriter)->RenderResult(encodeContents, data, outWidth, isDevice, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_EAN8::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_EAN8::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
((CBC_OneDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx, m_renderContents, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_EAN8::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_EAN8::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
((CBC_OneDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, m_renderContents, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_EAN8::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_EAN8::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_EAN8::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_EAN8::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -542,13 +542,13 @@ CBC_EAN13::~CBC_EAN13() CFX_WideString CBC_EAN13::Preprocess(FX_WSTR contents)
{
CFX_WideString encodeContents = ((CBC_OnedEAN8Writer*)m_pBCWriter)->FilterContents(contents);
- FX_INT32 length = encodeContents.GetLength();
+ int32_t length = encodeContents.GetLength();
if (length <= 12) {
- for (FX_INT32 i = 0; i < 12 - length; i++) {
+ for (int32_t i = 0; i < 12 - length; i++) {
encodeContents = FX_WCHAR('0') + encodeContents;
}
CFX_ByteString byteString = encodeContents.UTF8Encode();
- FX_INT32 checksum = ((CBC_OnedEAN13Writer *)m_pBCWriter)->CalcChecksum(byteString);
+ int32_t checksum = ((CBC_OnedEAN13Writer *)m_pBCWriter)->CalcChecksum(byteString);
byteString += checksum - 0 + '0';
encodeContents = byteString.UTF8Decode();
}
@@ -557,43 +557,43 @@ CFX_WideString CBC_EAN13::Preprocess(FX_WSTR contents) }
return encodeContents;
}
-FX_BOOL CBC_EAN13::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_EAN13::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
if(contents.IsEmpty()) {
e = BCExceptionNoContents;
return FALSE;
}
BCFORMAT format = BCFORMAT_EAN_13;
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
CFX_WideString encodeContents = Preprocess(contents);
CFX_ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
- FX_BYTE *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
+ uint8_t *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_OneDimWriter*)m_pBCWriter)->RenderResult(encodeContents, data, outWidth, isDevice, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_EAN13::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_EAN13::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
((CBC_OneDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx, m_renderContents, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_EAN13::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_EAN13::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
((CBC_OneDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, m_renderContents, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_EAN13::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_EAN13::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_EAN13::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_EAN13::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -622,13 +622,13 @@ CBC_UPCA::~CBC_UPCA() CFX_WideString CBC_UPCA::Preprocess(FX_WSTR contents)
{
CFX_WideString encodeContents = ((CBC_OnedEAN8Writer*)m_pBCWriter)->FilterContents(contents);
- FX_INT32 length = encodeContents.GetLength();
+ int32_t length = encodeContents.GetLength();
if (length <= 11) {
- for (FX_INT32 i = 0; i < 11 - length; i++) {
+ for (int32_t i = 0; i < 11 - length; i++) {
encodeContents = FX_WCHAR('0') + encodeContents;
}
CFX_ByteString byteString = encodeContents.UTF8Encode();
- FX_INT32 checksum = ((CBC_OnedUPCAWriter *)m_pBCWriter)->CalcChecksum(byteString);
+ int32_t checksum = ((CBC_OnedUPCAWriter *)m_pBCWriter)->CalcChecksum(byteString);
byteString += checksum - 0 + '0';
encodeContents = byteString.UTF8Decode();
}
@@ -637,44 +637,44 @@ CFX_WideString CBC_UPCA::Preprocess(FX_WSTR contents) }
return encodeContents;
}
-FX_BOOL CBC_UPCA::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_UPCA::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
if(contents.IsEmpty()) {
e = BCExceptionNoContents;
return FALSE;
}
BCFORMAT format = BCFORMAT_UPC_A;
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
CFX_WideString encodeContents = Preprocess(contents);
CFX_ByteString byteString = encodeContents.UTF8Encode();
m_renderContents = encodeContents;
((CBC_OnedUPCAWriter*)m_pBCWriter)->Init();
- FX_BYTE *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
+ uint8_t *data = m_pBCWriter->Encode(byteString, format, outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_OneDimWriter*)m_pBCWriter)->RenderResult(encodeContents, data, outWidth, isDevice, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_UPCA::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_UPCA::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
((CBC_OneDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx, m_renderContents, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_UPCA::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_UPCA::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
((CBC_OneDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, m_renderContents, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_UPCA::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_UPCA::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_UPCA::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_UPCA::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -700,7 +700,7 @@ CBC_QRCode ::~CBC_QRCode() m_pBCWriter = NULL;
}
}
-FX_BOOL CBC_QRCode::SetVersion(FX_INT32 version)
+FX_BOOL CBC_QRCode::SetVersion(int32_t version)
{
if (version < 0 || version > 40) {
return FALSE;
@@ -710,7 +710,7 @@ FX_BOOL CBC_QRCode::SetVersion(FX_INT32 version) }
return((CBC_QRCodeWriter*)m_pBCWriter)->SetVersion(version);
}
-FX_BOOL CBC_QRCode::SetErrorCorrectionLevel (FX_INT32 level)
+FX_BOOL CBC_QRCode::SetErrorCorrectionLevel (int32_t level)
{
if (level < 0 || level > 3) {
return FALSE;
@@ -720,34 +720,34 @@ FX_BOOL CBC_QRCode::SetErrorCorrectionLevel (FX_INT32 level) }
return ((CBC_TwoDimWriter*)m_pBCWriter)->SetErrorCorrectionLevel(level);
}
-FX_BOOL CBC_QRCode::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_QRCode::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
- FX_BYTE *data = ((CBC_QRCodeWriter*)m_pBCWriter)->Encode(contents, ((CBC_QRCodeWriter*)m_pBCWriter)->GetErrorCorrectionLevel(), outWidth, outHeight, e);
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ uint8_t *data = ((CBC_QRCodeWriter*)m_pBCWriter)->Encode(contents, ((CBC_QRCodeWriter*)m_pBCWriter)->GetErrorCorrectionLevel(), outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_TwoDimWriter*)m_pBCWriter)->RenderResult(data, outWidth, outHeight, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_QRCode::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_QRCode::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx);
return TRUE;
}
-FX_BOOL CBC_QRCode::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_QRCode::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
((CBC_TwoDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_QRCode::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_QRCode::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_QRCode::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_QRCode::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -772,7 +772,7 @@ CBC_PDF417I::~CBC_PDF417I() m_pBCWriter = NULL;
}
}
-FX_BOOL CBC_PDF417I::SetErrorCorrectionLevel (FX_INT32 level)
+FX_BOOL CBC_PDF417I::SetErrorCorrectionLevel (int32_t level)
{
((CBC_PDF417Writer*)m_pBCWriter)->SetErrorCorrectionLevel(level);
return TRUE;
@@ -781,35 +781,35 @@ void CBC_PDF417I::SetTruncated(FX_BOOL truncated) {
((CBC_PDF417Writer*)m_pBCWriter)->SetTruncated(truncated);
}
-FX_BOOL CBC_PDF417I::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_PDF417I::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
BCFORMAT format = BCFORMAT_PDF_417;
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
- FX_BYTE *data = ((CBC_PDF417Writer*)m_pBCWriter)->Encode(contents, outWidth, outHeight, e);
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ uint8_t *data = ((CBC_PDF417Writer*)m_pBCWriter)->Encode(contents, outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_TwoDimWriter*)m_pBCWriter)->RenderResult(data, outWidth, outHeight, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_PDF417I::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_PDF417I::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx);
return TRUE;
}
-FX_BOOL CBC_PDF417I::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_PDF417I::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
((CBC_TwoDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_PDF417I::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_PDF417I::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_PDF417I::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_PDF417I::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -835,34 +835,34 @@ CBC_DataMatrix::~CBC_DataMatrix() m_pBCWriter = NULL;
}
}
-FX_BOOL CBC_DataMatrix::Encode(FX_WSTR contents, FX_BOOL isDevice, FX_INT32 &e)
+FX_BOOL CBC_DataMatrix::Encode(FX_WSTR contents, FX_BOOL isDevice, int32_t &e)
{
- FX_INT32 outWidth = 0;
- FX_INT32 outHeight = 0;
- FX_BYTE *data = ((CBC_DataMatrixWriter *)m_pBCWriter)->Encode(contents, outWidth, outHeight, e);
+ int32_t outWidth = 0;
+ int32_t outHeight = 0;
+ uint8_t *data = ((CBC_DataMatrixWriter *)m_pBCWriter)->Encode(contents, outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
((CBC_TwoDimWriter*)m_pBCWriter)->RenderResult(data, outWidth, outHeight, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-FX_BOOL CBC_DataMatrix::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, FX_INT32 &e)
+FX_BOOL CBC_DataMatrix::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t &e)
{
((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx);
return TRUE;
}
-FX_BOOL CBC_DataMatrix::RenderBitmap(CFX_DIBitmap *&pOutBitmap, FX_INT32 &e)
+FX_BOOL CBC_DataMatrix::RenderBitmap(CFX_DIBitmap *&pOutBitmap, int32_t &e)
{
((CBC_TwoDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
-CFX_WideString CBC_DataMatrix::Decode(FX_BYTE* buf, FX_INT32 width, FX_INT32 hight, FX_INT32 &e)
+CFX_WideString CBC_DataMatrix::Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t &e)
{
CFX_WideString str;
return str;
}
-CFX_WideString CBC_DataMatrix::Decode(CFX_DIBitmap *pBitmap, FX_INT32 &e)
+CFX_WideString CBC_DataMatrix::Decode(CFX_DIBitmap *pBitmap, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
diff --git a/xfa/src/fxbarcode/BC_Binarizer.h b/xfa/src/fxbarcode/BC_Binarizer.h index 730829aba1..241bc1da03 100644 --- a/xfa/src/fxbarcode/BC_Binarizer.h +++ b/xfa/src/fxbarcode/BC_Binarizer.h @@ -16,8 +16,8 @@ public: CBC_Binarizer(CBC_LuminanceSource *source);
virtual ~CBC_Binarizer();
CBC_LuminanceSource *GetLuminanceSource();
- virtual CBC_CommonBitMatrix *GetBlackMatrix(FX_INT32 &e) = 0;
- virtual CBC_CommonBitArray *GetBlackRow(FX_INT32 y, CBC_CommonBitArray *row, FX_INT32 &e) = 0;
+ virtual CBC_CommonBitMatrix *GetBlackMatrix(int32_t &e) = 0;
+ virtual CBC_CommonBitArray *GetBlackRow(int32_t y, CBC_CommonBitArray *row, int32_t &e) = 0;
private:
CBC_LuminanceSource *m_source;
};
diff --git a/xfa/src/fxbarcode/BC_BinaryBitmap.cpp b/xfa/src/fxbarcode/BC_BinaryBitmap.cpp index 90e1755cf4..f37b49c478 100644 --- a/xfa/src/fxbarcode/BC_BinaryBitmap.cpp +++ b/xfa/src/fxbarcode/BC_BinaryBitmap.cpp @@ -36,15 +36,15 @@ CBC_BinaryBitmap::~CBC_BinaryBitmap() }
m_matrix = NULL;
}
-FX_INT32 CBC_BinaryBitmap::GetHeight()
+int32_t CBC_BinaryBitmap::GetHeight()
{
return m_binarizer->GetLuminanceSource()->GetHeight();
}
-FX_INT32 CBC_BinaryBitmap::GetWidth()
+int32_t CBC_BinaryBitmap::GetWidth()
{
return m_binarizer->GetLuminanceSource()->GetWidth();
}
-CBC_CommonBitMatrix *CBC_BinaryBitmap::GetMatrix(FX_INT32 &e)
+CBC_CommonBitMatrix *CBC_BinaryBitmap::GetMatrix(int32_t &e)
{
if (m_matrix == NULL) {
m_matrix = m_binarizer->GetBlackMatrix(e);
@@ -60,13 +60,13 @@ FX_BOOL CBC_BinaryBitmap::IsRotateSupported() {
return m_binarizer->GetLuminanceSource()->IsRotateSupported();
}
-CBC_CommonBitArray *CBC_BinaryBitmap::GetBlackRow(FX_INT32 y, CBC_CommonBitArray *row, FX_INT32 &e)
+CBC_CommonBitArray *CBC_BinaryBitmap::GetBlackRow(int32_t y, CBC_CommonBitArray *row, int32_t &e)
{
CBC_CommonBitArray *temp = m_binarizer->GetBlackRow(y, row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
-CBC_CommonBitMatrix *CBC_BinaryBitmap::GetBlackMatrix(FX_INT32 &e)
+CBC_CommonBitMatrix *CBC_BinaryBitmap::GetBlackMatrix(int32_t &e)
{
if (m_matrix == NULL) {
m_matrix = m_binarizer->GetBlackMatrix(e);
diff --git a/xfa/src/fxbarcode/BC_BinaryBitmap.h b/xfa/src/fxbarcode/BC_BinaryBitmap.h index e555a2b42c..439e446354 100644 --- a/xfa/src/fxbarcode/BC_BinaryBitmap.h +++ b/xfa/src/fxbarcode/BC_BinaryBitmap.h @@ -15,11 +15,11 @@ class CBC_BinaryBitmap public:
CBC_BinaryBitmap(CBC_Binarizer *binarizer);
virtual ~CBC_BinaryBitmap();
- FX_INT32 GetWidth();
- FX_INT32 GetHeight();
- CBC_CommonBitMatrix * GetMatrix(FX_INT32 &e);
- CBC_CommonBitArray * GetBlackRow(FX_INT32 y, CBC_CommonBitArray *row, FX_INT32 &e);
- CBC_CommonBitMatrix * GetBlackMatrix(FX_INT32 &e);
+ int32_t GetWidth();
+ int32_t GetHeight();
+ CBC_CommonBitMatrix * GetMatrix(int32_t &e);
+ CBC_CommonBitArray * GetBlackRow(int32_t y, CBC_CommonBitArray *row, int32_t &e);
+ CBC_CommonBitMatrix * GetBlackMatrix(int32_t &e);
FX_BOOL IsCropSupported();
FX_BOOL IsRotateSupported();
private:
diff --git a/xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.cpp b/xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.cpp index d385c456de..423d2c74aa 100644 --- a/xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.cpp +++ b/xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.cpp @@ -47,7 +47,7 @@ static CFX_DIBitmap* CreateDIBSource(IFX_FileRead* fileread) bitmap->Create(pImageCodec->GetWidth(), pImageCodec->GetHeight(), FXDIB_Argb);
bitmap->Clear(FXARGB_MAKE(0xFF, 0xFF, 0xFF, 0xFF));
CBC_Pause pause;
- FX_INT32 frames;
+ int32_t frames;
status = pImageCodec->GetFrames(frames, &pause);
while (status == FXCODEC_STATUS_FRAME_TOBECONTINUE) {
status = pImageCodec->GetFrames(frames, &pause);
@@ -105,7 +105,7 @@ CBC_BufferedImageLuminanceSource::CBC_BufferedImageLuminanceSource(const CFX_Wid m_top = 0;
m_left = 0;
}
-void CBC_BufferedImageLuminanceSource::Init(FX_INT32 &e)
+void CBC_BufferedImageLuminanceSource::Init(int32_t &e)
{
IFX_FileRead* fileread = FX_CreateFileRead(m_filename);
m_pBitmap = CreateDIBSource(fileread);
@@ -137,27 +137,27 @@ CBC_BufferedImageLuminanceSource::~CBC_BufferedImageLuminanceSource() delete m_pBitmap;
m_pBitmap = NULL;
}
-CFX_ByteArray *CBC_BufferedImageLuminanceSource::GetRow(FX_INT32 y, CFX_ByteArray &row, FX_INT32 &e)
+CFX_ByteArray *CBC_BufferedImageLuminanceSource::GetRow(int32_t y, CFX_ByteArray &row, int32_t &e)
{
if (y < 0 || y >= m_height) {
e = BCExceptionRequestedRowIsOutSizeTheImage;
return NULL;
}
- FX_INT32 width = m_width;
+ int32_t width = m_width;
if(row.GetSize() == 0 || row.GetSize() < width) {
row.SetSize(width);
}
if(m_rgbData.GetSize() == 0 || m_rgbData.GetSize() < width) {
m_rgbData.SetSize(width);
}
- FX_INT32* rowLine = (FX_INT32*)m_pBitmap->GetScanline(y);
- FX_INT32 x;
+ int32_t* rowLine = (int32_t*)m_pBitmap->GetScanline(y);
+ int32_t x;
for (x = 0; x < width; x++) {
- FX_INT32 pixel = rowLine[x];
- FX_INT32 luminance = (306 * ((pixel >> 16) & 0xFF) +
+ int32_t pixel = rowLine[x];
+ int32_t luminance = (306 * ((pixel >> 16) & 0xFF) +
601 * ((pixel >> 8) & 0xFF) +
117 * (pixel & 0xFF)) >> 10;
- row[x] = (FX_BYTE) luminance;
+ row[x] = (uint8_t) luminance;
}
return &row;
}
@@ -165,17 +165,17 @@ CFX_ByteArray *CBC_BufferedImageLuminanceSource::GetMatrix() {
CFX_ByteArray *matirx = FX_NEW CFX_ByteArray();
matirx->SetSize(m_bytesPerLine * m_height);
- FX_INT32 *rgb = (FX_INT32*)m_pBitmap->GetBuffer();
- FX_INT32 y;
+ int32_t *rgb = (int32_t*)m_pBitmap->GetBuffer();
+ int32_t y;
for(y = 0; y < m_height; y++) {
- FX_INT32 offset = y * m_width;
- FX_INT32 x;
+ int32_t offset = y * m_width;
+ int32_t x;
for(x = 0; x < m_width; x++) {
- FX_INT32 pixel = rgb[offset + x];
- FX_INT32 luminance = (306 * ((pixel >> 16) & 0xFF) +
+ int32_t pixel = rgb[offset + x];
+ int32_t luminance = (306 * ((pixel >> 16) & 0xFF) +
601 * ((pixel >> 8) & 0xFF) +
117 * (pixel & 0xFF)) >> 10;
- (*matirx)[offset + x] = (FX_BYTE) luminance;
+ (*matirx)[offset + x] = (uint8_t) luminance;
}
}
return matirx;
@@ -188,17 +188,17 @@ FX_BOOL CBC_BufferedImageLuminanceSource::IsRotateSupported() {
return TRUE;
}
-CBC_LuminanceSource *CBC_BufferedImageLuminanceSource::Crop(FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height)
+CBC_LuminanceSource *CBC_BufferedImageLuminanceSource::Crop(int32_t left, int32_t top, int32_t width, int32_t height)
{
return NULL;
}
-CBC_LuminanceSource *CBC_BufferedImageLuminanceSource::RotateCounterClockwise(FX_INT32 &e)
+CBC_LuminanceSource *CBC_BufferedImageLuminanceSource::RotateCounterClockwise(int32_t &e)
{
if (!IsRotateSupported()) {
e = BCExceptionRotateNotSupported;
return NULL;
}
- FX_INT32 sourceWidth = m_width;
- FX_INT32 sourceHeight = m_height;
+ int32_t sourceWidth = m_width;
+ int32_t sourceHeight = m_height;
return NULL;
}
diff --git a/xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.h b/xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.h index 4bff1756d5..11d51e3c1d 100644 --- a/xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.h +++ b/xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.h @@ -14,18 +14,18 @@ public: CBC_BufferedImageLuminanceSource(const CFX_WideString &filename);
CBC_BufferedImageLuminanceSource(CFX_DIBitmap *pBitmap);
virtual ~CBC_BufferedImageLuminanceSource();
- CBC_LuminanceSource *RotateCounterClockwise(FX_INT32 &e);
- CBC_LuminanceSource *Crop(FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height);
+ CBC_LuminanceSource *RotateCounterClockwise(int32_t &e);
+ CBC_LuminanceSource *Crop(int32_t left, int32_t top, int32_t width, int32_t height);
- CFX_ByteArray *GetRow(FX_INT32 y, CFX_ByteArray &row, FX_INT32 &e);
+ CFX_ByteArray *GetRow(int32_t y, CFX_ByteArray &row, int32_t &e);
CFX_ByteArray *GetMatrix();
FX_BOOL IsCropSupported();
FX_BOOL IsRotateSupported();
- virtual void Init(FX_INT32 &e);
+ virtual void Init(int32_t &e);
private:
- FX_INT32 m_bytesPerLine;
- FX_INT32 m_left;
- FX_INT32 m_top;
+ int32_t m_bytesPerLine;
+ int32_t m_left;
+ int32_t m_top;
CFX_Int32Array m_rgbData;
CFX_DIBitmap *m_pBitmap;
const CFX_WideString m_filename;
diff --git a/xfa/src/fxbarcode/BC_DecoderResult.h b/xfa/src/fxbarcode/BC_DecoderResult.h index 9655d66383..1dcfb8ae5b 100644 --- a/xfa/src/fxbarcode/BC_DecoderResult.h +++ b/xfa/src/fxbarcode/BC_DecoderResult.h @@ -15,18 +15,18 @@ public: CFX_ByteArray* getRawBytes();
CFX_ByteString getText();
CFX_ByteString getECLevel();
- FX_INT32 getErrorsCorrected();
- void setErrorsCorrected(FX_INT32 errorsCorrected);
- FX_INT32 getErasures();
- void setErasures(FX_INT32 erasures);
+ int32_t getErrorsCorrected();
+ void setErrorsCorrected(int32_t errorsCorrected);
+ int32_t getErasures();
+ void setErasures(int32_t erasures);
void* getOther();
void setOther(void* other);
private:
CFX_ByteArray* m_rawBytes;
CFX_ByteString m_text;
CFX_ByteString m_ecLevel;
- FX_INT32 m_errorsCorrected;
- FX_INT32 m_erasures;
+ int32_t m_errorsCorrected;
+ int32_t m_erasures;
void* m_other;
};
#endif
diff --git a/xfa/src/fxbarcode/BC_Dimension.cpp b/xfa/src/fxbarcode/BC_Dimension.cpp index 5662c6eba7..dcd39ae3f1 100644 --- a/xfa/src/fxbarcode/BC_Dimension.cpp +++ b/xfa/src/fxbarcode/BC_Dimension.cpp @@ -26,7 +26,7 @@ CBC_Dimension::CBC_Dimension()
{
}
-CBC_Dimension::CBC_Dimension(FX_INT32 width, FX_INT32 height, FX_INT32 &e)
+CBC_Dimension::CBC_Dimension(int32_t width, int32_t height, int32_t &e)
{
if (width < 0 || height < 0) {
e = BCExceptionHeightAndWidthMustBeAtLeast1;
@@ -37,15 +37,15 @@ CBC_Dimension::CBC_Dimension(FX_INT32 width, FX_INT32 height, FX_INT32 &e) CBC_Dimension::~CBC_Dimension()
{
}
-FX_INT32 CBC_Dimension::getWidth()
+int32_t CBC_Dimension::getWidth()
{
return m_width;
}
-FX_INT32 CBC_Dimension::getHeight()
+int32_t CBC_Dimension::getHeight()
{
return m_height;
}
-FX_INT32 CBC_Dimension::hashCode()
+int32_t CBC_Dimension::hashCode()
{
return m_width * 32713 + m_height;
}
diff --git a/xfa/src/fxbarcode/BC_Dimension.h b/xfa/src/fxbarcode/BC_Dimension.h index 42c87a6cb3..655d5e4ad3 100644 --- a/xfa/src/fxbarcode/BC_Dimension.h +++ b/xfa/src/fxbarcode/BC_Dimension.h @@ -11,14 +11,14 @@ class CBC_Dimension {
public:
CBC_Dimension();
- CBC_Dimension(FX_INT32 width, FX_INT32 height, FX_INT32 &e);
+ CBC_Dimension(int32_t width, int32_t height, int32_t &e);
virtual ~CBC_Dimension();
- FX_INT32 getWidth();
- FX_INT32 getHeight();
- FX_INT32 hashCode();
+ int32_t getWidth();
+ int32_t getHeight();
+ int32_t hashCode();
CFX_WideString toString();
private:
- FX_INT32 m_width;
- FX_INT32 m_height;
+ int32_t m_width;
+ int32_t m_height;
};
#endif
diff --git a/xfa/src/fxbarcode/BC_Library.cpp b/xfa/src/fxbarcode/BC_Library.cpp index e84eda6099..917a902456 100644 --- a/xfa/src/fxbarcode/BC_Library.cpp +++ b/xfa/src/fxbarcode/BC_Library.cpp @@ -97,7 +97,7 @@ void BC_Library_Init() CBC_SymbolInfo::Initialize();
CBC_ErrorCorrection::Initialize();
CBC_PDF417HighLevelEncoder::Initialize();
- FX_INT32 e = 0;
+ int32_t e = 0;
CBC_PDF417ECModulusGF::Initialize(e);
CBC_DecodedBitStreamPaser::Initialize();
CBC_PDF417CodewordDecoder::Initialize();
diff --git a/xfa/src/fxbarcode/BC_LuminanceSource.cpp b/xfa/src/fxbarcode/BC_LuminanceSource.cpp index e237454a83..b656389c5e 100644 --- a/xfa/src/fxbarcode/BC_LuminanceSource.cpp +++ b/xfa/src/fxbarcode/BC_LuminanceSource.cpp @@ -22,17 +22,17 @@ #include "barcode.h"
#include "BC_LuminanceSource.h"
-CBC_LuminanceSource::CBC_LuminanceSource(FX_INT32 width, FX_INT32 height): m_width(width), m_height(height)
+CBC_LuminanceSource::CBC_LuminanceSource(int32_t width, int32_t height): m_width(width), m_height(height)
{
}
CBC_LuminanceSource::~CBC_LuminanceSource()
{
}
-FX_INT32 CBC_LuminanceSource::GetWidth()
+int32_t CBC_LuminanceSource::GetWidth()
{
return m_width;
}
-FX_INT32 CBC_LuminanceSource::GetHeight()
+int32_t CBC_LuminanceSource::GetHeight()
{
return m_height;
}
diff --git a/xfa/src/fxbarcode/BC_LuminanceSource.h b/xfa/src/fxbarcode/BC_LuminanceSource.h index 013f1b84f3..168868e421 100644 --- a/xfa/src/fxbarcode/BC_LuminanceSource.h +++ b/xfa/src/fxbarcode/BC_LuminanceSource.h @@ -10,12 +10,12 @@ class CBC_LuminanceSource; class CBC_LuminanceSource
{
public:
- CBC_LuminanceSource(FX_INT32 width, FX_INT32 height);
+ CBC_LuminanceSource(int32_t width, int32_t height);
virtual ~CBC_LuminanceSource();
- FX_INT32 GetWidth();
- FX_INT32 GetHeight();
+ int32_t GetWidth();
+ int32_t GetHeight();
- virtual CFX_ByteArray *GetRow(FX_INT32 y, CFX_ByteArray &row, FX_INT32 &e) = 0;
+ virtual CFX_ByteArray *GetRow(int32_t y, CFX_ByteArray &row, int32_t &e) = 0;
virtual CFX_ByteArray *GetMatrix() = 0;
virtual FX_BOOL IsCropSupported()
{
@@ -26,9 +26,9 @@ public: return FALSE;
}
- virtual CBC_LuminanceSource *RotateCounterClockwise(FX_INT32 &e) = 0;
+ virtual CBC_LuminanceSource *RotateCounterClockwise(int32_t &e) = 0;
protected:
- FX_INT32 m_width;
- FX_INT32 m_height;
+ int32_t m_width;
+ int32_t m_height;
};
#endif
diff --git a/xfa/src/fxbarcode/BC_Reader.h b/xfa/src/fxbarcode/BC_Reader.h index 74c12b6e2c..0db699d357 100644 --- a/xfa/src/fxbarcode/BC_Reader.h +++ b/xfa/src/fxbarcode/BC_Reader.h @@ -13,7 +13,7 @@ class CBC_Reader public:
CBC_Reader();
virtual ~CBC_Reader();
- virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e) = 0;
- virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e) = 0;
+ virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e) = 0;
+ virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e) = 0;
};
#endif
diff --git a/xfa/src/fxbarcode/BC_TwoDimWriter.cpp b/xfa/src/fxbarcode/BC_TwoDimWriter.cpp index c0456cd104..7c261aa052 100644 --- a/xfa/src/fxbarcode/BC_TwoDimWriter.cpp +++ b/xfa/src/fxbarcode/BC_TwoDimWriter.cpp @@ -27,8 +27,8 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma CFX_PathData path;
path.AppendRect(0, 0, (FX_FLOAT)m_Width, (FX_FLOAT)m_Height);
device->DrawPath(&path, matrix, &stateData, m_backgroundColor, m_backgroundColor, FXFILL_ALTERNATE);
- FX_INT32 leftPos = 0;
- FX_INT32 topPos = 0;
+ int32_t leftPos = 0;
+ int32_t topPos = 0;
if ( m_bFixedSize) {
leftPos = (m_Width - m_output->GetWidth()) / 2;
topPos = (m_Height - m_output->GetHeight()) / 2;
@@ -39,8 +39,8 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma matriScale.Concat(*matrix);
matri = matriScale;
}
- for (FX_INT32 x = 0; x < m_output->GetWidth(); x++) {
- for (FX_INT32 y = 0; y < m_output->GetHeight(); y++) {
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
CFX_PathData rect;
rect.AppendRect((FX_FLOAT)leftPos + x, (FX_FLOAT)topPos + y, (FX_FLOAT)(leftPos + x + 1), (FX_FLOAT)(topPos + y + 1));
CFX_GraphStateData stateData;
@@ -50,7 +50,7 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma }
}
}
-void CBC_TwoDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_INT32& e)
+void CBC_TwoDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, int32_t& e)
{
if (m_bFixedSize) {
pOutBitmap = CreateDIBitmap(m_Width, m_Height);
@@ -62,14 +62,14 @@ void CBC_TwoDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_INT32& e return;
}
pOutBitmap->Clear(m_backgroundColor);
- FX_INT32 leftPos = 0;
- FX_INT32 topPos = 0;
+ int32_t leftPos = 0;
+ int32_t topPos = 0;
if ( m_bFixedSize) {
leftPos = (m_Width - m_output->GetWidth()) / 2;
topPos = (m_Height - m_output->GetHeight()) / 2;
}
- for (FX_INT32 x = 0; x < m_output->GetWidth(); x++) {
- for (FX_INT32 y = 0; y < m_output->GetHeight(); y++) {
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
if (m_output->Get(x, y)) {
pOutBitmap->SetPixel(leftPos + x, topPos + y, m_barColor);
}
@@ -83,22 +83,22 @@ void CBC_TwoDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_INT32& e pOutBitmap = pStretchBitmap;
}
}
-void CBC_TwoDimWriter::RenderResult(FX_BYTE *code, FX_INT32 codeWidth, FX_INT32 codeHeight, FX_INT32 &e)
+void CBC_TwoDimWriter::RenderResult(uint8_t *code, int32_t codeWidth, int32_t codeHeight, int32_t &e)
{
- FX_INT32 inputWidth = codeWidth;
- FX_INT32 inputHeight = codeHeight;
- FX_INT32 tempWidth = inputWidth + (1 << 1);
- FX_INT32 tempHeight = inputHeight + (1 << 1);
+ int32_t inputWidth = codeWidth;
+ int32_t inputHeight = codeHeight;
+ int32_t tempWidth = inputWidth + (1 << 1);
+ int32_t tempHeight = inputHeight + (1 << 1);
FX_FLOAT moduleHSize = (FX_FLOAT)FX_MIN(m_ModuleWidth, m_ModuleHeight);
if (moduleHSize > 8) {
moduleHSize = 8;
} else if (moduleHSize < 1) {
moduleHSize = 1;
}
- FX_INT32 outputWidth = (FX_INT32)FX_MAX(tempWidth * moduleHSize, tempWidth);
- FX_INT32 outputHeight = (FX_INT32)FX_MAX(tempHeight * moduleHSize, tempHeight);
- FX_INT32 multiX = 1;
- FX_INT32 multiY = 1;
+ int32_t outputWidth = (int32_t)FX_MAX(tempWidth * moduleHSize, tempWidth);
+ int32_t outputHeight = (int32_t)FX_MAX(tempHeight * moduleHSize, tempHeight);
+ int32_t multiX = 1;
+ int32_t multiY = 1;
if (m_bFixedSize) {
if (m_Width < outputWidth || m_Height < outputHeight) {
e = BCExceptionBitmapSizeError;
@@ -106,18 +106,18 @@ void CBC_TwoDimWriter::RenderResult(FX_BYTE *code, FX_INT32 codeWidth, FX_INT32 }
} else {
if (m_Width > outputWidth || m_Height > outputHeight) {
- outputWidth = (FX_INT32)(outputWidth * ceil ( (FX_FLOAT)m_Width / (FX_FLOAT)outputWidth));
- outputHeight = (FX_INT32)(outputHeight * ceil ( (FX_FLOAT)m_Height / (FX_FLOAT)outputHeight));
+ outputWidth = (int32_t)(outputWidth * ceil ( (FX_FLOAT)m_Width / (FX_FLOAT)outputWidth));
+ outputHeight = (int32_t)(outputHeight * ceil ( (FX_FLOAT)m_Height / (FX_FLOAT)outputHeight));
}
}
- multiX = (FX_INT32)ceil((FX_FLOAT)outputWidth / (FX_FLOAT)tempWidth);
- multiY = (FX_INT32)ceil((FX_FLOAT)outputHeight / (FX_FLOAT) tempHeight);
+ multiX = (int32_t)ceil((FX_FLOAT)outputWidth / (FX_FLOAT)tempWidth);
+ multiY = (int32_t)ceil((FX_FLOAT)outputHeight / (FX_FLOAT) tempHeight);
if (m_bFixedSize) {
multiX = FX_MIN(multiX, multiY);
multiY = multiX;
}
- FX_INT32 leftPadding = (outputWidth - (inputWidth * multiX)) / 2;
- FX_INT32 topPadding = (outputHeight - (inputHeight * multiY)) / 2;
+ int32_t leftPadding = (outputWidth - (inputWidth * multiX)) / 2;
+ int32_t topPadding = (outputHeight - (inputHeight * multiY)) / 2;
if (leftPadding < 0) {
leftPadding = 0;
}
@@ -126,8 +126,8 @@ void CBC_TwoDimWriter::RenderResult(FX_BYTE *code, FX_INT32 codeWidth, FX_INT32 }
m_output = FX_NEW CBC_CommonBitMatrix;
m_output->Init(outputWidth, outputHeight);
- for (FX_INT32 inputY = 0, outputY = topPadding; (inputY < inputHeight) && (outputY < outputHeight - multiY); inputY++, outputY += multiY) {
- for (FX_INT32 inputX = 0, outputX = leftPadding; (inputX < inputWidth) && (outputX < outputWidth - multiX); inputX++, outputX += multiX) {
+ for (int32_t inputY = 0, outputY = topPadding; (inputY < inputHeight) && (outputY < outputHeight - multiY); inputY++, outputY += multiY) {
+ for (int32_t inputX = 0, outputX = leftPadding; (inputX < inputWidth) && (outputX < outputWidth - multiX); inputX++, outputX += multiX) {
if (code[inputX + inputY * inputWidth] == 1) {
m_output->SetRegion(outputX, outputY, multiX, multiY, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
diff --git a/xfa/src/fxbarcode/BC_TwoDimWriter.h b/xfa/src/fxbarcode/BC_TwoDimWriter.h index 369d494c08..9ed2932c27 100644 --- a/xfa/src/fxbarcode/BC_TwoDimWriter.h +++ b/xfa/src/fxbarcode/BC_TwoDimWriter.h @@ -15,29 +15,29 @@ class CBC_TwoDimWriter : public CBC_Writer public:
CBC_TwoDimWriter();
virtual ~CBC_TwoDimWriter();
- virtual FX_BYTE* Encode(const CFX_WideString& contents, FX_INT32 ecLevel, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+ virtual uint8_t* Encode(const CFX_WideString& contents, int32_t ecLevel, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
return NULL;
};
- virtual FX_BYTE* Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+ virtual uint8_t* Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
return NULL;
};
- virtual FX_BYTE* Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+ virtual uint8_t* Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
return NULL;
};
- virtual void RenderResult(FX_BYTE *code, FX_INT32 codeWidth, FX_INT32 codeHeight, FX_INT32 &e);
- virtual void RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_INT32& e);
+ virtual void RenderResult(uint8_t *code, int32_t codeWidth, int32_t codeHeight, int32_t &e);
+ virtual void RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, int32_t& e);
virtual void RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix);
- virtual FX_BOOL SetErrorCorrectionLevel (FX_INT32 level) = 0;
- virtual FX_INT32 GetErrorCorrectionLevel()
+ virtual FX_BOOL SetErrorCorrectionLevel (int32_t level) = 0;
+ virtual int32_t GetErrorCorrectionLevel()
{
return m_iCorrectLevel;
};
protected:
- FX_INT32 m_iCorrectLevel;
+ int32_t m_iCorrectLevel;
FX_BOOL m_bFixedSize;
CBC_CommonBitMatrix* m_output;
};
diff --git a/xfa/src/fxbarcode/BC_UtilCodingConvert.cpp b/xfa/src/fxbarcode/BC_UtilCodingConvert.cpp index c6aa1f3eb7..440df7c889 100644 --- a/xfa/src/fxbarcode/BC_UtilCodingConvert.cpp +++ b/xfa/src/fxbarcode/BC_UtilCodingConvert.cpp @@ -25,20 +25,20 @@ void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString &src, CFX_ByteArra {
CFX_WideString unicode = CFX_WideString::FromLocal(src, src.GetLength());
CFX_ByteString utf8 = unicode.UTF8Encode();
- for (FX_INT32 i = 0; i < utf8.GetLength(); i ++) {
+ for (int32_t i = 0; i < utf8.GetLength(); i ++) {
dst.Add(utf8[i]);
}
}
void CBC_UtilCodingConvert::Utf8ToLocale(const CFX_ByteArray &src, CFX_ByteString &dst)
{
CFX_ByteString utf8;
- for (FX_INT32 i = 0; i < src.GetSize(); i ++) {
+ for (int32_t i = 0; i < src.GetSize(); i ++) {
utf8 += src[i];
}
CFX_WideString unicode = CFX_WideString::FromUTF8(utf8, utf8.GetLength());
dst.ConvertFrom(unicode);
}
-void CBC_UtilCodingConvert::Utf8ToLocale(const FX_BYTE *src, FX_INT32 count, CFX_ByteString &dst)
+void CBC_UtilCodingConvert::Utf8ToLocale(const uint8_t *src, int32_t count, CFX_ByteString &dst)
{
CFX_WideString unicode = CFX_WideString::FromUTF8((const char*)src, count);
dst.ConvertFrom(unicode);
diff --git a/xfa/src/fxbarcode/BC_UtilCodingConvert.h b/xfa/src/fxbarcode/BC_UtilCodingConvert.h index c5dc5a415e..175d32e4f6 100644 --- a/xfa/src/fxbarcode/BC_UtilCodingConvert.h +++ b/xfa/src/fxbarcode/BC_UtilCodingConvert.h @@ -16,7 +16,7 @@ public: static void LocaleToUtf8(const CFX_ByteString &source, CFX_ByteString &result);
static void LocaleToUtf8(const CFX_ByteString &source, CFX_ByteArray &result);
static void Utf8ToLocale(const CFX_ByteArray &source, CFX_ByteString &result);
- static void Utf8ToLocale(const FX_BYTE *source, FX_INT32 count, CFX_ByteString &result);
+ static void Utf8ToLocale(const uint8_t *source, int32_t count, CFX_ByteString &result);
static void UnicodeToUTF8(const CFX_WideString &source, CFX_ByteString &result);
};
#endif
diff --git a/xfa/src/fxbarcode/BC_UtilRSS.cpp b/xfa/src/fxbarcode/BC_UtilRSS.cpp index c65df34e13..8ebfb6d6f1 100644 --- a/xfa/src/fxbarcode/BC_UtilRSS.cpp +++ b/xfa/src/fxbarcode/BC_UtilRSS.cpp @@ -28,17 +28,17 @@ CBC_UtilRSS::CBC_UtilRSS() CBC_UtilRSS::~CBC_UtilRSS()
{
}
-CFX_Int32Array *CBC_UtilRSS::GetRssWidths(FX_INT32 val, FX_INT32 n, FX_INT32 elements, FX_INT32 maxWidth, FX_BOOL noNarrow)
+CFX_Int32Array *CBC_UtilRSS::GetRssWidths(int32_t val, int32_t n, int32_t elements, int32_t maxWidth, FX_BOOL noNarrow)
{
CFX_Int32Array *iTemp = FX_NEW CFX_Int32Array;
iTemp->SetSize(elements);
CBC_AutoPtr<CFX_Int32Array > widths(iTemp);
- FX_INT32 bar;
- FX_INT32 narrowMask = 0;
+ int32_t bar;
+ int32_t narrowMask = 0;
for (bar = 0; bar < elements - 1; bar++) {
narrowMask |= (1 << bar);
- FX_INT32 elmWidth = 1;
- FX_INT32 subVal;
+ int32_t elmWidth = 1;
+ int32_t subVal;
while (TRUE) {
subVal = Combins(n - elmWidth - 1, elements - bar - 2);
if (noNarrow && (narrowMask == 0) &&
@@ -46,8 +46,8 @@ CFX_Int32Array *CBC_UtilRSS::GetRssWidths(FX_INT32 val, FX_INT32 n, FX_INT32 ele subVal -= Combins(n - elmWidth - (elements - bar), elements - bar - 2);
}
if (elements - bar - 1 > 1) {
- FX_INT32 lessVal = 0;
- for (FX_INT32 mxwElement = n - elmWidth - (elements - bar - 2);
+ int32_t lessVal = 0;
+ for (int32_t mxwElement = n - elmWidth - (elements - bar - 2);
mxwElement > maxWidth;
mxwElement--) {
lessVal += Combins(n - elmWidth - mxwElement - 1, elements - bar - 3);
@@ -70,29 +70,29 @@ CFX_Int32Array *CBC_UtilRSS::GetRssWidths(FX_INT32 val, FX_INT32 n, FX_INT32 ele (*widths)[bar] = n;
return widths.release();
}
-FX_INT32 CBC_UtilRSS::GetRSSvalue(CFX_Int32Array &widths, FX_INT32 maxWidth, FX_BOOL noNarrow)
+int32_t CBC_UtilRSS::GetRSSvalue(CFX_Int32Array &widths, int32_t maxWidth, FX_BOOL noNarrow)
{
- FX_INT32 elements = widths.GetSize();
- FX_INT32 n = 0;
- for (FX_INT32 i = 0; i < elements; i++) {
+ int32_t elements = widths.GetSize();
+ int32_t n = 0;
+ for (int32_t i = 0; i < elements; i++) {
n += widths[i];
}
- FX_INT32 val = 0;
- FX_INT32 narrowMask = 0;
- for (FX_INT32 bar = 0; bar < elements - 1; bar++) {
- FX_INT32 elmWidth;
+ int32_t val = 0;
+ int32_t narrowMask = 0;
+ for (int32_t bar = 0; bar < elements - 1; bar++) {
+ int32_t elmWidth;
for (elmWidth = 1, narrowMask |= (1 << bar);
elmWidth < widths[bar];
elmWidth++, narrowMask &= ~(1 << bar)) {
- FX_INT32 subVal = Combins(n - elmWidth - 1, elements - bar - 2);
+ int32_t subVal = Combins(n - elmWidth - 1, elements - bar - 2);
if (noNarrow && (narrowMask == 0) &&
(n - elmWidth - (elements - bar - 1) >= elements - bar - 1)) {
subVal -= Combins(n - elmWidth - (elements - bar),
elements - bar - 2);
}
if (elements - bar - 1 > 1) {
- FX_INT32 lessVal = 0;
- for (FX_INT32 mxwElement = n - elmWidth - (elements - bar - 2);
+ int32_t lessVal = 0;
+ for (int32_t mxwElement = n - elmWidth - (elements - bar - 2);
mxwElement > maxWidth; mxwElement--) {
lessVal += Combins(n - elmWidth - mxwElement - 1,
elements - bar - 3);
@@ -107,10 +107,10 @@ FX_INT32 CBC_UtilRSS::GetRSSvalue(CFX_Int32Array &widths, FX_INT32 maxWidth, FX_ }
return val;
}
-FX_INT32 CBC_UtilRSS::Combins(FX_INT32 n, FX_INT32 r)
+int32_t CBC_UtilRSS::Combins(int32_t n, int32_t r)
{
- FX_INT32 maxDenom;
- FX_INT32 minDenom;
+ int32_t maxDenom;
+ int32_t minDenom;
if (n - r > r) {
minDenom = r;
maxDenom = n - r;
@@ -118,9 +118,9 @@ FX_INT32 CBC_UtilRSS::Combins(FX_INT32 n, FX_INT32 r) minDenom = n - r;
maxDenom = r;
}
- FX_INT32 val = 1;
- FX_INT32 j = 1;
- for (FX_INT32 i = n; i > maxDenom; i--) {
+ int32_t val = 1;
+ int32_t j = 1;
+ for (int32_t i = n; i > maxDenom; i--) {
val *= i;
if (j <= minDenom) {
val /= j;
@@ -133,15 +133,15 @@ FX_INT32 CBC_UtilRSS::Combins(FX_INT32 n, FX_INT32 r) }
return val;
}
-CFX_Int32Array *CBC_UtilRSS::Elements(CFX_Int32Array &eDist, FX_INT32 N, FX_INT32 K)
+CFX_Int32Array *CBC_UtilRSS::Elements(CFX_Int32Array &eDist, int32_t N, int32_t K)
{
CFX_Int32Array *widths = FX_NEW CFX_Int32Array;
widths->SetSize(eDist.GetSize() + 2);
- FX_INT32 twoK = K << 1;
+ int32_t twoK = K << 1;
(*widths)[0] = 1;
- FX_INT32 i;
- FX_INT32 minEven = 10;
- FX_INT32 barSum = 1;
+ int32_t i;
+ int32_t minEven = 10;
+ int32_t barSum = 1;
for (i = 1; i < twoK - 2; i += 2) {
(*widths)[i] = eDist[i - 1] - (*widths)[i - 1];
(*widths)[i + 1] = eDist[i] - (*widths)[i];
diff --git a/xfa/src/fxbarcode/BC_UtilRSS.h b/xfa/src/fxbarcode/BC_UtilRSS.h index 076e2f263d..3c63a51579 100644 --- a/xfa/src/fxbarcode/BC_UtilRSS.h +++ b/xfa/src/fxbarcode/BC_UtilRSS.h @@ -11,12 +11,12 @@ class CBC_UtilRSS {
public:
virtual ~CBC_UtilRSS();
- static FX_INT32 GetRSSvalue(CFX_Int32Array &widths, FX_INT32 maxWidth, FX_BOOL noNarrow);
+ static int32_t GetRSSvalue(CFX_Int32Array &widths, int32_t maxWidth, FX_BOOL noNarrow);
protected:
- static CFX_Int32Array *GetRssWidths(FX_INT32 val, FX_INT32 n, FX_INT32 elements, FX_INT32 maxWidth, FX_BOOL noNarrow);
- static FX_INT32 Combins(FX_INT32 n, FX_INT32 r);
- static CFX_Int32Array *Elements(CFX_Int32Array &eDist, FX_INT32 N, FX_INT32 K);
+ static CFX_Int32Array *GetRssWidths(int32_t val, int32_t n, int32_t elements, int32_t maxWidth, FX_BOOL noNarrow);
+ static int32_t Combins(int32_t n, int32_t r);
+ static CFX_Int32Array *Elements(CFX_Int32Array &eDist, int32_t N, int32_t K);
private:
CBC_UtilRSS();
};
diff --git a/xfa/src/fxbarcode/BC_Utils.cpp b/xfa/src/fxbarcode/BC_Utils.cpp index 3a04ebda2b..8ddbb51d49 100644 --- a/xfa/src/fxbarcode/BC_Utils.cpp +++ b/xfa/src/fxbarcode/BC_Utils.cpp @@ -5,36 +5,36 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "barcode.h"
-FX_BOOL BC_FX_ByteString_Replace(CFX_ByteString &dst, FX_DWORD first, FX_DWORD last, FX_INT32 count, FX_CHAR c)
+FX_BOOL BC_FX_ByteString_Replace(CFX_ByteString &dst, FX_DWORD first, FX_DWORD last, int32_t count, FX_CHAR c)
{
if (first > last || count <= 0) {
return FALSE;
}
dst.Delete(first, last - first);
- for (FX_INT32 i = 0; i < count; i ++) {
+ for (int32_t i = 0; i < count; i ++) {
dst.Insert(0, c);
}
return TRUE;
}
-void BC_FX_ByteString_Append(CFX_ByteString &dst, FX_INT32 count, FX_CHAR c)
+void BC_FX_ByteString_Append(CFX_ByteString &dst, int32_t count, FX_CHAR c)
{
- for (FX_INT32 i = 0; i < count; i ++) {
+ for (int32_t i = 0; i < count; i ++) {
dst += c;
}
}
void BC_FX_ByteString_Append(CFX_ByteString &dst, const CFX_ByteArray &ba)
{
- for (FX_INT32 i = 0; i < ba.GetSize(); i ++) {
+ for (int32_t i = 0; i < ba.GetSize(); i ++) {
dst += ba[i];
}
}
void BC_FX_PtrArray_Sort(CFX_PtrArray &src, BC_PtrArrayCompareCallback fun)
{
- FX_INT32 nLength = src.GetSize();
+ int32_t nLength = src.GetSize();
FX_BOOL changed = true;
do {
changed = false;
- for (FX_INT32 i = 0; i < nLength - 1; i++) {
+ for (int32_t i = 0; i < nLength - 1; i++) {
if ( fun(src[i + 1], src[i]) ) {
void *temp = src[i];
src.SetAt(i, src[i + 1]);
diff --git a/xfa/src/fxbarcode/BC_Writer.cpp b/xfa/src/fxbarcode/BC_Writer.cpp index 69276dd1f4..07dabb31ed 100644 --- a/xfa/src/fxbarcode/BC_Writer.cpp +++ b/xfa/src/fxbarcode/BC_Writer.cpp @@ -20,12 +20,12 @@ CBC_Writer::CBC_Writer() CBC_Writer::~CBC_Writer()
{
}
-FX_BOOL CBC_Writer::SetCharEncoding(FX_INT32 encoding)
+FX_BOOL CBC_Writer::SetCharEncoding(int32_t encoding)
{
m_CharEncoding = encoding;
return TRUE;
}
-FX_BOOL CBC_Writer::SetModuleHeight(FX_INT32 moduleHeight)
+FX_BOOL CBC_Writer::SetModuleHeight(int32_t moduleHeight)
{
if (moduleHeight > 10 || moduleHeight < 1) {
return FALSE;
@@ -33,7 +33,7 @@ FX_BOOL CBC_Writer::SetModuleHeight(FX_INT32 moduleHeight) m_ModuleHeight = moduleHeight;
return TRUE;
}
-FX_BOOL CBC_Writer::SetModuleWidth(FX_INT32 moduleWidth)
+FX_BOOL CBC_Writer::SetModuleWidth(int32_t moduleWidth)
{
if ( moduleWidth > 10 || moduleWidth < 1) {
return FALSE;
@@ -41,12 +41,12 @@ FX_BOOL CBC_Writer::SetModuleWidth(FX_INT32 moduleWidth) m_ModuleWidth = moduleWidth;
return TRUE;
}
-FX_BOOL CBC_Writer::SetHeight(FX_INT32 height)
+FX_BOOL CBC_Writer::SetHeight(int32_t height)
{
m_Height = height;
return TRUE;
}
-FX_BOOL CBC_Writer::SetWidth(FX_INT32 width)
+FX_BOOL CBC_Writer::SetWidth(int32_t width)
{
m_Width = width;
return TRUE;
@@ -59,7 +59,7 @@ void CBC_Writer::SetBarcodeColor(FX_ARGB foregroundColor) {
m_barColor = foregroundColor;
}
-CFX_DIBitmap* CBC_Writer::CreateDIBitmap(FX_INT32 width, FX_INT32 height)
+CFX_DIBitmap* CBC_Writer::CreateDIBitmap(int32_t width, int32_t height)
{
CFX_DIBitmap *pDIBitmap = NULL;
pDIBitmap = FX_NEW CFX_DIBitmap;
diff --git a/xfa/src/fxbarcode/BC_Writer.h b/xfa/src/fxbarcode/BC_Writer.h index d92dc9b2ea..3d226255c6 100644 --- a/xfa/src/fxbarcode/BC_Writer.h +++ b/xfa/src/fxbarcode/BC_Writer.h @@ -12,22 +12,22 @@ class CBC_Writer public:
CBC_Writer();
virtual ~CBC_Writer();
- virtual FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e) = 0;
- virtual FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e) = 0;
- virtual FX_BOOL SetCharEncoding(FX_INT32 encoding);
- virtual FX_BOOL SetModuleHeight(FX_INT32 moduleHeight);
- virtual FX_BOOL SetModuleWidth(FX_INT32 moduleWidth);
- virtual FX_BOOL SetHeight(FX_INT32 height);
- virtual FX_BOOL SetWidth(FX_INT32 width);
+ virtual uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e) = 0;
+ virtual uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e) = 0;
+ virtual FX_BOOL SetCharEncoding(int32_t encoding);
+ virtual FX_BOOL SetModuleHeight(int32_t moduleHeight);
+ virtual FX_BOOL SetModuleWidth(int32_t moduleWidth);
+ virtual FX_BOOL SetHeight(int32_t height);
+ virtual FX_BOOL SetWidth(int32_t width);
virtual void SetBackgroundColor(FX_ARGB backgroundColor);
virtual void SetBarcodeColor(FX_ARGB foregroundColor);
protected:
- CFX_DIBitmap* CreateDIBitmap(FX_INT32 width, FX_INT32 height);
- FX_INT32 m_CharEncoding;
- FX_INT32 m_ModuleHeight;
- FX_INT32 m_ModuleWidth;
- FX_INT32 m_Height;
- FX_INT32 m_Width;
+ CFX_DIBitmap* CreateDIBitmap(int32_t width, int32_t height);
+ int32_t m_CharEncoding;
+ int32_t m_ModuleHeight;
+ int32_t m_ModuleWidth;
+ int32_t m_Height;
+ int32_t m_Width;
FXDIB_Format m_colorSpace;
FX_ARGB m_barColor;
FX_ARGB m_backgroundColor;
diff --git a/xfa/src/fxbarcode/common/BC_CommonBitArray.cpp b/xfa/src/fxbarcode/common/BC_CommonBitArray.cpp index 6263affbe8..a73fd37148 100644 --- a/xfa/src/fxbarcode/common/BC_CommonBitArray.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonBitArray.cpp @@ -32,7 +32,7 @@ CBC_CommonBitArray::CBC_CommonBitArray() m_bits.SetSize(1);
m_size = 0;
}
-CBC_CommonBitArray::CBC_CommonBitArray(FX_INT32 size)
+CBC_CommonBitArray::CBC_CommonBitArray(int32_t size)
{
m_bits.SetSize((size + 31) >> 5);
m_size = size;
@@ -41,7 +41,7 @@ CBC_CommonBitArray::~CBC_CommonBitArray() {
m_size = 0;
}
-FX_INT32 CBC_CommonBitArray::GetSize()
+int32_t CBC_CommonBitArray::GetSize()
{
return m_size;
}
@@ -49,31 +49,31 @@ CFX_Int32Array& CBC_CommonBitArray::GetBits() {
return m_bits;
}
-FX_INT32 CBC_CommonBitArray::GetSizeInBytes()
+int32_t CBC_CommonBitArray::GetSizeInBytes()
{
return (m_size + 7) >> 3;
}
-FX_BOOL CBC_CommonBitArray::Get(FX_INT32 i)
+FX_BOOL CBC_CommonBitArray::Get(int32_t i)
{
return (m_bits[i >> 5] & (1 << (i & 0x1f))) != 0;
}
-void CBC_CommonBitArray::Set(FX_INT32 i)
+void CBC_CommonBitArray::Set(int32_t i)
{
m_bits[i >> 5] |= 1 << (i & 0x1F);
}
-void CBC_CommonBitArray::Flip(FX_INT32 i)
+void CBC_CommonBitArray::Flip(int32_t i)
{
m_bits[i >> 5] ^= 1 << (i & 0x1F);
}
-void CBC_CommonBitArray::SetBulk(FX_INT32 i, FX_INT32 newBits)
+void CBC_CommonBitArray::SetBulk(int32_t i, int32_t newBits)
{
m_bits[i >> 5] = newBits;
}
void CBC_CommonBitArray::Clear()
{
- FXSYS_memset32(&m_bits[0], 0x00, m_bits.GetSize() * sizeof(FX_INT32));
+ FXSYS_memset32(&m_bits[0], 0x00, m_bits.GetSize() * sizeof(int32_t));
}
-FX_BOOL CBC_CommonBitArray::IsRange(FX_INT32 start, FX_INT32 end, FX_BOOL value, FX_INT32 &e)
+FX_BOOL CBC_CommonBitArray::IsRange(int32_t start, int32_t end, FX_BOOL value, int32_t &e)
{
if (end < start) {
e = BCExceptionEndLessThanStart;
@@ -83,18 +83,18 @@ FX_BOOL CBC_CommonBitArray::IsRange(FX_INT32 start, FX_INT32 end, FX_BOOL value, return TRUE;
}
end--;
- FX_INT32 firstInt = start >> 5;
- FX_INT32 lastInt = end >> 5;
- FX_INT32 i;
+ int32_t firstInt = start >> 5;
+ int32_t lastInt = end >> 5;
+ int32_t i;
for (i = firstInt; i <= lastInt; i++) {
- FX_INT32 firstBit = i > firstInt ? 0 : start & 0x1F;
- FX_INT32 lastBit = i < lastInt ? 31 : end & 0x1F;
- FX_INT32 mask;
+ int32_t firstBit = i > firstInt ? 0 : start & 0x1F;
+ int32_t lastBit = i < lastInt ? 31 : end & 0x1F;
+ int32_t mask;
if (firstBit == 0 && lastBit == 31) {
mask = -1;
} else {
mask = 0;
- for (FX_INT32 j = firstBit; j <= lastBit; j++) {
+ for (int32_t j = firstBit; j <= lastBit; j++) {
mask |= 1 << j;
}
}
@@ -104,21 +104,21 @@ FX_BOOL CBC_CommonBitArray::IsRange(FX_INT32 start, FX_INT32 end, FX_BOOL value, }
return TRUE;
}
-FX_INT32* CBC_CommonBitArray::GetBitArray()
+int32_t* CBC_CommonBitArray::GetBitArray()
{
return &m_bits[0];
}
void CBC_CommonBitArray::Reverse()
{
- FX_INT32* newBits = FX_Alloc(FX_INT32, m_bits.GetSize());
- FXSYS_memset32(newBits, 0x00, m_bits.GetSize() * sizeof(FX_INT32));
- FX_INT32 size = m_size;
- FX_INT32 i;
+ int32_t* newBits = FX_Alloc(int32_t, m_bits.GetSize());
+ FXSYS_memset32(newBits, 0x00, m_bits.GetSize() * sizeof(int32_t));
+ int32_t size = m_size;
+ int32_t i;
for (i = 0; i < size; i++) {
if (Get(size - i - 1)) {
newBits[i >> 5] |= 1 << (i & 0x1F);
}
}
- FXSYS_memcpy32(&m_bits[0], newBits, m_bits.GetSize() * sizeof(FX_INT32));
+ FXSYS_memcpy32(&m_bits[0], newBits, m_bits.GetSize() * sizeof(int32_t));
FX_Free(newBits);
}
diff --git a/xfa/src/fxbarcode/common/BC_CommonBitArray.h b/xfa/src/fxbarcode/common/BC_CommonBitArray.h index d1c8f6d528..32b94f4912 100644 --- a/xfa/src/fxbarcode/common/BC_CommonBitArray.h +++ b/xfa/src/fxbarcode/common/BC_CommonBitArray.h @@ -10,22 +10,22 @@ class CBC_CommonBitArray {
public:
CBC_CommonBitArray(CBC_CommonBitArray* array);
- CBC_CommonBitArray(FX_INT32 size);
+ CBC_CommonBitArray(int32_t size);
CBC_CommonBitArray();
virtual ~CBC_CommonBitArray();
- FX_INT32 GetSize();
+ int32_t GetSize();
CFX_Int32Array& GetBits();
- FX_INT32 GetSizeInBytes();
- FX_BOOL Get(FX_INT32 i);
- void Set(FX_INT32 i);
- void Flip(FX_INT32 i);
- void SetBulk(FX_INT32 i, FX_INT32 newBits);
- FX_BOOL IsRange(FX_INT32 start, FX_INT32 end, FX_BOOL value, FX_INT32 &e);
- FX_INT32 *GetBitArray();
+ int32_t GetSizeInBytes();
+ FX_BOOL Get(int32_t i);
+ void Set(int32_t i);
+ void Flip(int32_t i);
+ void SetBulk(int32_t i, int32_t newBits);
+ FX_BOOL IsRange(int32_t start, int32_t end, FX_BOOL value, int32_t &e);
+ int32_t *GetBitArray();
void Reverse();
void Clear();
private:
- FX_INT32 m_size;
+ int32_t m_size;
CFX_Int32Array m_bits;
};
#endif
diff --git a/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp b/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp index df24d1dabb..135dd2ff28 100644 --- a/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp @@ -30,23 +30,23 @@ CBC_CommonBitMatrix::CBC_CommonBitMatrix() m_rowSize = 0;
m_bits = NULL;
}
-void CBC_CommonBitMatrix::Init(FX_INT32 dimension)
+void CBC_CommonBitMatrix::Init(int32_t dimension)
{
m_width = dimension;
m_height = dimension;
- FX_INT32 rowSize = (m_height + 31) >> 5;
+ int32_t rowSize = (m_height + 31) >> 5;
m_rowSize = rowSize;
- m_bits = FX_Alloc(FX_INT32, m_rowSize * m_height);
- FXSYS_memset32(m_bits, 0, m_rowSize * m_height * sizeof(FX_INT32));
+ m_bits = FX_Alloc(int32_t, m_rowSize * m_height);
+ FXSYS_memset32(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
}
-void CBC_CommonBitMatrix::Init(FX_INT32 width, FX_INT32 height)
+void CBC_CommonBitMatrix::Init(int32_t width, int32_t height)
{
m_width = width;
m_height = height;
- FX_INT32 rowSize = (width + 31) >> 5;
+ int32_t rowSize = (width + 31) >> 5;
m_rowSize = rowSize;
- m_bits = FX_Alloc(FX_INT32, m_rowSize * m_height);
- FXSYS_memset32(m_bits, 0, m_rowSize * m_height * sizeof(FX_INT32));
+ m_bits = FX_Alloc(int32_t, m_rowSize * m_height);
+ FXSYS_memset32(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
}
CBC_CommonBitMatrix::~CBC_CommonBitMatrix()
{
@@ -56,36 +56,36 @@ CBC_CommonBitMatrix::~CBC_CommonBitMatrix() m_bits = NULL;
m_height = m_width = m_rowSize = 0;
}
-FX_BOOL CBC_CommonBitMatrix::Get(FX_INT32 x, FX_INT32 y)
+FX_BOOL CBC_CommonBitMatrix::Get(int32_t x, int32_t y)
{
- FX_INT32 offset = y * m_rowSize + (x >> 5);
+ int32_t offset = y * m_rowSize + (x >> 5);
if (offset >= m_rowSize * m_height || offset < 0) {
return false;
}
return ((((FX_DWORD)m_bits[offset]) >> (x & 0x1f)) & 1) != 0;
}
-FX_INT32* CBC_CommonBitMatrix::GetBits()
+int32_t* CBC_CommonBitMatrix::GetBits()
{
return m_bits;
}
-void CBC_CommonBitMatrix::Set(FX_INT32 x, FX_INT32 y)
+void CBC_CommonBitMatrix::Set(int32_t x, int32_t y)
{
- FX_INT32 offset = y * m_rowSize + (x >> 5);
+ int32_t offset = y * m_rowSize + (x >> 5);
if (offset >= m_rowSize * m_height || offset < 0) {
return;
}
m_bits[offset] |= 1 << (x & 0x1f);
}
-void CBC_CommonBitMatrix::Flip(FX_INT32 x, FX_INT32 y)
+void CBC_CommonBitMatrix::Flip(int32_t x, int32_t y)
{
- FX_INT32 offset = y * m_rowSize + (x >> 5);
+ int32_t offset = y * m_rowSize + (x >> 5);
m_bits[offset] ^= 1 << (x & 0x1f);
}
void CBC_CommonBitMatrix::Clear()
{
- FXSYS_memset32(m_bits, 0, m_rowSize * m_height * sizeof(FX_INT32));
+ FXSYS_memset32(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
}
-void CBC_CommonBitMatrix::SetRegion(FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height, FX_INT32 &e)
+void CBC_CommonBitMatrix::SetRegion(int32_t left, int32_t top, int32_t width, int32_t height, int32_t &e)
{
if (top < 0 || left < 0) {
e = BCExceptionLeftAndTopMustBeNonnegative;
@@ -95,22 +95,22 @@ void CBC_CommonBitMatrix::SetRegion(FX_INT32 left, FX_INT32 top, FX_INT32 width, e = BCExceptionHeightAndWidthMustBeAtLeast1;
return;
}
- FX_INT32 right = left + width;
- FX_INT32 bottom = top + height;
+ int32_t right = left + width;
+ int32_t bottom = top + height;
if (m_height < bottom || m_width < right) {
e = BCExceptionRegionMustFitInsideMatrix;
return;
}
- FX_INT32 y;
+ int32_t y;
for (y = top; y < bottom; y++) {
- FX_INT32 offset = y * m_rowSize;
- FX_INT32 x;
+ int32_t offset = y * m_rowSize;
+ int32_t x;
for (x = left; x < right; x++) {
m_bits[offset + (x >> 5)] |= 1 << (x & 0x1f);
}
}
}
-CBC_CommonBitArray* CBC_CommonBitMatrix::GetRow(FX_INT32 y, CBC_CommonBitArray* row)
+CBC_CommonBitArray* CBC_CommonBitMatrix::GetRow(int32_t y, CBC_CommonBitArray* row)
{
CBC_CommonBitArray* rowArray = NULL;
if (row == NULL || row->GetSize() < m_width) {
@@ -118,40 +118,40 @@ CBC_CommonBitArray* CBC_CommonBitMatrix::GetRow(FX_INT32 y, CBC_CommonBitArray* } else {
rowArray = FX_NEW CBC_CommonBitArray(row);
}
- FX_INT32 offset = y * m_rowSize;
- FX_INT32 x;
+ int32_t offset = y * m_rowSize;
+ int32_t x;
for (x = 0; x < m_rowSize; x++) {
rowArray->SetBulk(x << 5, m_bits[offset + x]);
}
return rowArray;
}
-void CBC_CommonBitMatrix::SetRow(FX_INT32 y, CBC_CommonBitArray* row)
+void CBC_CommonBitMatrix::SetRow(int32_t y, CBC_CommonBitArray* row)
{
- FX_INT32 l = y * m_rowSize;
- for (FX_INT32 i = 0; i < m_rowSize; i++) {
+ int32_t l = y * m_rowSize;
+ for (int32_t i = 0; i < m_rowSize; i++) {
m_bits[l] = row->GetBitArray()[i];
l++;
}
}
-void CBC_CommonBitMatrix::SetCol(FX_INT32 y, CBC_CommonBitArray* col)
+void CBC_CommonBitMatrix::SetCol(int32_t y, CBC_CommonBitArray* col)
{
- for (FX_INT32 i = 0; i < col->GetBits().GetSize(); i++) {
+ for (int32_t i = 0; i < col->GetBits().GetSize(); i++) {
m_bits[i * m_rowSize + y] = col->GetBitArray()[i];
}
}
-FX_INT32 CBC_CommonBitMatrix::GetWidth()
+int32_t CBC_CommonBitMatrix::GetWidth()
{
return m_width;
}
-FX_INT32 CBC_CommonBitMatrix::GetHeight()
+int32_t CBC_CommonBitMatrix::GetHeight()
{
return m_height;
}
-FX_INT32 CBC_CommonBitMatrix::GetRowSize()
+int32_t CBC_CommonBitMatrix::GetRowSize()
{
return m_rowSize;
}
-FX_INT32 CBC_CommonBitMatrix::GetDimension(FX_INT32 &e)
+int32_t CBC_CommonBitMatrix::GetDimension(int32_t &e)
{
if (m_width != m_height) {
e = BCExceptionCanNotCallGetDimensionOnNonSquareMatrix;
diff --git a/xfa/src/fxbarcode/common/BC_CommonBitMatrix.h b/xfa/src/fxbarcode/common/BC_CommonBitMatrix.h index 8641ef1f63..4c129fdb82 100644 --- a/xfa/src/fxbarcode/common/BC_CommonBitMatrix.h +++ b/xfa/src/fxbarcode/common/BC_CommonBitMatrix.h @@ -12,26 +12,26 @@ class CBC_CommonBitMatrix public:
CBC_CommonBitMatrix();
virtual ~CBC_CommonBitMatrix();
- FX_BOOL Get(FX_INT32 x, FX_INT32 y);
- void Set(FX_INT32 x, FX_INT32 y);
- void Flip(FX_INT32 x, FX_INT32 y);
+ FX_BOOL Get(int32_t x, int32_t y);
+ void Set(int32_t x, int32_t y);
+ void Flip(int32_t x, int32_t y);
void Clear();
- void SetRegion(FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height, FX_INT32 &e);
- CBC_CommonBitArray* GetRow(FX_INT32 y, CBC_CommonBitArray* row);
- void SetRow(FX_INT32 y, CBC_CommonBitArray* row);
- CBC_CommonBitArray* GetCol(FX_INT32 y, CBC_CommonBitArray* row);
- void SetCol(FX_INT32 y, CBC_CommonBitArray* col);
- FX_INT32 GetWidth();
- FX_INT32 GetHeight();
- FX_INT32 GetRowSize();
- FX_INT32 GetDimension(FX_INT32 &e);
- virtual void Init(FX_INT32 dimension);
- virtual void Init(FX_INT32 width, FX_INT32 height);
- FX_INT32* GetBits();
+ void SetRegion(int32_t left, int32_t top, int32_t width, int32_t height, int32_t &e);
+ CBC_CommonBitArray* GetRow(int32_t y, CBC_CommonBitArray* row);
+ void SetRow(int32_t y, CBC_CommonBitArray* row);
+ CBC_CommonBitArray* GetCol(int32_t y, CBC_CommonBitArray* row);
+ void SetCol(int32_t y, CBC_CommonBitArray* col);
+ int32_t GetWidth();
+ int32_t GetHeight();
+ int32_t GetRowSize();
+ int32_t GetDimension(int32_t &e);
+ virtual void Init(int32_t dimension);
+ virtual void Init(int32_t width, int32_t height);
+ int32_t* GetBits();
private:
- FX_INT32 m_width;
- FX_INT32 m_height;
- FX_INT32 m_rowSize;
- FX_INT32* m_bits;
+ int32_t m_width;
+ int32_t m_height;
+ int32_t m_rowSize;
+ int32_t* m_bits;
};
#endif
diff --git a/xfa/src/fxbarcode/common/BC_CommonBitSource.cpp b/xfa/src/fxbarcode/common/BC_CommonBitSource.cpp index b71848a60c..f32d634a5a 100644 --- a/xfa/src/fxbarcode/common/BC_CommonBitSource.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonBitSource.cpp @@ -31,18 +31,18 @@ CBC_CommonBitSource::CBC_CommonBitSource(CFX_ByteArray* bytes) CBC_CommonBitSource::~CBC_CommonBitSource()
{
}
-FX_INT32 CBC_CommonBitSource::ReadBits(FX_INT32 numBits, FX_INT32 &e)
+int32_t CBC_CommonBitSource::ReadBits(int32_t numBits, int32_t &e)
{
if (numBits < 1 || numBits > 32) {
e = BCExceptionIllegalArgument;
return 0;
}
- FX_INT32 result = 0;
+ int32_t result = 0;
if (m_bitOffset > 0) {
- FX_INT32 bitsLeft = 8 - m_bitOffset;
- FX_INT32 toRead = numBits < bitsLeft ? numBits : bitsLeft;
- FX_INT32 bitsToNotRead = bitsLeft - toRead;
- FX_INT32 mask = (0xff >> (8 - toRead)) << bitsToNotRead;
+ int32_t bitsLeft = 8 - m_bitOffset;
+ int32_t toRead = numBits < bitsLeft ? numBits : bitsLeft;
+ int32_t bitsToNotRead = bitsLeft - toRead;
+ int32_t mask = (0xff >> (8 - toRead)) << bitsToNotRead;
result = (m_bytes[m_byteOffset] & mask) >> bitsToNotRead;
numBits -= toRead;
m_bitOffset += toRead;
@@ -58,19 +58,19 @@ FX_INT32 CBC_CommonBitSource::ReadBits(FX_INT32 numBits, FX_INT32 &e) numBits -= 8;
}
if (numBits > 0) {
- FX_INT32 bitsToNotRead = 8 - numBits;
- FX_INT32 mask = (0xff >> bitsToNotRead) << bitsToNotRead;
+ int32_t bitsToNotRead = 8 - numBits;
+ int32_t mask = (0xff >> bitsToNotRead) << bitsToNotRead;
result = (result << numBits) | ((m_bytes[m_byteOffset] & mask) >> bitsToNotRead);
m_bitOffset += numBits;
}
}
return result;
}
-FX_INT32 CBC_CommonBitSource::Available()
+int32_t CBC_CommonBitSource::Available()
{
return 8 * (m_bytes.GetSize() - m_byteOffset) - m_bitOffset;
}
-FX_INT32 CBC_CommonBitSource::getByteOffset()
+int32_t CBC_CommonBitSource::getByteOffset()
{
return m_byteOffset;
}
diff --git a/xfa/src/fxbarcode/common/BC_CommonBitSource.h b/xfa/src/fxbarcode/common/BC_CommonBitSource.h index f6a5985ae2..278b4b6a1c 100644 --- a/xfa/src/fxbarcode/common/BC_CommonBitSource.h +++ b/xfa/src/fxbarcode/common/BC_CommonBitSource.h @@ -11,12 +11,12 @@ class CBC_CommonBitSource public:
CBC_CommonBitSource(CFX_ByteArray *bytes);
virtual ~CBC_CommonBitSource();
- FX_INT32 ReadBits(FX_INT32 numBits, FX_INT32 &e);
- FX_INT32 Available();
- FX_INT32 getByteOffset();
+ int32_t ReadBits(int32_t numBits, int32_t &e);
+ int32_t Available();
+ int32_t getByteOffset();
private:
CFX_ByteArray m_bytes;
- FX_INT32 m_byteOffset;
- FX_INT32 m_bitOffset;
+ int32_t m_byteOffset;
+ int32_t m_bitOffset;
};
#endif
diff --git a/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp b/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp index 99e97d38d8..4b9667e406 100644 --- a/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonByteArray.cpp @@ -28,17 +28,17 @@ CBC_CommonByteArray::CBC_CommonByteArray() m_size = 0;
m_index = 0;
}
-CBC_CommonByteArray::CBC_CommonByteArray(FX_INT32 size)
+CBC_CommonByteArray::CBC_CommonByteArray(int32_t size)
{
m_size = size;
- m_bytes = FX_Alloc(FX_BYTE, size);
+ m_bytes = FX_Alloc(uint8_t, size);
FXSYS_memset32(m_bytes, 0, size);
m_index = 0;
}
-CBC_CommonByteArray::CBC_CommonByteArray(FX_BYTE* byteArray, FX_INT32 size)
+CBC_CommonByteArray::CBC_CommonByteArray(uint8_t* byteArray, int32_t size)
{
m_size = size;
- m_bytes = FX_Alloc(FX_BYTE, size);
+ m_bytes = FX_Alloc(uint8_t, size);
FXSYS_memcpy32(m_bytes, byteArray, size);
m_index = size;
}
@@ -51,15 +51,15 @@ CBC_CommonByteArray::~CBC_CommonByteArray() m_index = 0;
m_size = 0;
}
-FX_INT32 CBC_CommonByteArray::At(FX_INT32 index)
+int32_t CBC_CommonByteArray::At(int32_t index)
{
return m_bytes[index] & 0xff;
}
-void CBC_CommonByteArray::Set(FX_INT32 index, FX_INT32 value)
+void CBC_CommonByteArray::Set(int32_t index, int32_t value)
{
- m_bytes[index] = (FX_BYTE) value;
+ m_bytes[index] = (uint8_t) value;
}
-FX_INT32 CBC_CommonByteArray::Size()
+int32_t CBC_CommonByteArray::Size()
{
return m_size;
}
@@ -67,19 +67,19 @@ FX_BOOL CBC_CommonByteArray::IsEmpty() {
return m_size == 0;
}
-void CBC_CommonByteArray::AppendByte(FX_INT32 value)
+void CBC_CommonByteArray::AppendByte(int32_t value)
{
if (m_size == 0 || m_index >= m_size) {
- FX_INT32 newSize = FX_MAX(32, m_size << 1);
+ int32_t newSize = FX_MAX(32, m_size << 1);
Reserve(newSize);
}
- m_bytes[m_index] = (FX_BYTE)value;
+ m_bytes[m_index] = (uint8_t)value;
m_index++;
}
-void CBC_CommonByteArray::Reserve(FX_INT32 capacity)
+void CBC_CommonByteArray::Reserve(int32_t capacity)
{
if (m_bytes == NULL || m_size < capacity) {
- FX_BYTE *newArray = FX_Alloc(FX_BYTE, capacity);
+ uint8_t *newArray = FX_Alloc(uint8_t, capacity);
FXSYS_memset32(newArray, 0, capacity);
if (m_bytes != NULL) {
FXSYS_memcpy32(newArray, m_bytes, m_size);
@@ -89,24 +89,24 @@ void CBC_CommonByteArray::Reserve(FX_INT32 capacity) m_size = capacity;
}
}
-void CBC_CommonByteArray::Set(FX_BYTE* source, FX_INT32 offset, FX_INT32 count)
+void CBC_CommonByteArray::Set(uint8_t* source, int32_t offset, int32_t count)
{
if (m_bytes != NULL) {
FX_Free( m_bytes );
}
- m_bytes = FX_Alloc(FX_BYTE, count);
+ m_bytes = FX_Alloc(uint8_t, count);
m_size = count;
FXSYS_memcpy32(m_bytes, source + offset, count);
m_index = count;
}
-void CBC_CommonByteArray::Set(CFX_ByteArray* source, FX_INT32 offset, FX_INT32 count)
+void CBC_CommonByteArray::Set(CFX_ByteArray* source, int32_t offset, int32_t count)
{
if (m_bytes != NULL) {
FX_Free( m_bytes );
}
- m_bytes = FX_Alloc(FX_BYTE, count);
+ m_bytes = FX_Alloc(uint8_t, count);
m_size = count;
- FX_INT32 i;
+ int32_t i;
for(i = 0; i < count; i++) {
m_bytes[i] = source->operator [](i + offset);
}
diff --git a/xfa/src/fxbarcode/common/BC_CommonByteArray.h b/xfa/src/fxbarcode/common/BC_CommonByteArray.h index b9baf8a964..234b25db69 100644 --- a/xfa/src/fxbarcode/common/BC_CommonByteArray.h +++ b/xfa/src/fxbarcode/common/BC_CommonByteArray.h @@ -9,21 +9,21 @@ class CBC_CommonByteArray
{
private:
- FX_INT32 m_size;
- FX_INT32 m_index;
- FX_BYTE* m_bytes;
+ int32_t m_size;
+ int32_t m_index;
+ uint8_t* m_bytes;
public:
CBC_CommonByteArray();
- CBC_CommonByteArray(FX_INT32 size);
- CBC_CommonByteArray(FX_BYTE* byteArray, FX_INT32 size);
+ CBC_CommonByteArray(int32_t size);
+ CBC_CommonByteArray(uint8_t* byteArray, int32_t size);
virtual ~CBC_CommonByteArray();
- FX_INT32 At(FX_INT32 index);
- void Set(FX_INT32 index, FX_INT32 value);
- FX_INT32 Size();
+ int32_t At(int32_t index);
+ void Set(int32_t index, int32_t value);
+ int32_t Size();
FX_BOOL IsEmpty();
- void AppendByte(FX_INT32 value);
- void Reserve(FX_INT32 capacity);
- void Set(FX_BYTE* source, FX_INT32 offset, FX_INT32 count);
- void Set(CFX_ByteArray* source, FX_INT32 offset, FX_INT32 count);
+ void AppendByte(int32_t value);
+ void Reserve(int32_t capacity);
+ void Set(uint8_t* source, int32_t offset, int32_t count);
+ void Set(CFX_ByteArray* source, int32_t offset, int32_t count);
};
#endif
diff --git a/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp b/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp index 27c8615bf9..da4741d11a 100644 --- a/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp @@ -22,7 +22,7 @@ #include "../barcode.h"
#include "BC_CommonByteMatrix.h"
-CBC_CommonByteMatrix::CBC_CommonByteMatrix(FX_INT32 width, FX_INT32 height)
+CBC_CommonByteMatrix::CBC_CommonByteMatrix(int32_t width, int32_t height)
{
m_height = height;
m_width = width;
@@ -30,7 +30,7 @@ CBC_CommonByteMatrix::CBC_CommonByteMatrix(FX_INT32 width, FX_INT32 height) }
void CBC_CommonByteMatrix::Init()
{
- m_bytes = FX_Alloc(FX_BYTE, m_height * m_width);
+ m_bytes = FX_Alloc(uint8_t, m_height * m_width);
FXSYS_memset8(m_bytes, 0xff, m_height * m_width);
}
CBC_CommonByteMatrix::~CBC_CommonByteMatrix()
@@ -40,37 +40,37 @@ CBC_CommonByteMatrix::~CBC_CommonByteMatrix() m_bytes = NULL;
}
}
-FX_INT32 CBC_CommonByteMatrix::GetHeight()
+int32_t CBC_CommonByteMatrix::GetHeight()
{
return m_height;
}
-FX_INT32 CBC_CommonByteMatrix::GetWidth()
+int32_t CBC_CommonByteMatrix::GetWidth()
{
return m_width;
}
-FX_BYTE CBC_CommonByteMatrix::Get(FX_INT32 x, FX_INT32 y)
+uint8_t CBC_CommonByteMatrix::Get(int32_t x, int32_t y)
{
return m_bytes[y * m_width + x];
}
-void CBC_CommonByteMatrix::Set(FX_INT32 x, FX_INT32 y, FX_INT32 value)
+void CBC_CommonByteMatrix::Set(int32_t x, int32_t y, int32_t value)
{
- m_bytes[y * m_width + x] = (FX_BYTE)value;
+ m_bytes[y * m_width + x] = (uint8_t)value;
}
-void CBC_CommonByteMatrix::Set(FX_INT32 x, FX_INT32 y, FX_BYTE value)
+void CBC_CommonByteMatrix::Set(int32_t x, int32_t y, uint8_t value)
{
m_bytes[y * m_width + x] = value;
}
-void CBC_CommonByteMatrix::clear(FX_BYTE value)
+void CBC_CommonByteMatrix::clear(uint8_t value)
{
- FX_INT32 y;
+ int32_t y;
for(y = 0; y < m_height; y++) {
- FX_INT32 x;
+ int32_t x;
for(x = 0; x < m_width; x++) {
m_bytes[y * m_width + x] = value;
}
}
}
-FX_BYTE* CBC_CommonByteMatrix::GetArray()
+uint8_t* CBC_CommonByteMatrix::GetArray()
{
return m_bytes;
}
diff --git a/xfa/src/fxbarcode/common/BC_CommonByteMatrix.h b/xfa/src/fxbarcode/common/BC_CommonByteMatrix.h index 55277660f3..f19e0038b6 100644 --- a/xfa/src/fxbarcode/common/BC_CommonByteMatrix.h +++ b/xfa/src/fxbarcode/common/BC_CommonByteMatrix.h @@ -9,20 +9,20 @@ class CBC_CommonByteMatrix
{
public:
- CBC_CommonByteMatrix(FX_INT32 width, FX_INT32 height);
+ CBC_CommonByteMatrix(int32_t width, int32_t height);
virtual ~CBC_CommonByteMatrix();
- FX_INT32 GetHeight();
- FX_INT32 GetWidth();
- FX_BYTE Get(FX_INT32 x, FX_INT32 y);
- FX_BYTE* GetArray();
+ int32_t GetHeight();
+ int32_t GetWidth();
+ uint8_t Get(int32_t x, int32_t y);
+ uint8_t* GetArray();
- void Set(FX_INT32 x, FX_INT32 y, FX_INT32 value);
- void Set(FX_INT32 x, FX_INT32 y, FX_BYTE value);
- void clear(FX_BYTE value);
+ void Set(int32_t x, int32_t y, int32_t value);
+ void Set(int32_t x, int32_t y, uint8_t value);
+ void clear(uint8_t value);
virtual void Init();
private:
- FX_BYTE *m_bytes;
- FX_INT32 m_width;
- FX_INT32 m_height;
+ uint8_t *m_bytes;
+ int32_t m_width;
+ int32_t m_height;
};
#endif
diff --git a/xfa/src/fxbarcode/common/BC_CommonCharacterSetECI.cpp b/xfa/src/fxbarcode/common/BC_CommonCharacterSetECI.cpp index 2909704796..36f8e10af1 100644 --- a/xfa/src/fxbarcode/common/BC_CommonCharacterSetECI.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonCharacterSetECI.cpp @@ -26,7 +26,7 @@ void CBC_CommonCharacterSetECI::initialize()
{
}
-CBC_CommonCharacterSetECI::CBC_CommonCharacterSetECI(FX_INT32 value, CFX_ByteString encodingName):
+CBC_CommonCharacterSetECI::CBC_CommonCharacterSetECI(int32_t value, CFX_ByteString encodingName):
CBC_CommonECI(value), m_encodingName(encodingName)
{
}
@@ -37,10 +37,10 @@ CFX_ByteString CBC_CommonCharacterSetECI::GetEncodingName() {
return m_encodingName;
}
-void CBC_CommonCharacterSetECI::AddCharacterSet(FX_INT32 value, CFX_ByteString encodingName)
+void CBC_CommonCharacterSetECI::AddCharacterSet(int32_t value, CFX_ByteString encodingName)
{
}
-CBC_CommonCharacterSetECI* CBC_CommonCharacterSetECI::GetCharacterSetECIByValue(FX_INT32 value)
+CBC_CommonCharacterSetECI* CBC_CommonCharacterSetECI::GetCharacterSetECIByValue(int32_t value)
{
return NULL;
}
diff --git a/xfa/src/fxbarcode/common/BC_CommonCharacterSetECI.h b/xfa/src/fxbarcode/common/BC_CommonCharacterSetECI.h index 1e9f9a433f..1c324796c8 100644 --- a/xfa/src/fxbarcode/common/BC_CommonCharacterSetECI.h +++ b/xfa/src/fxbarcode/common/BC_CommonCharacterSetECI.h @@ -11,12 +11,12 @@ class CBC_CommonCharacterSetECI; class CBC_CommonCharacterSetECI : public CBC_CommonECI
{
public:
- CBC_CommonCharacterSetECI(FX_INT32 value, CFX_ByteString encodingName);
+ CBC_CommonCharacterSetECI(int32_t value, CFX_ByteString encodingName);
virtual ~CBC_CommonCharacterSetECI();
CFX_ByteString GetEncodingName();
- static void AddCharacterSet(FX_INT32 value, CFX_ByteString encodingName);
- FX_INT32 GetValue();
- static CBC_CommonCharacterSetECI* GetCharacterSetECIByValue(FX_INT32 value);
+ static void AddCharacterSet(int32_t value, CFX_ByteString encodingName);
+ int32_t GetValue();
+ static CBC_CommonCharacterSetECI* GetCharacterSetECIByValue(int32_t value);
static CBC_CommonCharacterSetECI* GetCharacterSetECIByName(const CFX_ByteString& name);
private:
CFX_ByteString m_encodingName;
diff --git a/xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp b/xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp index d0c55734db..e17a58db43 100644 --- a/xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonDecoderResult.cpp @@ -27,7 +27,7 @@ CBC_CommonDecoderResult::CBC_CommonDecoderResult()
{
}
-void CBC_CommonDecoderResult::Init(const CFX_ByteArray &rawBytes, const CFX_ByteString &text, const CFX_Int32Array &byteSegments, CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 &e)
+void CBC_CommonDecoderResult::Init(const CFX_ByteArray &rawBytes, const CFX_ByteString &text, const CFX_Int32Array &byteSegments, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t &e)
{
if(text.IsEmpty()) {
e = BCExceptionIllegalArgument;
@@ -39,7 +39,7 @@ void CBC_CommonDecoderResult::Init(const CFX_ByteArray &rawBytes, const CFX_Byte m_ecLevel = ecLevel;
m_other = NULL;
}
-void CBC_CommonDecoderResult::Init(const CFX_ByteArray &rawBytes, const CFX_ByteString &text, const CFX_PtrArray &byteSegments, const CFX_ByteString &ecLevel, FX_INT32 &e)
+void CBC_CommonDecoderResult::Init(const CFX_ByteArray &rawBytes, const CFX_ByteString &text, const CFX_PtrArray &byteSegments, const CFX_ByteString &ecLevel, int32_t &e)
{
if(text.IsEmpty()) {
e = BCExceptionIllegalArgument;
diff --git a/xfa/src/fxbarcode/common/BC_CommonDecoderResult.h b/xfa/src/fxbarcode/common/BC_CommonDecoderResult.h index 5f41afc774..e85317934a 100644 --- a/xfa/src/fxbarcode/common/BC_CommonDecoderResult.h +++ b/xfa/src/fxbarcode/common/BC_CommonDecoderResult.h @@ -17,8 +17,8 @@ public: const CFX_ByteString& GetText();
const CFX_Int32Array& GetByteSegments();
CBC_QRCoderErrorCorrectionLevel* GetECLevel();
- virtual void Init(const CFX_ByteArray &rawBytes, const CFX_ByteString &text, const CFX_Int32Array &byteSegments, CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 &e);
- virtual void Init(const CFX_ByteArray &rawBytes, const CFX_ByteString &text, const CFX_PtrArray &byteSegments, const CFX_ByteString &ecLevel, FX_INT32 &e);
+ virtual void Init(const CFX_ByteArray &rawBytes, const CFX_ByteString &text, const CFX_Int32Array &byteSegments, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t &e);
+ virtual void Init(const CFX_ByteArray &rawBytes, const CFX_ByteString &text, const CFX_PtrArray &byteSegments, const CFX_ByteString &ecLevel, int32_t &e);
void setOther(CBC_PDF417ResultMetadata* other);
private:
CFX_ByteArray m_rawBytes;
diff --git a/xfa/src/fxbarcode/common/BC_CommonECI.cpp b/xfa/src/fxbarcode/common/BC_CommonECI.cpp index 5aa64095f7..98e88b5dab 100644 --- a/xfa/src/fxbarcode/common/BC_CommonECI.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonECI.cpp @@ -23,18 +23,18 @@ #include "../barcode.h"
#include "BC_CommonECI.h"
#include "BC_CommonCharacterSetECI.h"
-CBC_CommonECI::CBC_CommonECI(FX_INT32 value)
+CBC_CommonECI::CBC_CommonECI(int32_t value)
{
m_value = value;
}
CBC_CommonECI::~CBC_CommonECI()
{
}
-FX_INT32 CBC_CommonECI::GetValue()
+int32_t CBC_CommonECI::GetValue()
{
return m_value;
}
-CBC_CommonECI* CBC_CommonECI::GetEICByValue(FX_INT32 value, FX_INT32 &e)
+CBC_CommonECI* CBC_CommonECI::GetEICByValue(int32_t value, int32_t &e)
{
if(value < 0 || value > 999999) {
e = BCExceptionBadECI;
diff --git a/xfa/src/fxbarcode/common/BC_CommonECI.h b/xfa/src/fxbarcode/common/BC_CommonECI.h index 7a4ae6b8a6..503f15fef7 100644 --- a/xfa/src/fxbarcode/common/BC_CommonECI.h +++ b/xfa/src/fxbarcode/common/BC_CommonECI.h @@ -9,12 +9,12 @@ class CBC_CommonECI
{
public:
- CBC_CommonECI(FX_INT32 value);
+ CBC_CommonECI(int32_t value);
virtual ~CBC_CommonECI();
- FX_INT32 GetValue();
- static CBC_CommonECI* GetEICByValue(FX_INT32 value, FX_INT32 &e);
+ int32_t GetValue();
+ static CBC_CommonECI* GetEICByValue(int32_t value, int32_t &e);
private:
- FX_INT32 m_value;
+ int32_t m_value;
};
#endif
diff --git a/xfa/src/fxbarcode/common/BC_CommonPerspectiveTransform.cpp b/xfa/src/fxbarcode/common/BC_CommonPerspectiveTransform.cpp index cb59d99cdf..7fbcac5bb2 100644 --- a/xfa/src/fxbarcode/common/BC_CommonPerspectiveTransform.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonPerspectiveTransform.cpp @@ -48,7 +48,7 @@ CBC_CommonPerspectiveTransform *CBC_CommonPerspectiveTransform::QuadrilateralToQ }
void CBC_CommonPerspectiveTransform::TransformPoints(CFX_FloatArray *points)
{
- FX_INT32 max = points->GetSize();
+ int32_t max = points->GetSize();
FX_FLOAT a11 = m_a11;
FX_FLOAT a12 = m_a12;
FX_FLOAT a13 = m_a13;
@@ -58,7 +58,7 @@ void CBC_CommonPerspectiveTransform::TransformPoints(CFX_FloatArray *points) FX_FLOAT a31 = m_a31;
FX_FLOAT a32 = m_a32;
FX_FLOAT a33 = m_a33;
- FX_INT32 i;
+ int32_t i;
for (i = 0; i < max; i += 2) {
FX_FLOAT x = (*points)[i];
FX_FLOAT y = (*points)[i + 1];
diff --git a/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp b/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp index 7ef1671d98..5976d450d9 100644 --- a/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp +++ b/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp @@ -26,19 +26,19 @@ #include "BC_CommonBitMatrix.h"
#include "BC_CommonBitArray.h"
#include "BC_GlobalHistogramBinarizer.h"
-const FX_INT32 LUMINANCE_BITS = 5;
-const FX_INT32 LUMINANCE_SHIFT = 8 - LUMINANCE_BITS;
-const FX_INT32 LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
+const int32_t LUMINANCE_BITS = 5;
+const int32_t LUMINANCE_SHIFT = 8 - LUMINANCE_BITS;
+const int32_t LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
CBC_GlobalHistogramBinarizer::CBC_GlobalHistogramBinarizer(CBC_LuminanceSource *source): CBC_Binarizer(source)
{
}
CBC_GlobalHistogramBinarizer::~CBC_GlobalHistogramBinarizer()
{
}
-CBC_CommonBitArray *CBC_GlobalHistogramBinarizer::GetBlackRow(FX_INT32 y, CBC_CommonBitArray *row, FX_INT32 &e)
+CBC_CommonBitArray *CBC_GlobalHistogramBinarizer::GetBlackRow(int32_t y, CBC_CommonBitArray *row, int32_t &e)
{
CBC_LuminanceSource *source = GetLuminanceSource();
- FX_INT32 width = source->GetWidth();
+ int32_t width = source->GetWidth();
CBC_AutoPtr<CBC_CommonBitArray> result(FX_NEW CBC_CommonBitArray(width));
InitArrays(width);
CFX_ByteArray *localLuminances = source->GetRow(y, m_luminance, e);
@@ -47,20 +47,20 @@ CBC_CommonBitArray *CBC_GlobalHistogramBinarizer::GetBlackRow(FX_INT32 y, CBC_Co }
CFX_Int32Array localBuckets;
localBuckets.Copy(m_buckets);
- FX_INT32 x;
+ int32_t x;
for (x = 0; x < width; x++) {
- FX_INT32 pixel = (*localLuminances)[x] & 0xff;
+ int32_t pixel = (*localLuminances)[x] & 0xff;
localBuckets[pixel >> LUMINANCE_SHIFT]++;
}
- FX_INT32 blackPoint = EstimateBlackPoint(localBuckets, e);
+ int32_t blackPoint = EstimateBlackPoint(localBuckets, e);
if (e != BCExceptionNO) {
return result.release();
}
- FX_INT32 left = (*localLuminances)[0] & 0xff;
- FX_INT32 center = (*localLuminances)[1] & 0xff;
+ int32_t left = (*localLuminances)[0] & 0xff;
+ int32_t center = (*localLuminances)[1] & 0xff;
for (x = 1; x < width - 1; x++) {
- FX_INT32 right = (*localLuminances)[x + 1] & 0xff;
- FX_INT32 luminance = ((center << 2) - left - right) >> 1;
+ int32_t right = (*localLuminances)[x + 1] & 0xff;
+ int32_t luminance = ((center << 2) - left - right) >> 1;
if (luminance < blackPoint) {
result->Set(x);
}
@@ -69,36 +69,36 @@ CBC_CommonBitArray *CBC_GlobalHistogramBinarizer::GetBlackRow(FX_INT32 y, CBC_Co }
return result.release();
}
-CBC_CommonBitMatrix *CBC_GlobalHistogramBinarizer::GetBlackMatrix(FX_INT32 &e)
+CBC_CommonBitMatrix *CBC_GlobalHistogramBinarizer::GetBlackMatrix(int32_t &e)
{
CBC_LuminanceSource *source = GetLuminanceSource();
- FX_INT32 width = source->GetWidth();
- FX_INT32 height = source->GetHeight();
+ int32_t width = source->GetWidth();
+ int32_t height = source->GetHeight();
CBC_CommonBitMatrix *BitMatrixTemp = FX_NEW CBC_CommonBitMatrix();
BitMatrixTemp->Init(width, height);
CBC_AutoPtr<CBC_CommonBitMatrix> matrix(BitMatrixTemp);
InitArrays(width);
CFX_Int32Array localBuckets;
localBuckets.Copy(m_buckets);
- FX_INT32 y;
+ int32_t y;
for (y = 1; y < 5; y++) {
- FX_INT32 row = height * y / 5;
+ int32_t row = height * y / 5;
CFX_ByteArray *localLuminances = source->GetRow(row, m_luminance, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 right = (width << 2) / 5;
- FX_INT32 x;
+ int32_t right = (width << 2) / 5;
+ int32_t x;
for (x = width / 5; x < right; x++) {
- FX_INT32 pixel = (*localLuminances)[x] & 0xff;
+ int32_t pixel = (*localLuminances)[x] & 0xff;
localBuckets[pixel >> LUMINANCE_SHIFT]++;
}
}
- FX_INT32 blackPoint = EstimateBlackPoint(localBuckets, e);
+ int32_t blackPoint = EstimateBlackPoint(localBuckets, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CFX_ByteArray> localLuminances(source->GetMatrix());
for (y = 0; y < height; y++) {
- FX_INT32 offset = y * width;
- for (FX_INT32 x = 0; x < width; x++) {
- FX_INT32 pixel = (*localLuminances)[offset + x] & 0xff;
+ int32_t offset = y * width;
+ for (int32_t x = 0; x < width; x++) {
+ int32_t pixel = (*localLuminances)[offset + x] & 0xff;
if (pixel < blackPoint) {
matrix->Set(x, y);
}
@@ -106,7 +106,7 @@ CBC_CommonBitMatrix *CBC_GlobalHistogramBinarizer::GetBlackMatrix(FX_INT32 &e) }
return matrix.release();
}
-void CBC_GlobalHistogramBinarizer::InitArrays(FX_INT32 luminanceSize)
+void CBC_GlobalHistogramBinarizer::InitArrays(int32_t luminanceSize)
{
if(m_luminance.GetSize() < luminanceSize) {
m_luminance.SetSize(luminanceSize);
@@ -114,19 +114,19 @@ void CBC_GlobalHistogramBinarizer::InitArrays(FX_INT32 luminanceSize) if(m_buckets.GetSize() <= 0) {
m_buckets.SetSize(LUMINANCE_BUCKETS);
} else {
- FX_INT32 x;
+ int32_t x;
for(x = 0; x < LUMINANCE_BUCKETS; x++) {
m_buckets[x] = 0;
}
}
}
-FX_INT32 CBC_GlobalHistogramBinarizer::EstimateBlackPoint(CFX_Int32Array &buckets, FX_INT32 &e)
+int32_t CBC_GlobalHistogramBinarizer::EstimateBlackPoint(CFX_Int32Array &buckets, int32_t &e)
{
- FX_INT32 numBuckets = buckets.GetSize();
- FX_INT32 maxBucketCount = 0;
- FX_INT32 firstPeak = 0;
- FX_INT32 firstPeakSize = 0;
- FX_INT32 x;
+ int32_t numBuckets = buckets.GetSize();
+ int32_t maxBucketCount = 0;
+ int32_t firstPeak = 0;
+ int32_t firstPeakSize = 0;
+ int32_t x;
for (x = 0; x < numBuckets; x++) {
if (buckets[x] > firstPeakSize) {
firstPeak = x;
@@ -136,18 +136,18 @@ FX_INT32 CBC_GlobalHistogramBinarizer::EstimateBlackPoint(CFX_Int32Array &bucket maxBucketCount = buckets[x];
}
}
- FX_INT32 secondPeak = 0;
- FX_INT32 secondPeakScore = 0;
+ int32_t secondPeak = 0;
+ int32_t secondPeakScore = 0;
for (x = 0; x < numBuckets; x++) {
- FX_INT32 distanceToBiggest = x - firstPeak;
- FX_INT32 score = buckets[x] * distanceToBiggest * distanceToBiggest;
+ int32_t distanceToBiggest = x - firstPeak;
+ int32_t score = buckets[x] * distanceToBiggest * distanceToBiggest;
if (score > secondPeakScore) {
secondPeak = x;
secondPeakScore = score;
}
}
if (firstPeak > secondPeak) {
- FX_INT32 temp = firstPeak;
+ int32_t temp = firstPeak;
firstPeak = secondPeak;
secondPeak = temp;
}
@@ -155,11 +155,11 @@ FX_INT32 CBC_GlobalHistogramBinarizer::EstimateBlackPoint(CFX_Int32Array &bucket e = BCExceptionRead;
return 0;
}
- FX_INT32 bestValley = secondPeak - 1;
- FX_INT32 bestValleyScore = -1;
+ int32_t bestValley = secondPeak - 1;
+ int32_t bestValleyScore = -1;
for (x = secondPeak - 1; x > firstPeak; x--) {
- FX_INT32 fromFirst = x - firstPeak;
- FX_INT32 score = fromFirst * fromFirst * (secondPeak - x) * (maxBucketCount - buckets[x]);
+ int32_t fromFirst = x - firstPeak;
+ int32_t score = fromFirst * fromFirst * (secondPeak - x) * (maxBucketCount - buckets[x]);
if (score > bestValleyScore) {
bestValley = x;
bestValleyScore = score;
diff --git a/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.h b/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.h index ef084c075e..6c6d8ba188 100644 --- a/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.h +++ b/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.h @@ -17,10 +17,10 @@ public: CBC_GlobalHistogramBinarizer(CBC_LuminanceSource *source);
virtual ~CBC_GlobalHistogramBinarizer();
- void InitArrays(FX_INT32 luminanceSize);
- CBC_CommonBitMatrix *GetBlackMatrix(FX_INT32 &e);
- CBC_CommonBitArray *GetBlackRow(FX_INT32 y, CBC_CommonBitArray *row, FX_INT32 &e);
- static FX_INT32 EstimateBlackPoint(CFX_Int32Array &buckets, FX_INT32 &e);
+ void InitArrays(int32_t luminanceSize);
+ CBC_CommonBitMatrix *GetBlackMatrix(int32_t &e);
+ CBC_CommonBitArray *GetBlackRow(int32_t y, CBC_CommonBitArray *row, int32_t &e);
+ static int32_t EstimateBlackPoint(CFX_Int32Array &buckets, int32_t &e);
private:
CFX_ByteArray m_luminance;
CFX_Int32Array m_buckets;
diff --git a/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp b/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp index 8bc93136ca..3d350996dd 100644 --- a/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp +++ b/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.cpp @@ -24,8 +24,8 @@ #include "BC_WhiteRectangleDetector.h"
#include "BC_CommonBitMatrix.h"
#include "../BC_ResultPoint.h"
-const FX_INT32 CBC_WhiteRectangleDetector::INIT_SIZE = 30;
-const FX_INT32 CBC_WhiteRectangleDetector::CORR = 1;
+const int32_t CBC_WhiteRectangleDetector::INIT_SIZE = 30;
+const int32_t CBC_WhiteRectangleDetector::CORR = 1;
CBC_WhiteRectangleDetector::CBC_WhiteRectangleDetector(CBC_CommonBitMatrix *image)
{
m_image = image;
@@ -36,19 +36,19 @@ CBC_WhiteRectangleDetector::CBC_WhiteRectangleDetector(CBC_CommonBitMatrix *imag m_upInit = (m_height - INIT_SIZE) >> 1;
m_downInit = (m_height + INIT_SIZE) >> 1;
}
-void CBC_WhiteRectangleDetector::Init(FX_INT32 &e)
+void CBC_WhiteRectangleDetector::Init(int32_t &e)
{
if (m_upInit < 0 || m_leftInit < 0 || m_downInit >= m_height || m_rightInit >= m_width) {
e = BCExceptionNotFound;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-CBC_WhiteRectangleDetector::CBC_WhiteRectangleDetector(CBC_CommonBitMatrix *image, FX_INT32 initSize, FX_INT32 x, FX_INT32 y)
+CBC_WhiteRectangleDetector::CBC_WhiteRectangleDetector(CBC_CommonBitMatrix *image, int32_t initSize, int32_t x, int32_t y)
{
m_image = image;
m_height = image->GetHeight();
m_width = image->GetWidth();
- FX_INT32 halfsize = initSize >> 1;
+ int32_t halfsize = initSize >> 1;
m_leftInit = x - halfsize;
m_rightInit = x + halfsize;
m_upInit = y - halfsize;
@@ -57,12 +57,12 @@ CBC_WhiteRectangleDetector::CBC_WhiteRectangleDetector(CBC_CommonBitMatrix *imag CBC_WhiteRectangleDetector::~CBC_WhiteRectangleDetector()
{
}
-CFX_PtrArray *CBC_WhiteRectangleDetector::Detect(FX_INT32 &e)
+CFX_PtrArray *CBC_WhiteRectangleDetector::Detect(int32_t &e)
{
- FX_INT32 left = m_leftInit;
- FX_INT32 right = m_rightInit;
- FX_INT32 up = m_upInit;
- FX_INT32 down = m_downInit;
+ int32_t left = m_leftInit;
+ int32_t right = m_rightInit;
+ int32_t up = m_upInit;
+ int32_t down = m_downInit;
FX_BOOL sizeExceeded = FALSE;
FX_BOOL aBlackPointFoundOnBorder = TRUE;
FX_BOOL atLeastOneBlackPointFoundOnBorder = FALSE;
@@ -121,9 +121,9 @@ CFX_PtrArray *CBC_WhiteRectangleDetector::Detect(FX_INT32 &e) }
}
if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) {
- FX_INT32 maxSize = right - left;
+ int32_t maxSize = right - left;
CBC_AutoPtr<CBC_ResultPoint> z(NULL);
- for (FX_INT32 i = 1; i < maxSize; i++) {
+ for (int32_t i = 1; i < maxSize; i++) {
z = CBC_AutoPtr<CBC_ResultPoint>(GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(down - i), (FX_FLOAT)(left + i), (FX_FLOAT)(down)) );
if (z.get() != NULL) {
break;
@@ -134,7 +134,7 @@ CFX_PtrArray *CBC_WhiteRectangleDetector::Detect(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
CBC_AutoPtr<CBC_ResultPoint> t(NULL);
- for (FX_INT32 j = 1; j < maxSize; j++) {
+ for (int32_t j = 1; j < maxSize; j++) {
t = CBC_AutoPtr<CBC_ResultPoint>(GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(up + j), (FX_FLOAT)(left + j), (FX_FLOAT)up));
if (t.get() != NULL) {
break;
@@ -145,7 +145,7 @@ CFX_PtrArray *CBC_WhiteRectangleDetector::Detect(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
CBC_AutoPtr<CBC_ResultPoint> x(NULL);
- for (FX_INT32 k = 1; k < maxSize; k++) {
+ for (int32_t k = 1; k < maxSize; k++) {
x = CBC_AutoPtr<CBC_ResultPoint>(GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(up + k), (FX_FLOAT)(right - k), (FX_FLOAT)up));
if (x.get() != NULL) {
break;
@@ -156,7 +156,7 @@ CFX_PtrArray *CBC_WhiteRectangleDetector::Detect(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
CBC_AutoPtr<CBC_ResultPoint> y(NULL);
- for (FX_INT32 m = 1; m < maxSize; m++) {
+ for (int32_t m = 1; m < maxSize; m++) {
y = CBC_AutoPtr<CBC_ResultPoint>(GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(down - m), (FX_FLOAT)(right - m), (FX_FLOAT) down));
if (y.get() != NULL) {
break;
@@ -173,25 +173,25 @@ CFX_PtrArray *CBC_WhiteRectangleDetector::Detect(FX_INT32 &e) }
return NULL;
}
-FX_INT32 CBC_WhiteRectangleDetector::Round(FX_FLOAT d)
+int32_t CBC_WhiteRectangleDetector::Round(FX_FLOAT d)
{
- return (FX_INT32) (d + 0.5f);
+ return (int32_t) (d + 0.5f);
}
CBC_ResultPoint *CBC_WhiteRectangleDetector::GetBlackPointOnSegment(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY)
{
- FX_INT32 dist = DistanceL2(aX, aY, bX, bY);
+ int32_t dist = DistanceL2(aX, aY, bX, bY);
float xStep = (bX - aX) / dist;
float yStep = (bY - aY) / dist;
- for (FX_INT32 i = 0; i < dist; i++) {
- FX_INT32 x = Round(aX + i * xStep);
- FX_INT32 y = Round(aY + i * yStep);
+ for (int32_t i = 0; i < dist; i++) {
+ int32_t x = Round(aX + i * xStep);
+ int32_t y = Round(aY + i * yStep);
if (m_image->Get(x, y)) {
return FX_NEW CBC_ResultPoint((FX_FLOAT)x, (FX_FLOAT) y);
}
}
return NULL;
}
-FX_INT32 CBC_WhiteRectangleDetector::DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY)
+int32_t CBC_WhiteRectangleDetector::DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY)
{
float xDiff = aX - bX;
float yDiff = aY - bY;
@@ -225,16 +225,16 @@ CFX_PtrArray *CBC_WhiteRectangleDetector::CenterEdges(CBC_ResultPoint *y, CBC_Re return result;
}
}
-FX_BOOL CBC_WhiteRectangleDetector::ContainsBlackPoint(FX_INT32 a, FX_INT32 b, FX_INT32 fixed, FX_BOOL horizontal)
+FX_BOOL CBC_WhiteRectangleDetector::ContainsBlackPoint(int32_t a, int32_t b, int32_t fixed, FX_BOOL horizontal)
{
if (horizontal) {
- for (FX_INT32 x = a; x <= b; x++) {
+ for (int32_t x = a; x <= b; x++) {
if (m_image->Get(x, fixed)) {
return TRUE;
}
}
} else {
- for (FX_INT32 y = a; y <= b; y++) {
+ for (int32_t y = a; y <= b; y++) {
if (m_image->Get(fixed, y)) {
return TRUE;
}
diff --git a/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.h b/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.h index 40146d39de..c7607f9e56 100644 --- a/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.h +++ b/xfa/src/fxbarcode/common/BC_WhiteRectangleDetector.h @@ -12,26 +12,26 @@ class CBC_WhiteRectangleDetector {
public:
CBC_WhiteRectangleDetector(CBC_CommonBitMatrix *image);
- CBC_WhiteRectangleDetector(CBC_CommonBitMatrix *image, FX_INT32 initSize, FX_INT32 x, FX_INT32 y);
+ CBC_WhiteRectangleDetector(CBC_CommonBitMatrix *image, int32_t initSize, int32_t x, int32_t y);
virtual ~CBC_WhiteRectangleDetector();
- CFX_PtrArray *Detect(FX_INT32 &e);
- virtual void Init(FX_INT32 &e);
+ CFX_PtrArray *Detect(int32_t &e);
+ virtual void Init(int32_t &e);
private:
- FX_INT32 Round(float d);
+ int32_t Round(float d);
CBC_ResultPoint *GetBlackPointOnSegment(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY);
- FX_INT32 DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY);
+ int32_t DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY);
CFX_PtrArray *CenterEdges(CBC_ResultPoint *y, CBC_ResultPoint *z,
CBC_ResultPoint *x, CBC_ResultPoint *t);
- FX_BOOL ContainsBlackPoint(FX_INT32 a, FX_INT32 b, FX_INT32 fixed, FX_BOOL horizontal);
- const static FX_INT32 INIT_SIZE;
- const static FX_INT32 CORR;
+ FX_BOOL ContainsBlackPoint(int32_t a, int32_t b, int32_t fixed, FX_BOOL horizontal);
+ const static int32_t INIT_SIZE;
+ const static int32_t CORR;
CBC_CommonBitMatrix *m_image;
- FX_INT32 m_height;
- FX_INT32 m_width;
- FX_INT32 m_leftInit;
- FX_INT32 m_rightInit;
- FX_INT32 m_downInit;
- FX_INT32 m_upInit;
+ int32_t m_height;
+ int32_t m_width;
+ int32_t m_leftInit;
+ int32_t m_rightInit;
+ int32_t m_downInit;
+ int32_t m_upInit;
};
#endif
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp index 1fc8b6685a..1ece2add2c 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp @@ -32,11 +32,11 @@ void CBC_ReedSolomonEncoder::Init() {
m_cachedGenerators.Add(FX_NEW CBC_ReedSolomonGF256Poly(m_field, 1));
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(FX_INT32 degree, FX_INT32 &e)
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(int32_t degree, int32_t &e)
{
if(degree >= m_cachedGenerators.GetSize()) {
CBC_ReedSolomonGF256Poly* lastGenerator = (CBC_ReedSolomonGF256Poly*)(m_cachedGenerators[m_cachedGenerators.GetSize() - 1]);
- for(FX_INT32 d = m_cachedGenerators.GetSize(); d <= degree; d++) {
+ for(int32_t d = m_cachedGenerators.GetSize(); d <= degree; d++) {
CFX_Int32Array temp;
temp.Add(1);
temp.Add(m_field->Exp(d - 1));
@@ -51,13 +51,13 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(FX_INT32 degree }
return (CBC_ReedSolomonGF256Poly*)(m_cachedGenerators[degree]);
}
-void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array *toEncode, FX_INT32 ecBytes, FX_INT32 &e)
+void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array *toEncode, int32_t ecBytes, int32_t &e)
{
if(ecBytes == 0) {
e = BCExceptionNoCorrectionBytes;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 dataBytes = toEncode->GetSize() - ecBytes;
+ int32_t dataBytes = toEncode->GetSize() - ecBytes;
if(dataBytes <= 0) {
e = BCExceptionNoDataBytesProvided;
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -66,7 +66,7 @@ void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array *toEncode, FX_INT32 ecBytes, BC_EXCEPTION_CHECK_ReturnVoid(e);
CFX_Int32Array infoCoefficients;
infoCoefficients.SetSize(dataBytes);
- for(FX_INT32 x = 0; x < dataBytes; x++) {
+ for(int32_t x = 0; x < dataBytes; x++) {
infoCoefficients[x] = toEncode->operator [](x);
}
CBC_ReedSolomonGF256Poly info;
@@ -80,21 +80,21 @@ void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array *toEncode, FX_INT32 ecBytes, CBC_AutoPtr<CFX_PtrArray > temp(pa);
CBC_ReedSolomonGF256Poly* remainder = (CBC_ReedSolomonGF256Poly*)(temp->operator [](1));
CFX_Int32Array* coefficients = remainder->GetCoefficients();
- FX_INT32 numZeroCoefficients = ecBytes - coefficients->GetSize();
- for(FX_INT32 i = 0; i < numZeroCoefficients; i++) {
+ int32_t numZeroCoefficients = ecBytes - coefficients->GetSize();
+ for(int32_t i = 0; i < numZeroCoefficients; i++) {
(*toEncode)[dataBytes + i] = 0;
}
- for(FX_INT32 y = 0; y < coefficients->GetSize(); y++) {
+ for(int32_t y = 0; y < coefficients->GetSize(); y++) {
(*toEncode)[dataBytes + numZeroCoefficients + y] =
coefficients->operator [](y);
}
- for (FX_INT32 k = 0; k < temp->GetSize(); k++) {
+ for (int32_t k = 0; k < temp->GetSize(); k++) {
delete (CBC_ReedSolomonGF256Poly*)(*temp)[k];
}
}
CBC_ReedSolomonEncoder::~CBC_ReedSolomonEncoder()
{
- for (FX_INT32 i = 0; i < m_cachedGenerators.GetSize(); i++) {
+ for (int32_t i = 0; i < m_cachedGenerators.GetSize(); i++) {
delete (CBC_ReedSolomonGF256Poly*)m_cachedGenerators[i];
}
}
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomon.h b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomon.h index 713f343d98..bc35ebed1f 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomon.h +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomon.h @@ -13,12 +13,12 @@ class CBC_ReedSolomonEncoder private:
CBC_ReedSolomonGF256* m_field;
CFX_PtrArray m_cachedGenerators;
- CBC_ReedSolomonGF256Poly* BuildGenerator(FX_INT32 degree, FX_INT32 &e);
+ CBC_ReedSolomonGF256Poly* BuildGenerator(int32_t degree, int32_t &e);
public:
CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256 * field);
virtual ~CBC_ReedSolomonEncoder();
- void Encode(CFX_Int32Array *toEncode, FX_INT32 ecBytes, FX_INT32 &e);
+ void Encode(CFX_Int32Array *toEncode, int32_t ecBytes, int32_t &e);
virtual void Init();
};
#endif
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp index 3cb5e7762f..f0e87b8e40 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp @@ -31,7 +31,7 @@ CBC_ReedSolomonDecoder::CBC_ReedSolomonDecoder(CBC_ReedSolomonGF256* field) CBC_ReedSolomonDecoder::~CBC_ReedSolomonDecoder()
{
}
-void CBC_ReedSolomonDecoder::Decode(CFX_Int32Array* received, FX_INT32 twoS, FX_INT32 &e)
+void CBC_ReedSolomonDecoder::Decode(CFX_Int32Array* received, int32_t twoS, int32_t &e)
{
CBC_ReedSolomonGF256Poly poly;
poly.Init(m_field, received, e);
@@ -40,8 +40,8 @@ void CBC_ReedSolomonDecoder::Decode(CFX_Int32Array* received, FX_INT32 twoS, FX_ syndromeCoefficients.SetSize(twoS);
FX_BOOL dataMatrix = FALSE;
FX_BOOL noError = TRUE;
- for (FX_INT32 i = 0; i < twoS; i++) {
- FX_INT32 eval = poly.EvaluateAt(m_field->Exp(dataMatrix ? i + 1 : i));
+ for (int32_t i = 0; i < twoS; i++) {
+ int32_t eval = poly.EvaluateAt(m_field->Exp(dataMatrix ? i + 1 : i));
syndromeCoefficients[twoS - 1 - i] = eval;
if (eval != 0) {
noError = FALSE;
@@ -67,8 +67,8 @@ void CBC_ReedSolomonDecoder::Decode(CFX_Int32Array* received, FX_INT32 twoS, FX_ CFX_Int32Array* ia2 = FindErrorMagnitudes(omega.get(), errorLocations.get(), dataMatrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
CBC_AutoPtr<CFX_Int32Array > errorMagnitudes(ia2);
- for (FX_INT32 k = 0; k < errorLocations->GetSize(); k++) {
- FX_INT32 position = received->GetSize() - 1 - m_field->Log((*errorLocations)[k], e);
+ for (int32_t k = 0; k < errorLocations->GetSize(); k++) {
+ int32_t position = received->GetSize() - 1 - m_field->Log((*errorLocations)[k], e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if(position < 0) {
e = BCExceptionBadErrorLocation;
@@ -77,7 +77,7 @@ void CBC_ReedSolomonDecoder::Decode(CFX_Int32Array* received, FX_INT32 twoS, FX_ (*received)[position] = CBC_ReedSolomonGF256::AddOrSubtract((*received)[position], (*errorMagnitudes)[k]);
}
}
-CFX_PtrArray *CBC_ReedSolomonDecoder::RunEuclideanAlgorithm(CBC_ReedSolomonGF256Poly* a, CBC_ReedSolomonGF256Poly* b, FX_INT32 R, FX_INT32 &e)
+CFX_PtrArray *CBC_ReedSolomonDecoder::RunEuclideanAlgorithm(CBC_ReedSolomonGF256Poly* a, CBC_ReedSolomonGF256Poly* b, int32_t R, int32_t &e)
{
if (a->GetDegree() < b->GetDegree()) {
CBC_ReedSolomonGF256Poly* temp = a;
@@ -120,12 +120,12 @@ CFX_PtrArray *CBC_ReedSolomonDecoder::RunEuclideanAlgorithm(CBC_ReedSolomonGF256 CBC_ReedSolomonGF256Poly* rsg8 = m_field->GetZero()->Clone(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> q(rsg8);
- FX_INT32 denominatorLeadingTerm = rLast->GetCoefficients(rLast->GetDegree());
- FX_INT32 dltInverse = m_field->Inverse(denominatorLeadingTerm, e);
+ int32_t denominatorLeadingTerm = rLast->GetCoefficients(rLast->GetDegree());
+ int32_t dltInverse = m_field->Inverse(denominatorLeadingTerm, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
while (r->GetDegree() >= rLast->GetDegree() && !(r->IsZero())) {
- FX_INT32 degreeDiff = r->GetDegree() - rLast->GetDegree();
- FX_INT32 scale = m_field->Multiply(r->GetCoefficients(r->GetDegree()), dltInverse);
+ int32_t degreeDiff = r->GetDegree() - rLast->GetDegree();
+ int32_t scale = m_field->Multiply(r->GetCoefficients(r->GetDegree()), dltInverse);
CBC_ReedSolomonGF256Poly* rsgp1 = m_field->BuildMonomial(degreeDiff, scale, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> build(rsgp1);
@@ -156,12 +156,12 @@ CFX_PtrArray *CBC_ReedSolomonDecoder::RunEuclideanAlgorithm(CBC_ReedSolomonGF256 CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp6(rsg12);
t = temp6;
}
- FX_INT32 sigmaTildeAtZero = t->GetCoefficients(0);
+ int32_t sigmaTildeAtZero = t->GetCoefficients(0);
if (sigmaTildeAtZero == 0) {
e = BCExceptionIsZero;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
- FX_INT32 inverse = m_field->Inverse(sigmaTildeAtZero, e);
+ int32_t inverse = m_field->Inverse(sigmaTildeAtZero, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_ReedSolomonGF256Poly* rsg13 = t->Multiply(inverse, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -174,9 +174,9 @@ CFX_PtrArray *CBC_ReedSolomonDecoder::RunEuclideanAlgorithm(CBC_ReedSolomonGF256 temp->Add(omega.release());
return temp;
}
-CFX_Int32Array *CBC_ReedSolomonDecoder::FindErrorLocations(CBC_ReedSolomonGF256Poly* errorLocator, FX_INT32 &e)
+CFX_Int32Array *CBC_ReedSolomonDecoder::FindErrorLocations(CBC_ReedSolomonGF256Poly* errorLocator, int32_t &e)
{
- FX_INT32 numErrors = errorLocator->GetDegree();
+ int32_t numErrors = errorLocator->GetDegree();
if (numErrors == 1) {
CBC_AutoPtr<CFX_Int32Array > temp(FX_NEW CFX_Int32Array);
temp->Add(errorLocator->GetCoefficients(1));
@@ -185,8 +185,8 @@ CFX_Int32Array *CBC_ReedSolomonDecoder::FindErrorLocations(CBC_ReedSolomonGF256P CFX_Int32Array *tempT = FX_NEW CFX_Int32Array;
tempT->SetSize(numErrors);
CBC_AutoPtr<CFX_Int32Array > result(tempT);
- FX_INT32 ie = 0;
- for (FX_INT32 i = 1; i < 256 && ie < numErrors; i++) {
+ int32_t ie = 0;
+ for (int32_t i = 1; i < 256 && ie < numErrors; i++) {
if(errorLocator->EvaluateAt(i) == 0) {
(*result)[ie] = m_field->Inverse(i, ie);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -199,23 +199,23 @@ CFX_Int32Array *CBC_ReedSolomonDecoder::FindErrorLocations(CBC_ReedSolomonGF256P }
return result.release();
}
-CFX_Int32Array *CBC_ReedSolomonDecoder::FindErrorMagnitudes(CBC_ReedSolomonGF256Poly* errorEvaluator, CFX_Int32Array* errorLocations, FX_BOOL dataMatrix, FX_INT32 &e)
+CFX_Int32Array *CBC_ReedSolomonDecoder::FindErrorMagnitudes(CBC_ReedSolomonGF256Poly* errorEvaluator, CFX_Int32Array* errorLocations, FX_BOOL dataMatrix, int32_t &e)
{
- FX_INT32 s = errorLocations->GetSize();
+ int32_t s = errorLocations->GetSize();
CFX_Int32Array * temp = FX_NEW CFX_Int32Array;
temp->SetSize(s);
CBC_AutoPtr<CFX_Int32Array > result(temp);
- for (FX_INT32 i = 0; i < s; i++) {
- FX_INT32 xiInverse = m_field->Inverse(errorLocations->operator [](i), e);
+ for (int32_t i = 0; i < s; i++) {
+ int32_t xiInverse = m_field->Inverse(errorLocations->operator [](i), e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 denominator = 1;
- for(FX_INT32 j = 0; j < s; j++) {
+ int32_t denominator = 1;
+ for(int32_t j = 0; j < s; j++) {
if(i != j) {
denominator = m_field->Multiply(denominator,
CBC_ReedSolomonGF256::AddOrSubtract(1, m_field->Multiply(errorLocations->operator [](j), xiInverse)));
}
}
- FX_INT32 temp = m_field->Inverse(denominator, temp);
+ int32_t temp = m_field->Inverse(denominator, temp);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
(*result)[i] = m_field->Multiply(errorEvaluator->EvaluateAt(xiInverse),
temp);
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h index db026edd01..edefd4a29a 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h @@ -15,9 +15,9 @@ private: public:
CBC_ReedSolomonDecoder(CBC_ReedSolomonGF256 * field);
virtual ~CBC_ReedSolomonDecoder();
- void Decode(CFX_Int32Array* received, FX_INT32 twoS, FX_INT32 &e);
- CFX_PtrArray* RunEuclideanAlgorithm(CBC_ReedSolomonGF256Poly* a, CBC_ReedSolomonGF256Poly* b, FX_INT32 R, FX_INT32 &e);
- CFX_Int32Array* FindErrorLocations(CBC_ReedSolomonGF256Poly* errorLocator, FX_INT32 &e);
- CFX_Int32Array* FindErrorMagnitudes(CBC_ReedSolomonGF256Poly* errorEvaluator, CFX_Int32Array* errorLocations, FX_BOOL dataMatrix, FX_INT32 &e);
+ void Decode(CFX_Int32Array* received, int32_t twoS, int32_t &e);
+ CFX_PtrArray* RunEuclideanAlgorithm(CBC_ReedSolomonGF256Poly* a, CBC_ReedSolomonGF256Poly* b, int32_t R, int32_t &e);
+ CFX_Int32Array* FindErrorLocations(CBC_ReedSolomonGF256Poly* errorLocator, int32_t &e);
+ CFX_Int32Array* FindErrorMagnitudes(CBC_ReedSolomonGF256Poly* errorEvaluator, CFX_Int32Array* errorLocations, FX_BOOL dataMatrix, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp index bb045ac24c..426ac2fbd8 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp @@ -43,17 +43,17 @@ void CBC_ReedSolomonGF256::Finalize() }
DataMatrixField = NULL;
}
-CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(FX_INT32 primitive)
+CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive)
{
- FX_INT32 x = 1;
- for(FX_INT32 j = 0; j < 256; j++) {
+ int32_t x = 1;
+ for(int32_t j = 0; j < 256; j++) {
m_expTable[j] = x;
x <<= 1;
if(x >= 0x100) {
x ^= primitive;
}
}
- for(FX_INT32 i = 0; i < 255; i++) {
+ for(int32_t i = 0; i < 255; i++) {
m_logTable[m_expTable[i]] = i;
}
m_logTable[0] = 0;
@@ -82,7 +82,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() {
return m_one;
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e)
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(int32_t degree, int32_t coefficient, int32_t &e)
{
if(degree < 0) {
e = BCExceptionDegreeIsNegative;
@@ -101,15 +101,15 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(FX_INT32 degree, F BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
-FX_INT32 CBC_ReedSolomonGF256::AddOrSubtract(FX_INT32 a, FX_INT32 b)
+int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b)
{
return a ^ b;
}
-FX_INT32 CBC_ReedSolomonGF256::Exp(FX_INT32 a)
+int32_t CBC_ReedSolomonGF256::Exp(int32_t a)
{
return m_expTable[a];
}
-FX_INT32 CBC_ReedSolomonGF256::Log(FX_INT32 a, FX_INT32 &e)
+int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t &e)
{
if(a == 0) {
e = BCExceptionAIsZero;
@@ -117,7 +117,7 @@ FX_INT32 CBC_ReedSolomonGF256::Log(FX_INT32 a, FX_INT32 &e) }
return m_logTable[a];
}
-FX_INT32 CBC_ReedSolomonGF256::Inverse(FX_INT32 a, FX_INT32 &e)
+int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t &e)
{
if(a == 0) {
e = BCExceptionAIsZero;
@@ -125,7 +125,7 @@ FX_INT32 CBC_ReedSolomonGF256::Inverse(FX_INT32 a, FX_INT32 &e) }
return m_expTable[255 - m_logTable[a]];
}
-FX_INT32 CBC_ReedSolomonGF256::Multiply(FX_INT32 a, FX_INT32 b)
+int32_t CBC_ReedSolomonGF256::Multiply(int32_t a, int32_t b)
{
if(a == 0 || b == 0) {
return 0;
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h index 40e7ffef28..141c3dab36 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h @@ -14,20 +14,20 @@ public: static void Finalize();
static CBC_ReedSolomonGF256 *QRCodeFild;
static CBC_ReedSolomonGF256 *DataMatrixField;
- CBC_ReedSolomonGF256(FX_INT32 primitive);
+ CBC_ReedSolomonGF256(int32_t primitive);
virtual ~CBC_ReedSolomonGF256();
CBC_ReedSolomonGF256Poly* GetZero();
CBC_ReedSolomonGF256Poly* GetOne();
- CBC_ReedSolomonGF256Poly* BuildMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e);
- static FX_INT32 AddOrSubtract(FX_INT32 a, FX_INT32 b);
- FX_INT32 Exp(FX_INT32 a);
- FX_INT32 Log(FX_INT32 a, FX_INT32 &e);
- FX_INT32 Inverse(FX_INT32 a, FX_INT32 &e);
- FX_INT32 Multiply(FX_INT32 a, FX_INT32 b);
+ CBC_ReedSolomonGF256Poly* BuildMonomial(int32_t degree, int32_t coefficient, int32_t &e);
+ static int32_t AddOrSubtract(int32_t a, int32_t b);
+ int32_t Exp(int32_t a);
+ int32_t Log(int32_t a, int32_t &e);
+ int32_t Inverse(int32_t a, int32_t &e);
+ int32_t Multiply(int32_t a, int32_t b);
virtual void Init();
private:
- FX_INT32 m_expTable[256];
- FX_INT32 m_logTable[256];
+ int32_t m_expTable[256];
+ int32_t m_logTable[256];
CBC_ReedSolomonGF256Poly *m_zero;
CBC_ReedSolomonGF256Poly *m_one;
};
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp index 6476e4cf80..d59f619e25 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp @@ -23,7 +23,7 @@ #include "../../barcode.h"
#include "BC_ReedSolomonGF256.h"
#include "BC_ReedSolomonGF256Poly.h"
-CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, FX_INT32 coefficients)
+CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, int32_t coefficients)
{
if(field == NULL) {
return;
@@ -35,16 +35,16 @@ CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly() {
m_field = NULL;
}
-void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field, CFX_Int32Array* coefficients, FX_INT32 &e)
+void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field, CFX_Int32Array* coefficients, int32_t &e)
{
if(coefficients == NULL || coefficients->GetSize() == 0) {
e = BCExceptionCoefficientsSizeIsNull;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
m_field = field;
- FX_INT32 coefficientsLength = coefficients->GetSize();
+ int32_t coefficientsLength = coefficients->GetSize();
if((coefficientsLength > 1 && (*coefficients)[0] == 0)) {
- FX_INT32 firstNonZero = 1;
+ int32_t firstNonZero = 1;
while((firstNonZero < coefficientsLength) && ((*coefficients)[firstNonZero] == 0)) {
firstNonZero++;
}
@@ -52,7 +52,7 @@ void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field, CFX_Int32Array* m_coefficients.Copy( *(m_field->GetZero()->GetCoefficients()));
} else {
m_coefficients.SetSize(coefficientsLength - firstNonZero);
- for(FX_INT32 i = firstNonZero, j = 0; i < coefficientsLength; i++, j++) {
+ for(int32_t i = firstNonZero, j = 0; i < coefficientsLength; i++, j++) {
m_coefficients[j] = coefficients->operator [](i);
}
}
@@ -64,7 +64,7 @@ CFX_Int32Array* CBC_ReedSolomonGF256Poly::GetCoefficients() {
return &m_coefficients;
}
-FX_INT32 CBC_ReedSolomonGF256Poly::GetDegree()
+int32_t CBC_ReedSolomonGF256Poly::GetDegree()
{
return m_coefficients.GetSize() - 1;
}
@@ -72,39 +72,39 @@ FX_BOOL CBC_ReedSolomonGF256Poly::IsZero() {
return m_coefficients[0] == 0;
}
-FX_INT32 CBC_ReedSolomonGF256Poly::GetCoefficients(FX_INT32 degree)
+int32_t CBC_ReedSolomonGF256Poly::GetCoefficients(int32_t degree)
{
return m_coefficients[m_coefficients.GetSize() - 1 - degree];
}
-FX_INT32 CBC_ReedSolomonGF256Poly::EvaluateAt(FX_INT32 a)
+int32_t CBC_ReedSolomonGF256Poly::EvaluateAt(int32_t a)
{
if(a == 0) {
return GetCoefficients(0);
}
- FX_INT32 size = m_coefficients.GetSize();
+ int32_t size = m_coefficients.GetSize();
if(a == 1) {
- FX_INT32 result = 0;
- for(FX_INT32 i = 0; i < size; i++) {
+ int32_t result = 0;
+ for(int32_t i = 0; i < size; i++) {
result = CBC_ReedSolomonGF256::AddOrSubtract(result, m_coefficients[i]);
}
return result;
}
- FX_INT32 result = m_coefficients[0];
- for(FX_INT32 j = 1; j < size; j++) {
+ int32_t result = m_coefficients[0];
+ for(int32_t j = 1; j < size; j++) {
result = CBC_ReedSolomonGF256::AddOrSubtract(
m_field->Multiply(a, result),
m_coefficients[j]);
}
return result;
}
-CBC_ReedSolomonGF256Poly *CBC_ReedSolomonGF256Poly::Clone(FX_INT32 &e)
+CBC_ReedSolomonGF256Poly *CBC_ReedSolomonGF256Poly::Clone(int32_t &e)
{
CBC_ReedSolomonGF256Poly *temp = FX_NEW CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &m_coefficients, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(CBC_ReedSolomonGF256Poly* other, FX_INT32 &e)
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(CBC_ReedSolomonGF256Poly* other, int32_t &e)
{
if(IsZero()) {
return other->Clone(e);
@@ -126,11 +126,11 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(CBC_ReedSolomo }
CFX_Int32Array sumDiff;
sumDiff.SetSize(largerCoefficients.GetSize() );
- FX_INT32 lengthDiff = largerCoefficients.GetSize() - smallerCoefficients.GetSize();
- for(FX_INT32 i = 0; i < lengthDiff; i++) {
+ int32_t lengthDiff = largerCoefficients.GetSize() - smallerCoefficients.GetSize();
+ for(int32_t i = 0; i < lengthDiff; i++) {
sumDiff[i] = largerCoefficients[i];
}
- for(FX_INT32 j = lengthDiff; j < largerCoefficients.GetSize(); j++) {
+ for(int32_t j = lengthDiff; j < largerCoefficients.GetSize(); j++) {
sumDiff[j] = (CBC_ReedSolomonGF256::AddOrSubtract(smallerCoefficients[j - lengthDiff],
largerCoefficients[j]));
}
@@ -139,7 +139,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(CBC_ReedSolomo BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(CBC_ReedSolomonGF256Poly* other, FX_INT32 &e)
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(CBC_ReedSolomonGF256Poly* other, int32_t &e)
{
if(IsZero() || other->IsZero()) {
CBC_ReedSolomonGF256Poly *temp = m_field->GetZero()->Clone(e);
@@ -148,15 +148,15 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(CBC_ReedSolomonGF25 }
CFX_Int32Array aCoefficients ;
aCoefficients.Copy(m_coefficients);
- FX_INT32 aLength = m_coefficients.GetSize();
+ int32_t aLength = m_coefficients.GetSize();
CFX_Int32Array bCoefficients;
bCoefficients.Copy(*(other->GetCoefficients()));
- FX_INT32 bLength = other->GetCoefficients()->GetSize();
+ int32_t bLength = other->GetCoefficients()->GetSize();
CFX_Int32Array product;
product.SetSize(aLength + bLength - 1);
- for(FX_INT32 i = 0; i < aLength; i++) {
- FX_INT32 aCoeff = m_coefficients[i];
- for(FX_INT32 j = 0; j < bLength; j++) {
+ for(int32_t i = 0; i < aLength; i++) {
+ int32_t aCoeff = m_coefficients[i];
+ for(int32_t j = 0; j < bLength; j++) {
product[i + j] = CBC_ReedSolomonGF256::AddOrSubtract(
product[i + j],
m_field->Multiply(aCoeff, other->GetCoefficients()->operator [](j)));
@@ -167,7 +167,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(CBC_ReedSolomonGF25 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(FX_INT32 scalar, FX_INT32 &e)
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar, int32_t &e)
{
if(scalar == 0) {
CBC_ReedSolomonGF256Poly *temp = m_field->GetZero()->Clone(e);
@@ -178,10 +178,10 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(FX_INT32 scalar, FX return this->Clone(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
- FX_INT32 size = m_coefficients.GetSize();
+ int32_t size = m_coefficients.GetSize();
CFX_Int32Array product;
product.SetSize(size);
- for(FX_INT32 i = 0; i < size; i++) {
+ for(int32_t i = 0; i < size; i++) {
product[i] = m_field->Multiply(m_coefficients[i], scalar);
}
CBC_ReedSolomonGF256Poly *temp = FX_NEW CBC_ReedSolomonGF256Poly();
@@ -189,7 +189,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(FX_INT32 scalar, FX BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e)
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(int32_t degree, int32_t coefficient, int32_t &e)
{
if(degree < 0) {
e = BCExceptionDegreeIsNegative;
@@ -200,10 +200,10 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(FX_INT32 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
- FX_INT32 size = m_coefficients.GetSize();
+ int32_t size = m_coefficients.GetSize();
CFX_Int32Array product;
product.SetSize(size + degree);
- for(FX_INT32 i = 0; i < size; i++) {
+ for(int32_t i = 0; i < size; i++) {
product[i] = (m_field->Multiply(m_coefficients[i], coefficient));
}
CBC_ReedSolomonGF256Poly *temp = FX_NEW CBC_ReedSolomonGF256Poly();
@@ -211,7 +211,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(FX_INT32 BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
-CFX_PtrArray* CBC_ReedSolomonGF256Poly::Divide(CBC_ReedSolomonGF256Poly *other, FX_INT32 &e)
+CFX_PtrArray* CBC_ReedSolomonGF256Poly::Divide(CBC_ReedSolomonGF256Poly *other, int32_t &e)
{
if(other->IsZero()) {
e = BCExceptionDivideByZero;
@@ -223,13 +223,13 @@ CFX_PtrArray* CBC_ReedSolomonGF256Poly::Divide(CBC_ReedSolomonGF256Poly *other, CBC_ReedSolomonGF256Poly* rsg2 = this->Clone(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> remainder(rsg2);
- FX_INT32 denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
- FX_INT32 inverseDenominatorLeadingTeam = m_field->Inverse(denominatorLeadingTerm, e);
+ int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
+ int32_t inverseDenominatorLeadingTeam = m_field->Inverse(denominatorLeadingTerm, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
FX_BOOL bFirst = TRUE;
while(remainder->GetDegree() >= other->GetDegree() && !remainder->IsZero()) {
- FX_INT32 degreeDifference = remainder->GetDegree() - other->GetDegree();
- FX_INT32 scale = m_field->Multiply(remainder->GetCoefficients((remainder->GetDegree())),
+ int32_t degreeDifference = remainder->GetDegree() - other->GetDegree();
+ int32_t scale = m_field->Multiply(remainder->GetCoefficients((remainder->GetDegree())),
inverseDenominatorLeadingTeam);
CBC_ReedSolomonGF256Poly* rsg3 = other->MultiplyByMonomial(degreeDifference, scale, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h index 5c9ae6cce6..d7f1508b40 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h @@ -10,21 +10,21 @@ class CBC_ReedSolomonGF256; class CBC_ReedSolomonGF256Poly
{
public:
- CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, FX_INT32 coefficients);
+ CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, int32_t coefficients);
CBC_ReedSolomonGF256Poly();
virtual ~CBC_ReedSolomonGF256Poly();
- FX_INT32 GetCoefficients(FX_INT32 degree);
+ int32_t GetCoefficients(int32_t degree);
CFX_Int32Array* GetCoefficients();
- FX_INT32 GetDegree();
+ int32_t GetDegree();
FX_BOOL IsZero();
- FX_INT32 EvaluateAt(FX_INT32 a);
- CBC_ReedSolomonGF256Poly* AddOrSubtract(CBC_ReedSolomonGF256Poly* other, FX_INT32 &e);
- CBC_ReedSolomonGF256Poly* Multiply(CBC_ReedSolomonGF256Poly* other, FX_INT32 &e);
- CBC_ReedSolomonGF256Poly* Multiply(FX_INT32 scalar, FX_INT32 &e);
- CBC_ReedSolomonGF256Poly* MultiplyByMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e);
- CFX_PtrArray* Divide(CBC_ReedSolomonGF256Poly *other, FX_INT32 &e);
- CBC_ReedSolomonGF256Poly* Clone(FX_INT32 &e);
- virtual void Init(CBC_ReedSolomonGF256* field, CFX_Int32Array* coefficients, FX_INT32 &e);
+ int32_t EvaluateAt(int32_t a);
+ CBC_ReedSolomonGF256Poly* AddOrSubtract(CBC_ReedSolomonGF256Poly* other, int32_t &e);
+ CBC_ReedSolomonGF256Poly* Multiply(CBC_ReedSolomonGF256Poly* other, int32_t &e);
+ CBC_ReedSolomonGF256Poly* Multiply(int32_t scalar, int32_t &e);
+ CBC_ReedSolomonGF256Poly* MultiplyByMonomial(int32_t degree, int32_t coefficient, int32_t &e);
+ CFX_PtrArray* Divide(CBC_ReedSolomonGF256Poly *other, int32_t &e);
+ CBC_ReedSolomonGF256Poly* Clone(int32_t &e);
+ virtual void Init(CBC_ReedSolomonGF256* field, CFX_Int32Array* coefficients, int32_t &e);
private:
CBC_ReedSolomonGF256* m_field;
CFX_Int32Array m_coefficients;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp index bc29b7d6ce..df58f15212 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.cpp @@ -34,13 +34,13 @@ CBC_ASCIIEncoder::CBC_ASCIIEncoder() CBC_ASCIIEncoder::~CBC_ASCIIEncoder()
{
}
-FX_INT32 CBC_ASCIIEncoder::getEncodingMode()
+int32_t CBC_ASCIIEncoder::getEncodingMode()
{
return ASCII_ENCODATION;
}
-void CBC_ASCIIEncoder::Encode(CBC_EncoderContext &context, FX_INT32 &e)
+void CBC_ASCIIEncoder::Encode(CBC_EncoderContext &context, int32_t &e)
{
- FX_INT32 n = CBC_HighLevelEncoder::determineConsecutiveDigitCount(context.m_msg, context.m_pos);
+ int32_t n = CBC_HighLevelEncoder::determineConsecutiveDigitCount(context.m_msg, context.m_pos);
if (n >= 2) {
FX_WCHAR code = encodeASCIIDigits(context.m_msg.GetAt(context.m_pos), context.m_msg.GetAt(context.m_pos + 1), e);
if (e != BCExceptionNO) {
@@ -50,7 +50,7 @@ void CBC_ASCIIEncoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) context.m_pos += 2;
} else {
FX_WCHAR c = context.getCurrentChar();
- FX_INT32 newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
if (newMode != getEncodingMode()) {
switch (newMode) {
case BASE256_ENCODATION:
@@ -87,10 +87,10 @@ void CBC_ASCIIEncoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) }
}
}
-FX_WCHAR CBC_ASCIIEncoder::encodeASCIIDigits(FX_WCHAR digit1, FX_WCHAR digit2, FX_INT32 &e)
+FX_WCHAR CBC_ASCIIEncoder::encodeASCIIDigits(FX_WCHAR digit1, FX_WCHAR digit2, int32_t &e)
{
if (CBC_HighLevelEncoder::isDigit(digit1) && CBC_HighLevelEncoder::isDigit(digit2)) {
- FX_INT32 num = (digit1 - 48) * 10 + (digit2 - 48);
+ int32_t num = (digit1 - 48) * 10 + (digit2 - 48);
FX_WCHAR a = (FX_WCHAR) (num + 130);
return (FX_WCHAR) (num + 130);
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.h b/xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.h index 9a48b8762f..3c05a41d7b 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_ASCIIEncoder.h @@ -14,9 +14,9 @@ class CBC_ASCIIEncoder : public CBC_Encoder public:
CBC_ASCIIEncoder();
virtual ~CBC_ASCIIEncoder();
- FX_INT32 getEncodingMode();
- void Encode(CBC_EncoderContext &context, FX_INT32 &e);
+ int32_t getEncodingMode();
+ void Encode(CBC_EncoderContext &context, int32_t &e);
private:
- static FX_WCHAR encodeASCIIDigits(FX_WCHAR digit1, FX_WCHAR digit2, FX_INT32 &e);
+ static FX_WCHAR encodeASCIIDigits(FX_WCHAR digit1, FX_WCHAR digit2, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.cpp index d896cf6445..7a68fcaef6 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.cpp @@ -34,11 +34,11 @@ CBC_Base256Encoder::CBC_Base256Encoder() CBC_Base256Encoder::~CBC_Base256Encoder()
{
}
-FX_INT32 CBC_Base256Encoder::getEncodingMode()
+int32_t CBC_Base256Encoder::getEncodingMode()
{
return BASE256_ENCODATION;
}
-void CBC_Base256Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e)
+void CBC_Base256Encoder::Encode(CBC_EncoderContext &context, int32_t &e)
{
CFX_WideString buffer;
buffer += (FX_WCHAR)'\0';
@@ -46,13 +46,13 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) FX_WCHAR c = context.getCurrentChar();
buffer += c;
context.m_pos++;
- FX_INT32 newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
if (newMode != getEncodingMode()) {
context.signalEncoderChange(newMode);
break;
}
}
- FX_INT32 dataCount = buffer.GetLength() - 1;
+ int32_t dataCount = buffer.GetLength() - 1;
FX_CHAR buf[128];
#if defined(_FX_WINAPI_PARTITION_APP_)
memset(buf, 0, sizeof(FX_CHAR) * 128);
@@ -61,8 +61,8 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) FXSYS_itoa(dataCount, buf, 10);
#endif
buffer.SetAt(0, FX_WCHAR(*buf) - '0');
- FX_INT32 lengthFieldSize = 1;
- FX_INT32 currentSize = context.getCodewordCount() + dataCount + lengthFieldSize;
+ int32_t lengthFieldSize = 1;
+ int32_t currentSize = context.getCodewordCount() + dataCount + lengthFieldSize;
context.updateSymbolInfo(currentSize, e);
if (e != BCExceptionNO) {
return;
@@ -79,14 +79,14 @@ void CBC_Base256Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) return;
}
}
- for (FX_INT32 i = 0, c = buffer.GetLength(); i < c; i++) {
+ for (int32_t i = 0, c = buffer.GetLength(); i < c; i++) {
context.writeCodeword(randomize255State(buffer.GetAt(i), context.getCodewordCount() + 1));
}
}
-FX_WCHAR CBC_Base256Encoder::randomize255State(FX_WCHAR ch, FX_INT32 codewordPosition)
+FX_WCHAR CBC_Base256Encoder::randomize255State(FX_WCHAR ch, int32_t codewordPosition)
{
- FX_INT32 pseudoRandom = ((149 * codewordPosition) % 255) + 1;
- FX_INT32 tempVariable = ch + pseudoRandom;
+ int32_t pseudoRandom = ((149 * codewordPosition) % 255) + 1;
+ int32_t tempVariable = ch + pseudoRandom;
if (tempVariable <= 255) {
return (FX_WCHAR) tempVariable;
} else {
diff --git a/xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.h b/xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.h index 96110b1d08..61e6c8085f 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_Base256Encoder.h @@ -13,9 +13,9 @@ class CBC_Base256Encoder : public CBC_Encoder public:
CBC_Base256Encoder();
virtual ~CBC_Base256Encoder();
- FX_INT32 getEncodingMode();
- void Encode(CBC_EncoderContext &context, FX_INT32 &e);
+ int32_t getEncodingMode();
+ void Encode(CBC_EncoderContext &context, int32_t &e);
private:
- static FX_WCHAR randomize255State(FX_WCHAR ch, FX_INT32 codewordPosition);
+ static FX_WCHAR randomize255State(FX_WCHAR ch, int32_t codewordPosition);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_C40Encoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_C40Encoder.cpp index 4c3b458afa..0afd018558 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_C40Encoder.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_C40Encoder.cpp @@ -35,27 +35,27 @@ CBC_C40Encoder::CBC_C40Encoder() CBC_C40Encoder::~CBC_C40Encoder()
{
}
-FX_INT32 CBC_C40Encoder::getEncodingMode()
+int32_t CBC_C40Encoder::getEncodingMode()
{
return C40_ENCODATION;
}
-void CBC_C40Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e)
+void CBC_C40Encoder::Encode(CBC_EncoderContext &context, int32_t &e)
{
CFX_WideString buffer;
while (context.hasMoreCharacters()) {
FX_WCHAR c = context.getCurrentChar();
context.m_pos++;
- FX_INT32 lastCharSize = encodeChar(c, buffer, e);
+ int32_t lastCharSize = encodeChar(c, buffer, e);
if (e != BCExceptionNO) {
return;
}
- FX_INT32 unwritten = (buffer.GetLength() / 3) * 2;
- FX_INT32 curCodewordCount = context.getCodewordCount() + unwritten;
+ int32_t unwritten = (buffer.GetLength() / 3) * 2;
+ int32_t curCodewordCount = context.getCodewordCount() + unwritten;
context.updateSymbolInfo(curCodewordCount, e);
if (e != BCExceptionNO) {
return;
}
- FX_INT32 available = context.m_symbolInfo->m_dataCapacity - curCodewordCount;
+ int32_t available = context.m_symbolInfo->m_dataCapacity - curCodewordCount;
if (!context.hasMoreCharacters()) {
CFX_WideString removed;
if ((buffer.GetLength() % 3) == 2) {
@@ -75,9 +75,9 @@ void CBC_C40Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) }
break;
}
- FX_INT32 count = buffer.GetLength();
+ int32_t count = buffer.GetLength();
if ((count % 3) == 0) {
- FX_INT32 newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
if (newMode != getEncodingMode()) {
context.signalEncoderChange(newMode);
break;
@@ -91,16 +91,16 @@ void CBC_C40Encoder::writeNextTriplet(CBC_EncoderContext &context, CFX_WideStrin context.writeCodewords(encodeToCodewords(buffer, 0));
buffer.Delete(0, 3);
}
-void CBC_C40Encoder::handleEOD(CBC_EncoderContext &context, CFX_WideString &buffer, FX_INT32 &e)
+void CBC_C40Encoder::handleEOD(CBC_EncoderContext &context, CFX_WideString &buffer, int32_t &e)
{
- FX_INT32 unwritten = (buffer.GetLength() / 3) * 2;
- FX_INT32 rest = buffer.GetLength() % 3;
- FX_INT32 curCodewordCount = context.getCodewordCount() + unwritten;
+ int32_t unwritten = (buffer.GetLength() / 3) * 2;
+ int32_t rest = buffer.GetLength() % 3;
+ int32_t curCodewordCount = context.getCodewordCount() + unwritten;
context.updateSymbolInfo(curCodewordCount, e);
if (e != BCExceptionNO) {
return;
}
- FX_INT32 available = context.m_symbolInfo->m_dataCapacity - curCodewordCount;
+ int32_t available = context.m_symbolInfo->m_dataCapacity - curCodewordCount;
if (rest == 2) {
buffer += (FX_WCHAR)'\0';
while (buffer.GetLength() >= 3) {
@@ -130,7 +130,7 @@ void CBC_C40Encoder::handleEOD(CBC_EncoderContext &context, CFX_WideString &buff }
context.signalEncoderChange(ASCII_ENCODATION);
}
-FX_INT32 CBC_C40Encoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e)
+int32_t CBC_C40Encoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e)
{
if (c == ' ') {
sb += (FX_WCHAR)'\3';
@@ -164,7 +164,7 @@ FX_INT32 CBC_C40Encoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e) } else if (c >= 80) {
sb += (FX_WCHAR)'\1';
sb += (FX_WCHAR)0x001e;
- FX_INT32 len = 2;
+ int32_t len = 2;
len += encodeChar((c - 128), sb, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
return len;
@@ -173,9 +173,9 @@ FX_INT32 CBC_C40Encoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e) return 0;
}
}
-FX_INT32 CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext &context, CFX_WideString &buffer, CFX_WideString &removed, FX_INT32 lastCharSize, FX_INT32 &e)
+int32_t CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext &context, CFX_WideString &buffer, CFX_WideString &removed, int32_t lastCharSize, int32_t &e)
{
- FX_INT32 count = buffer.GetLength();
+ int32_t count = buffer.GetLength();
buffer.Delete(count - lastCharSize, count);
context.m_pos--;
FX_WCHAR c = context.getCurrentChar();
@@ -184,12 +184,12 @@ FX_INT32 CBC_C40Encoder::backtrackOneCharacter(CBC_EncoderContext &context, CFX_ context.resetSymbolInfo();
return lastCharSize;
}
-CFX_WideString CBC_C40Encoder::encodeToCodewords(CFX_WideString sb, FX_INT32 startPos)
+CFX_WideString CBC_C40Encoder::encodeToCodewords(CFX_WideString sb, int32_t startPos)
{
FX_WCHAR c1 = sb.GetAt(startPos);
FX_WCHAR c2 = sb.GetAt(startPos + 1);
FX_WCHAR c3 = sb.GetAt(startPos + 2);
- FX_INT32 v = (1600 * c1) + (40 * c2) + c3 + 1;
+ int32_t v = (1600 * c1) + (40 * c2) + c3 + 1;
FX_WCHAR cw1 = (FX_WCHAR) (v / 256);
FX_WCHAR cw2 = (FX_WCHAR) (v % 256);
CFX_WideString b1(cw1);
diff --git a/xfa/src/fxbarcode/datamatrix/BC_C40Encoder.h b/xfa/src/fxbarcode/datamatrix/BC_C40Encoder.h index 7f2d2f7e79..2ab7f4e29b 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_C40Encoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_C40Encoder.h @@ -12,13 +12,13 @@ class CBC_C40Encoder : public CBC_Encoder public:
CBC_C40Encoder();
virtual ~CBC_C40Encoder();
- virtual FX_INT32 getEncodingMode();
- virtual void Encode(CBC_EncoderContext &context, FX_INT32 &e);
+ virtual int32_t getEncodingMode();
+ virtual void Encode(CBC_EncoderContext &context, int32_t &e);
static void writeNextTriplet(CBC_EncoderContext &context, CFX_WideString &buffer);
- virtual void handleEOD(CBC_EncoderContext &context, CFX_WideString &buffer, FX_INT32 &e);
- virtual FX_INT32 encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e);
+ virtual void handleEOD(CBC_EncoderContext &context, CFX_WideString &buffer, int32_t &e);
+ virtual int32_t encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e);
private:
- FX_INT32 backtrackOneCharacter(CBC_EncoderContext &context, CFX_WideString &buffer, CFX_WideString &removed, FX_INT32 lastCharSize, FX_INT32 &e);
- static CFX_WideString encodeToCodewords(CFX_WideString sb, FX_INT32 startPos);
+ int32_t backtrackOneCharacter(CBC_EncoderContext &context, CFX_WideString &buffer, CFX_WideString &removed, int32_t lastCharSize, int32_t &e);
+ static CFX_WideString encodeToCodewords(CFX_WideString sb, int32_t startPos);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp index cfb676b0a7..4fb82f1034 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.cpp @@ -30,9 +30,9 @@ CBC_DataMatrixBitMatrixParser::CBC_DataMatrixBitMatrixParser() m_version = NULL;
m_readMappingMatrix = NULL;
}
-void CBC_DataMatrixBitMatrixParser::Init(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e)
+void CBC_DataMatrixBitMatrixParser::Init(CBC_CommonBitMatrix *bitMatrix, int32_t &e)
{
- FX_INT32 dimension = bitMatrix->GetHeight();
+ int32_t dimension = bitMatrix->GetHeight();
if (dimension < 8 || dimension > 144 || (dimension & 0x01) != 0) {
e = BCExceptionFormatException;
return;
@@ -59,45 +59,45 @@ CBC_DataMatrixVersion *CBC_DataMatrixBitMatrixParser::GetVersion() {
return m_version;
}
-CBC_DataMatrixVersion *CBC_DataMatrixBitMatrixParser::ReadVersion(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e)
+CBC_DataMatrixVersion *CBC_DataMatrixBitMatrixParser::ReadVersion(CBC_CommonBitMatrix *bitMatrix, int32_t &e)
{
- FX_INT32 rows = bitMatrix->GetHeight();
- FX_INT32 columns = bitMatrix->GetWidth();
+ int32_t rows = bitMatrix->GetHeight();
+ int32_t columns = bitMatrix->GetWidth();
CBC_DataMatrixVersion *temp = CBC_DataMatrixVersion::GetVersionForDimensions(rows, columns, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
}
-CFX_ByteArray *CBC_DataMatrixBitMatrixParser::ReadCodewords(FX_INT32 &e)
+CFX_ByteArray *CBC_DataMatrixBitMatrixParser::ReadCodewords(int32_t &e)
{
CBC_AutoPtr<CFX_ByteArray> result(FX_NEW CFX_ByteArray());
result->SetSize(m_version->GetTotalCodewords());
- FX_INT32 resultOffset = 0;
- FX_INT32 row = 4;
- FX_INT32 column = 0;
- FX_INT32 numRows = m_mappingBitMatrix->GetHeight();
- FX_INT32 numColumns = m_mappingBitMatrix->GetWidth();
+ int32_t resultOffset = 0;
+ int32_t row = 4;
+ int32_t column = 0;
+ int32_t numRows = m_mappingBitMatrix->GetHeight();
+ int32_t numColumns = m_mappingBitMatrix->GetWidth();
FX_BOOL corner1Read = FALSE;
FX_BOOL corner2Read = FALSE;
FX_BOOL corner3Read = FALSE;
FX_BOOL corner4Read = FALSE;
do {
if ((row == numRows) && (column == 0) && !corner1Read) {
- (*result)[resultOffset++] = (FX_BYTE) ReadCorner1(numRows, numColumns);
+ (*result)[resultOffset++] = (uint8_t) ReadCorner1(numRows, numColumns);
row -= 2;
column += 2;
corner1Read = TRUE;
} else if ((row == numRows - 2) && (column == 0) && ((numColumns & 0x03) != 0) && !corner2Read) {
- (*result)[resultOffset++] = (FX_BYTE) ReadCorner2(numRows, numColumns);
+ (*result)[resultOffset++] = (uint8_t) ReadCorner2(numRows, numColumns);
row -= 2;
column += 2;
corner2Read = TRUE;
} else if ((row == numRows + 4) && (column == 2) && ((numColumns & 0x07) == 0) && !corner3Read) {
- (*result)[resultOffset++] = (FX_BYTE) ReadCorner3(numRows, numColumns);
+ (*result)[resultOffset++] = (uint8_t) ReadCorner3(numRows, numColumns);
row -= 2;
column += 2;
corner3Read = TRUE;
} else if ((row == numRows - 2) && (column == 0) && ((numColumns & 0x07) == 4) && !corner4Read) {
- (*result)[resultOffset++] = (FX_BYTE) ReadCorner4(numRows, numColumns);
+ (*result)[resultOffset++] = (uint8_t) ReadCorner4(numRows, numColumns);
row -= 2;
column += 2;
corner4Read = TRUE;
@@ -105,7 +105,7 @@ CFX_ByteArray *CBC_DataMatrixBitMatrixParser::ReadCodewords(FX_INT32 &e) do {
if ((row < numRows) && (column >= 0) && !m_readMappingMatrix->Get(column, row)) {
if (resultOffset < (*result).GetSize() ) {
- (*result)[resultOffset++] = (FX_BYTE) ReadUtah(row, column, numRows, numColumns);
+ (*result)[resultOffset++] = (uint8_t) ReadUtah(row, column, numRows, numColumns);
}
}
row -= 2;
@@ -116,7 +116,7 @@ CFX_ByteArray *CBC_DataMatrixBitMatrixParser::ReadCodewords(FX_INT32 &e) do {
if ((row >= 0) && (column < numColumns) && !m_readMappingMatrix->Get(column, row)) {
if (resultOffset < (*result).GetSize() ) {
- (*result)[resultOffset++] = (FX_BYTE) ReadUtah(row, column, numRows, numColumns);
+ (*result)[resultOffset++] = (uint8_t) ReadUtah(row, column, numRows, numColumns);
}
}
row += 2;
@@ -132,7 +132,7 @@ CFX_ByteArray *CBC_DataMatrixBitMatrixParser::ReadCodewords(FX_INT32 &e) }
return result.release();
}
-FX_BOOL CBC_DataMatrixBitMatrixParser::ReadModule(FX_INT32 row, FX_INT32 column, FX_INT32 numRows, FX_INT32 numColumns)
+FX_BOOL CBC_DataMatrixBitMatrixParser::ReadModule(int32_t row, int32_t column, int32_t numRows, int32_t numColumns)
{
if (row < 0) {
row += numRows;
@@ -145,9 +145,9 @@ FX_BOOL CBC_DataMatrixBitMatrixParser::ReadModule(FX_INT32 row, FX_INT32 column, m_readMappingMatrix->Set(column, row);
return m_mappingBitMatrix->Get(column, row);
}
-FX_INT32 CBC_DataMatrixBitMatrixParser::ReadUtah(FX_INT32 row, FX_INT32 column, FX_INT32 numRows, FX_INT32 numColumns)
+int32_t CBC_DataMatrixBitMatrixParser::ReadUtah(int32_t row, int32_t column, int32_t numRows, int32_t numColumns)
{
- FX_INT32 currentByte = 0;
+ int32_t currentByte = 0;
if (ReadModule(row - 2, column - 2, numRows, numColumns)) {
currentByte |= 1;
}
@@ -181,9 +181,9 @@ FX_INT32 CBC_DataMatrixBitMatrixParser::ReadUtah(FX_INT32 row, FX_INT32 column, }
return currentByte;
}
-FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner1(FX_INT32 numRows, FX_INT32 numColumns)
+int32_t CBC_DataMatrixBitMatrixParser::ReadCorner1(int32_t numRows, int32_t numColumns)
{
- FX_INT32 currentByte = 0;
+ int32_t currentByte = 0;
if (ReadModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1;
}
@@ -217,9 +217,9 @@ FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner1(FX_INT32 numRows, FX_INT32 n }
return currentByte;
}
-FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner2(FX_INT32 numRows, FX_INT32 numColumns)
+int32_t CBC_DataMatrixBitMatrixParser::ReadCorner2(int32_t numRows, int32_t numColumns)
{
- FX_INT32 currentByte = 0;
+ int32_t currentByte = 0;
if (ReadModule(numRows - 3, 0, numRows, numColumns)) {
currentByte |= 1;
}
@@ -253,9 +253,9 @@ FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner2(FX_INT32 numRows, FX_INT32 n }
return currentByte;
}
-FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner3(FX_INT32 numRows, FX_INT32 numColumns)
+int32_t CBC_DataMatrixBitMatrixParser::ReadCorner3(int32_t numRows, int32_t numColumns)
{
- FX_INT32 currentByte = 0;
+ int32_t currentByte = 0;
if (ReadModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1;
}
@@ -289,9 +289,9 @@ FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner3(FX_INT32 numRows, FX_INT32 n }
return currentByte;
}
-FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner4(FX_INT32 numRows, FX_INT32 numColumns)
+int32_t CBC_DataMatrixBitMatrixParser::ReadCorner4(int32_t numRows, int32_t numColumns)
{
- FX_INT32 currentByte = 0;
+ int32_t currentByte = 0;
if (ReadModule(numRows - 3, 0, numRows, numColumns)) {
currentByte |= 1;
}
@@ -325,37 +325,37 @@ FX_INT32 CBC_DataMatrixBitMatrixParser::ReadCorner4(FX_INT32 numRows, FX_INT32 n }
return currentByte;
}
-CBC_CommonBitMatrix *CBC_DataMatrixBitMatrixParser::ExtractDataRegion(CBC_CommonBitMatrix *bitMatrix , FX_INT32 &e)
+CBC_CommonBitMatrix *CBC_DataMatrixBitMatrixParser::ExtractDataRegion(CBC_CommonBitMatrix *bitMatrix , int32_t &e)
{
- FX_INT32 symbolSizeRows = m_version->GetSymbolSizeRows();
- FX_INT32 symbolSizeColumns = m_version->GetSymbolSizeColumns();
+ int32_t symbolSizeRows = m_version->GetSymbolSizeRows();
+ int32_t symbolSizeColumns = m_version->GetSymbolSizeColumns();
if (bitMatrix->GetHeight() != symbolSizeRows) {
e = BCExceptionCanNotCallGetDimensionOnNonSquareMatrix;
return NULL;
}
- FX_INT32 dataRegionSizeRows = m_version->GetDataRegionSizeRows();
- FX_INT32 dataRegionSizeColumns = m_version->GetDataRegionSizeColumns();
- FX_INT32 numDataRegionsRow = symbolSizeRows / dataRegionSizeRows;
- FX_INT32 numDataRegionsColumn = symbolSizeColumns / dataRegionSizeColumns;
- FX_INT32 sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows;
- FX_INT32 sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns;
+ int32_t dataRegionSizeRows = m_version->GetDataRegionSizeRows();
+ int32_t dataRegionSizeColumns = m_version->GetDataRegionSizeColumns();
+ int32_t numDataRegionsRow = symbolSizeRows / dataRegionSizeRows;
+ int32_t numDataRegionsColumn = symbolSizeColumns / dataRegionSizeColumns;
+ int32_t sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows;
+ int32_t sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns;
CBC_CommonBitMatrix *bitMatrixWithoutAlignment = FX_NEW CBC_CommonBitMatrix();
bitMatrixWithoutAlignment->Init(sizeDataRegionColumn, sizeDataRegionRow);
- FX_INT32 dataRegionRow;
+ int32_t dataRegionRow;
for (dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow) {
- FX_INT32 dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;
- FX_INT32 dataRegionColumn;
+ int32_t dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;
+ int32_t dataRegionColumn;
for (dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++dataRegionColumn) {
- FX_INT32 dataRegionColumnOffset = dataRegionColumn * dataRegionSizeColumns;
- FX_INT32 i;
+ int32_t dataRegionColumnOffset = dataRegionColumn * dataRegionSizeColumns;
+ int32_t i;
for (i = 0; i < dataRegionSizeRows; ++i) {
- FX_INT32 readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;
- FX_INT32 writeRowOffset = dataRegionRowOffset + i;
- FX_INT32 j;
+ int32_t readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;
+ int32_t writeRowOffset = dataRegionRowOffset + i;
+ int32_t j;
for (j = 0; j < dataRegionSizeColumns; ++j) {
- FX_INT32 readColumnOffset = dataRegionColumn * (dataRegionSizeColumns + 2) + 1 + j;
+ int32_t readColumnOffset = dataRegionColumn * (dataRegionSizeColumns + 2) + 1 + j;
if (bitMatrix->Get(readColumnOffset, readRowOffset)) {
- FX_INT32 writeColumnOffset = dataRegionColumnOffset + j;
+ int32_t writeColumnOffset = dataRegionColumnOffset + j;
bitMatrixWithoutAlignment->Set(writeColumnOffset, writeRowOffset);
}
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.h index 812aa6424f..da9fdc7db5 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixBitMatrixParser.h @@ -14,17 +14,17 @@ public: CBC_DataMatrixBitMatrixParser();
virtual ~CBC_DataMatrixBitMatrixParser();
CBC_DataMatrixVersion *GetVersion();
- CFX_ByteArray *ReadCodewords(FX_INT32 &e);
- FX_BOOL ReadModule(FX_INT32 row, FX_INT32 column, FX_INT32 numRows, FX_INT32 numColumns);
- FX_INT32 ReadUtah(FX_INT32 row, FX_INT32 column, FX_INT32 numRows, FX_INT32 numColumns);
- FX_INT32 ReadCorner1(FX_INT32 numRows, FX_INT32 numColumns);
- FX_INT32 ReadCorner2(FX_INT32 numRows, FX_INT32 numColumns);
- FX_INT32 ReadCorner3(FX_INT32 numRows, FX_INT32 numColumns);
- FX_INT32 ReadCorner4(FX_INT32 numRows, FX_INT32 numColumns);
- CBC_CommonBitMatrix *ExtractDataRegion(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e);
- virtual void Init(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e);
+ CFX_ByteArray *ReadCodewords(int32_t &e);
+ FX_BOOL ReadModule(int32_t row, int32_t column, int32_t numRows, int32_t numColumns);
+ int32_t ReadUtah(int32_t row, int32_t column, int32_t numRows, int32_t numColumns);
+ int32_t ReadCorner1(int32_t numRows, int32_t numColumns);
+ int32_t ReadCorner2(int32_t numRows, int32_t numColumns);
+ int32_t ReadCorner3(int32_t numRows, int32_t numColumns);
+ int32_t ReadCorner4(int32_t numRows, int32_t numColumns);
+ CBC_CommonBitMatrix *ExtractDataRegion(CBC_CommonBitMatrix *bitMatrix, int32_t &e);
+ virtual void Init(CBC_CommonBitMatrix *bitMatrix, int32_t &e);
private:
- static CBC_DataMatrixVersion* ReadVersion(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e);
+ static CBC_DataMatrixVersion* ReadVersion(CBC_CommonBitMatrix *bitMatrix, int32_t &e);
CBC_CommonBitMatrix *m_mappingBitMatrix;
CBC_CommonBitMatrix *m_readMappingMatrix;
CBC_DataMatrixVersion *m_version;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp index c884834fa9..fcf2804ef2 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp @@ -26,40 +26,40 @@ CBC_DataMatrixDataBlock::~CBC_DataMatrixDataBlock()
{
}
-CBC_DataMatrixDataBlock::CBC_DataMatrixDataBlock(FX_INT32 numDataCodewords, CFX_ByteArray *codewords)
+CBC_DataMatrixDataBlock::CBC_DataMatrixDataBlock(int32_t numDataCodewords, CFX_ByteArray *codewords)
{
m_codewords.Copy(*codewords);
m_numDataCodewords = numDataCodewords;
}
-CFX_PtrArray *CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_DataMatrixVersion *version, FX_INT32 &e)
+CFX_PtrArray *CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_DataMatrixVersion *version, int32_t &e)
{
ECBlocks *ecBlocks = version->GetECBlocks();
- FX_INT32 totalBlocks = 0;
+ int32_t totalBlocks = 0;
const CFX_PtrArray &ecBlockArray = ecBlocks->GetECBlocks();
- FX_INT32 i;
+ int32_t i;
for (i = 0; i < ecBlockArray.GetSize(); i++) {
totalBlocks += ((ECB*)ecBlockArray[i])->GetCount();
}
CBC_AutoPtr<CFX_PtrArray>result(FX_NEW CFX_PtrArray());
result->SetSize(totalBlocks);
- FX_INT32 numResultBlocks = 0;
- FX_INT32 j;
+ int32_t numResultBlocks = 0;
+ int32_t j;
for (j = 0; j < ecBlockArray.GetSize(); j++) {
for (i = 0; i < ((ECB*)ecBlockArray[j])->GetCount(); i++) {
- FX_INT32 numDataCodewords = ((ECB*)ecBlockArray[j])->GetDataCodewords();
- FX_INT32 numBlockCodewords = ecBlocks->GetECCodewords() + numDataCodewords;
+ int32_t numDataCodewords = ((ECB*)ecBlockArray[j])->GetDataCodewords();
+ int32_t numBlockCodewords = ecBlocks->GetECCodewords() + numDataCodewords;
CFX_ByteArray codewords;
codewords.SetSize(numBlockCodewords);
(*result)[numResultBlocks++] = FX_NEW CBC_DataMatrixDataBlock(numDataCodewords, &codewords);
codewords.SetSize(0);
}
}
- FX_INT32 longerBlocksTotalCodewords = ((CBC_DataMatrixDataBlock*)(*result)[0])->GetCodewords()->GetSize();
- FX_INT32 longerBlocksNumDataCodewords = longerBlocksTotalCodewords - ecBlocks->GetECCodewords();
- FX_INT32 shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;
- FX_INT32 rawCodewordsOffset = 0;
+ int32_t longerBlocksTotalCodewords = ((CBC_DataMatrixDataBlock*)(*result)[0])->GetCodewords()->GetSize();
+ int32_t longerBlocksNumDataCodewords = longerBlocksTotalCodewords - ecBlocks->GetECCodewords();
+ int32_t shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;
+ int32_t rawCodewordsOffset = 0;
for (i = 0; i < shorterBlocksNumDataCodewords; i++) {
- FX_INT32 j;
+ int32_t j;
for (j = 0; j < numResultBlocks; j++) {
if (rawCodewordsOffset < rawCodewords->GetSize()) {
((CBC_DataMatrixDataBlock*)(*result)[j])->GetCodewords()->operator [](i) = (*rawCodewords)[rawCodewordsOffset++];
@@ -67,17 +67,17 @@ CFX_PtrArray *CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords }
}
FX_BOOL specialVersion = version->GetVersionNumber() == 24;
- FX_INT32 numLongerBlocks = specialVersion ? 8 : numResultBlocks;
+ int32_t numLongerBlocks = specialVersion ? 8 : numResultBlocks;
for (j = 0; j < numLongerBlocks; j++) {
if (rawCodewordsOffset < rawCodewords->GetSize()) {
((CBC_DataMatrixDataBlock*)(*result)[j])->GetCodewords()->operator [](longerBlocksNumDataCodewords - 1) = (*rawCodewords)[rawCodewordsOffset++];
}
}
- FX_INT32 max = ((CBC_DataMatrixDataBlock*)(*result)[0])->GetCodewords()->GetSize();
+ int32_t max = ((CBC_DataMatrixDataBlock*)(*result)[0])->GetCodewords()->GetSize();
for (i = longerBlocksNumDataCodewords; i < max; i++) {
- FX_INT32 j;
+ int32_t j;
for (j = 0; j < numResultBlocks; j++) {
- FX_INT32 iOffset = specialVersion && j > 7 ? i - 1 : i;
+ int32_t iOffset = specialVersion && j > 7 ? i - 1 : i;
if (rawCodewordsOffset < rawCodewords->GetSize()) {
((CBC_DataMatrixDataBlock*)(*result)[j])->GetCodewords()->operator [](iOffset) = (*rawCodewords)[rawCodewordsOffset++];
}
@@ -89,7 +89,7 @@ CFX_PtrArray *CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords }
return result.release();
}
-FX_INT32 CBC_DataMatrixDataBlock::GetNumDataCodewords()
+int32_t CBC_DataMatrixDataBlock::GetNumDataCodewords()
{
return m_numDataCodewords;
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.h index d0f4af036e..21be66549c 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.h @@ -12,14 +12,14 @@ class CBC_DataMatrixDataBlock public:
virtual ~CBC_DataMatrixDataBlock();
- FX_INT32 GetNumDataCodewords();
+ int32_t GetNumDataCodewords();
CFX_ByteArray* GetCodewords();
- static CFX_PtrArray *GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_DataMatrixVersion *version, FX_INT32 &e);
+ static CFX_PtrArray *GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_DataMatrixVersion *version, int32_t &e);
private:
- FX_INT32 m_numDataCodewords;
+ int32_t m_numDataCodewords;
CFX_ByteArray m_codewords;
- CBC_DataMatrixDataBlock(FX_INT32 numDataCodewords, CFX_ByteArray *codewords);
+ CBC_DataMatrixDataBlock(int32_t numDataCodewords, CFX_ByteArray *codewords);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp index e934d9313d..07393c0fec 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.cpp @@ -42,26 +42,26 @@ const FX_CHAR CBC_DataMatrixDecodedBitStreamParser::TEXT_SHIFT3_SET_CHARS[] = { '\'', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', (FX_CHAR) 127
};
-const FX_INT32 CBC_DataMatrixDecodedBitStreamParser::PAD_ENCODE = 0;
-const FX_INT32 CBC_DataMatrixDecodedBitStreamParser::ASCII_ENCODE = 1;
-const FX_INT32 CBC_DataMatrixDecodedBitStreamParser::C40_ENCODE = 2;
-const FX_INT32 CBC_DataMatrixDecodedBitStreamParser::TEXT_ENCODE = 3;
-const FX_INT32 CBC_DataMatrixDecodedBitStreamParser::ANSIX12_ENCODE = 4;
-const FX_INT32 CBC_DataMatrixDecodedBitStreamParser::EDIFACT_ENCODE = 5;
-const FX_INT32 CBC_DataMatrixDecodedBitStreamParser::BASE256_ENCODE = 6;
+const int32_t CBC_DataMatrixDecodedBitStreamParser::PAD_ENCODE = 0;
+const int32_t CBC_DataMatrixDecodedBitStreamParser::ASCII_ENCODE = 1;
+const int32_t CBC_DataMatrixDecodedBitStreamParser::C40_ENCODE = 2;
+const int32_t CBC_DataMatrixDecodedBitStreamParser::TEXT_ENCODE = 3;
+const int32_t CBC_DataMatrixDecodedBitStreamParser::ANSIX12_ENCODE = 4;
+const int32_t CBC_DataMatrixDecodedBitStreamParser::EDIFACT_ENCODE = 5;
+const int32_t CBC_DataMatrixDecodedBitStreamParser::BASE256_ENCODE = 6;
CBC_DataMatrixDecodedBitStreamParser::CBC_DataMatrixDecodedBitStreamParser()
{
}
CBC_DataMatrixDecodedBitStreamParser::~CBC_DataMatrixDecodedBitStreamParser()
{
}
-CBC_CommonDecoderResult *CBC_DataMatrixDecodedBitStreamParser::Decode(CFX_ByteArray &bytes, FX_INT32 &e)
+CBC_CommonDecoderResult *CBC_DataMatrixDecodedBitStreamParser::Decode(CFX_ByteArray &bytes, int32_t &e)
{
CBC_CommonBitSource bits(&bytes);
CFX_ByteString result;
CFX_ByteString resultTrailer;
CFX_Int32Array byteSegments;
- FX_INT32 mode = ASCII_ENCODE;
+ int32_t mode = ASCII_ENCODE;
do {
if (mode == 1) {
mode = DecodeAsciiSegment(&bits, result, resultTrailer, e);
@@ -104,12 +104,12 @@ CBC_CommonDecoderResult *CBC_DataMatrixDecodedBitStreamParser::Decode(CFX_ByteAr BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return tempCp;
}
-FX_INT32 CBC_DataMatrixDecodedBitStreamParser::DecodeAsciiSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, CFX_ByteString &resultTrailer, FX_INT32 &e)
+int32_t CBC_DataMatrixDecodedBitStreamParser::DecodeAsciiSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, CFX_ByteString &resultTrailer, int32_t &e)
{
FX_CHAR buffer[128];
FX_BOOL upperShift = FALSE;
do {
- FX_INT32 oneByte = bits->ReadBits(8, e);
+ int32_t oneByte = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
if (oneByte == 0) {
e = BCExceptionFormatException;
@@ -122,7 +122,7 @@ FX_INT32 CBC_DataMatrixDecodedBitStreamParser::DecodeAsciiSegment(CBC_CommonBitS } else if (oneByte == 129) {
return PAD_ENCODE;
} else if (oneByte <= 229) {
- FX_INT32 value = oneByte - 130;
+ int32_t value = oneByte - 130;
#if defined(_FX_WINAPI_PARTITION_APP_)
memset(buffer, 0, sizeof(FX_CHAR) * 128);
_itoa_s(value, buffer, 128, 10);
@@ -174,7 +174,7 @@ FX_INT32 CBC_DataMatrixDecodedBitStreamParser::DecodeAsciiSegment(CBC_CommonBitS } while (bits->Available() > 0);
return ASCII_ENCODE;
}
-void CBC_DataMatrixDecodedBitStreamParser::DecodeC40Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, FX_INT32 &e)
+void CBC_DataMatrixDecodedBitStreamParser::DecodeC40Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, int32_t &e)
{
FX_BOOL upperShift = FALSE;
CFX_Int32Array cValues;
@@ -183,18 +183,18 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeC40Segment(CBC_CommonBitSource if (bits->Available() == 8) {
return;
}
- FX_INT32 firstByte = bits->ReadBits(8, e);
+ int32_t firstByte = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if (firstByte == 254) {
return;
}
- FX_INT32 tempp = bits->ReadBits(8, e);
+ int32_t tempp = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
ParseTwoBytes(firstByte, tempp, cValues);
- FX_INT32 shift = 0;
- FX_INT32 i;
+ int32_t shift = 0;
+ int32_t i;
for (i = 0; i < 3; i++) {
- FX_INT32 cValue = cValues[i];
+ int32_t cValue = cValues[i];
switch (shift) {
case 0:
if (cValue < 3) {
@@ -258,26 +258,26 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeC40Segment(CBC_CommonBitSource }
} while (bits->Available() > 0);
}
-void CBC_DataMatrixDecodedBitStreamParser::DecodeTextSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, FX_INT32 &e)
+void CBC_DataMatrixDecodedBitStreamParser::DecodeTextSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, int32_t &e)
{
FX_BOOL upperShift = FALSE;
CFX_Int32Array cValues;
cValues.SetSize(3);
- FX_INT32 shift = 0;
+ int32_t shift = 0;
do {
if (bits->Available() == 8) {
return;
}
- FX_INT32 firstByte = bits->ReadBits(8, e);
+ int32_t firstByte = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if (firstByte == 254) {
return;
}
- FX_INT32 inTp = bits->ReadBits(8, e);
+ int32_t inTp = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
ParseTwoBytes(firstByte, inTp, cValues);
- for (FX_INT32 i = 0; i < 3; i++) {
- FX_INT32 cValue = cValues[i];
+ for (int32_t i = 0; i < 3; i++) {
+ int32_t cValue = cValues[i];
switch (shift) {
case 0:
if (cValue < 3) {
@@ -347,7 +347,7 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeTextSegment(CBC_CommonBitSource }
} while (bits->Available() > 0);
}
-void CBC_DataMatrixDecodedBitStreamParser::DecodeAnsiX12Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, FX_INT32 &e)
+void CBC_DataMatrixDecodedBitStreamParser::DecodeAnsiX12Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, int32_t &e)
{
CFX_Int32Array cValues;
cValues.SetSize(3);
@@ -355,17 +355,17 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeAnsiX12Segment(CBC_CommonBitSou if (bits->Available() == 8) {
return;
}
- FX_INT32 firstByte = bits->ReadBits(8, e);
+ int32_t firstByte = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if (firstByte == 254) {
return;
}
- FX_INT32 iTemp1 = bits->ReadBits(8, e);
+ int32_t iTemp1 = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
ParseTwoBytes(firstByte, iTemp1, cValues);
- FX_INT32 i;
+ int32_t i;
for (i = 0; i < 3; i++) {
- FX_INT32 cValue = cValues[i];
+ int32_t cValue = cValues[i];
if (cValue == 0) {
BC_FX_ByteString_Append(result, 1, '\r');
} else if (cValue == 1) {
@@ -385,17 +385,17 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeAnsiX12Segment(CBC_CommonBitSou }
} while (bits->Available() > 0);
}
-void CBC_DataMatrixDecodedBitStreamParser::ParseTwoBytes(FX_INT32 firstByte, FX_INT32 secondByte, CFX_Int32Array &result)
+void CBC_DataMatrixDecodedBitStreamParser::ParseTwoBytes(int32_t firstByte, int32_t secondByte, CFX_Int32Array &result)
{
- FX_INT32 fullBitValue = (firstByte << 8) + secondByte - 1;
- FX_INT32 temp = fullBitValue / 1600;
+ int32_t fullBitValue = (firstByte << 8) + secondByte - 1;
+ int32_t temp = fullBitValue / 1600;
result[0] = temp;
fullBitValue -= temp * 1600;
temp = fullBitValue / 40;
result[1] = temp;
result[2] = fullBitValue - temp * 40;
}
-void CBC_DataMatrixDecodedBitStreamParser::DecodeEdifactSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, FX_INT32 &e)
+void CBC_DataMatrixDecodedBitStreamParser::DecodeEdifactSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, int32_t &e)
{
FX_CHAR buffer[128];
FX_BOOL unlatch = FALSE;
@@ -403,9 +403,9 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeEdifactSegment(CBC_CommonBitSou if (bits->Available() <= 16) {
return;
}
- FX_INT32 i;
+ int32_t i;
for (i = 0; i < 4; i++) {
- FX_INT32 edifactValue = bits->ReadBits(6, e);
+ int32_t edifactValue = bits->ReadBits(6, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if (edifactValue == 0x1F) {
unlatch = TRUE;
@@ -425,19 +425,19 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeEdifactSegment(CBC_CommonBitSou }
} while (!unlatch && bits->Available() > 0);
}
-void CBC_DataMatrixDecodedBitStreamParser::DecodeBase256Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, CFX_Int32Array &byteSegments, FX_INT32 &e)
+void CBC_DataMatrixDecodedBitStreamParser::DecodeBase256Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, CFX_Int32Array &byteSegments, int32_t &e)
{
- FX_INT32 codewordPosition = 1 + bits->getByteOffset();
- FX_INT32 iTmp = bits->ReadBits(8, e);
+ int32_t codewordPosition = 1 + bits->getByteOffset();
+ int32_t iTmp = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 d1 = Unrandomize255State(iTmp, codewordPosition++);
- FX_INT32 count;
+ int32_t d1 = Unrandomize255State(iTmp, codewordPosition++);
+ int32_t count;
if (d1 == 0) {
count = bits->Available() / 8;
} else if (d1 < 250) {
count = d1;
} else {
- FX_INT32 iTmp3 = bits->ReadBits(8, e);
+ int32_t iTmp3 = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
count = 250 * (d1 - 249) + Unrandomize255State(iTmp3, codewordPosition++);
}
@@ -447,14 +447,14 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeBase256Segment(CBC_CommonBitSou }
CFX_ByteArray *bytes = FX_NEW CFX_ByteArray();
bytes->SetSize(count);
- FX_INT32 i;
+ int32_t i;
for (i = 0; i < count; i++) {
if (bits->Available() < 8) {
e = BCExceptionFormatException;
delete bytes;
return;
}
- FX_INT32 iTemp5 = bits->ReadBits(8, e);
+ int32_t iTemp5 = bits->ReadBits(8, e);
if (e != BCExceptionNO) {
delete bytes;
return;
@@ -464,9 +464,9 @@ void CBC_DataMatrixDecodedBitStreamParser::DecodeBase256Segment(CBC_CommonBitSou BC_FX_ByteString_Append(result, *bytes);
delete bytes;
}
-FX_BYTE CBC_DataMatrixDecodedBitStreamParser::Unrandomize255State(FX_INT32 randomizedBase256Codeword, FX_INT32 base256CodewordPosition)
+uint8_t CBC_DataMatrixDecodedBitStreamParser::Unrandomize255State(int32_t randomizedBase256Codeword, int32_t base256CodewordPosition)
{
- FX_INT32 pseudoRandomNumber = ((149 * base256CodewordPosition) % 255) + 1;
- FX_INT32 tempVariable = randomizedBase256Codeword - pseudoRandomNumber;
- return (FX_BYTE) (tempVariable >= 0 ? tempVariable : tempVariable + 256);
+ int32_t pseudoRandomNumber = ((149 * base256CodewordPosition) % 255) + 1;
+ int32_t tempVariable = randomizedBase256Codeword - pseudoRandomNumber;
+ return (uint8_t) (tempVariable >= 0 ? tempVariable : tempVariable + 256);
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.h index 45db800176..4fa5407fb5 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecodedBitStreamParser.h @@ -13,17 +13,17 @@ class CBC_DataMatrixDecodedBitStreamParser public:
CBC_DataMatrixDecodedBitStreamParser();
virtual ~CBC_DataMatrixDecodedBitStreamParser();
- static CBC_CommonDecoderResult *Decode(CFX_ByteArray &bytes, FX_INT32 &e);
+ static CBC_CommonDecoderResult *Decode(CFX_ByteArray &bytes, int32_t &e);
private:
- static FX_INT32 DecodeAsciiSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, CFX_ByteString &resultTrailer, FX_INT32 &e);
- static void DecodeC40Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, FX_INT32 &e);
- static void DecodeTextSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, FX_INT32 &e);
- static void DecodeAnsiX12Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, FX_INT32 &e);
- static void ParseTwoBytes(FX_INT32 firstByte, FX_INT32 secondByte, CFX_Int32Array &result);
- static void DecodeEdifactSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, FX_INT32 &e);
- static void DecodeBase256Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, CFX_Int32Array &byteSegments, FX_INT32 &e);
- static FX_BYTE Unrandomize255State(FX_INT32 randomizedBase256Codeword, FX_INT32 base256CodewordPosition);
+ static int32_t DecodeAsciiSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, CFX_ByteString &resultTrailer, int32_t &e);
+ static void DecodeC40Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, int32_t &e);
+ static void DecodeTextSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, int32_t &e);
+ static void DecodeAnsiX12Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, int32_t &e);
+ static void ParseTwoBytes(int32_t firstByte, int32_t secondByte, CFX_Int32Array &result);
+ static void DecodeEdifactSegment(CBC_CommonBitSource *bits, CFX_ByteString &result, int32_t &e);
+ static void DecodeBase256Segment(CBC_CommonBitSource *bits, CFX_ByteString &result, CFX_Int32Array &byteSegments, int32_t &e);
+ static uint8_t Unrandomize255State(int32_t randomizedBase256Codeword, int32_t base256CodewordPosition);
const static FX_CHAR C40_BASIC_SET_CHARS[];
const static FX_CHAR C40_SHIFT2_SET_CHARS[];
@@ -31,12 +31,12 @@ private: const static FX_CHAR TEXT_BASIC_SET_CHARS[];
const static FX_CHAR TEXT_SHIFT3_SET_CHARS[];
- const static FX_INT32 PAD_ENCODE;
- const static FX_INT32 ASCII_ENCODE;
- const static FX_INT32 C40_ENCODE;
- const static FX_INT32 TEXT_ENCODE;
- const static FX_INT32 ANSIX12_ENCODE;
- const static FX_INT32 EDIFACT_ENCODE;
- const static FX_INT32 BASE256_ENCODE;
+ const static int32_t PAD_ENCODE;
+ const static int32_t ASCII_ENCODE;
+ const static int32_t C40_ENCODE;
+ const static int32_t TEXT_ENCODE;
+ const static int32_t ANSIX12_ENCODE;
+ const static int32_t EDIFACT_ENCODE;
+ const static int32_t BASE256_ENCODE;
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp index e9eb32cf84..8dfdea81c1 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp @@ -44,7 +44,7 @@ CBC_DataMatrixDecoder::~CBC_DataMatrixDecoder() }
m_rsDecoder = NULL;
}
-CBC_CommonDecoderResult *CBC_DataMatrixDecoder::Decode(CBC_CommonBitMatrix *bits, FX_INT32 &e)
+CBC_CommonDecoderResult *CBC_DataMatrixDecoder::Decode(CBC_CommonBitMatrix *bits, int32_t &e)
{
CBC_DataMatrixBitMatrixParser parser;
parser.Init(bits, e);
@@ -55,9 +55,9 @@ CBC_CommonDecoderResult *CBC_DataMatrixDecoder::Decode(CBC_CommonBitMatrix *bits CBC_AutoPtr<CFX_ByteArray> codewords(byteTemp);
CFX_PtrArray *dataBlocks = CBC_DataMatrixDataBlock::GetDataBlocks(codewords.get(), version, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 dataBlocksCount = dataBlocks->GetSize();
- FX_INT32 totalBytes = 0;
- FX_INT32 i, j;
+ int32_t dataBlocksCount = dataBlocks->GetSize();
+ int32_t totalBytes = 0;
+ int32_t i, j;
for (i = 0; i < dataBlocksCount; i++) {
totalBytes += ((CBC_DataMatrixDataBlock*)(*dataBlocks)[i])->GetNumDataCodewords();
}
@@ -65,17 +65,17 @@ CBC_CommonDecoderResult *CBC_DataMatrixDecoder::Decode(CBC_CommonBitMatrix *bits resultBytes.SetSize(totalBytes);
for (j = 0; j < dataBlocksCount; j++) {
CFX_ByteArray *codewordBytes = ((CBC_DataMatrixDataBlock*)(*dataBlocks)[j])->GetCodewords();
- FX_INT32 numDataCodewords = ((CBC_DataMatrixDataBlock*)(*dataBlocks)[j])->GetNumDataCodewords();
+ int32_t numDataCodewords = ((CBC_DataMatrixDataBlock*)(*dataBlocks)[j])->GetNumDataCodewords();
CorrectErrors(*codewordBytes, numDataCodewords, e);
if (e != BCExceptionNO) {
- for(FX_INT32 i = 0; i < dataBlocks->GetSize(); i++) {
+ for(int32_t i = 0; i < dataBlocks->GetSize(); i++) {
delete (CBC_DataMatrixDataBlock*)(*dataBlocks)[i];
}
delete dataBlocks;
dataBlocks = NULL;
return NULL;
}
- FX_INT32 i;
+ int32_t i;
for (i = 0; i < numDataCodewords; i++) {
resultBytes[i * dataBlocksCount + j] = (*codewordBytes)[i];
}
@@ -89,22 +89,22 @@ CBC_CommonDecoderResult *CBC_DataMatrixDecoder::Decode(CBC_CommonBitMatrix *bits BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return resultR;
}
-void CBC_DataMatrixDecoder::CorrectErrors(CFX_ByteArray &codewordBytes, FX_INT32 numDataCodewords, FX_INT32 &e)
+void CBC_DataMatrixDecoder::CorrectErrors(CFX_ByteArray &codewordBytes, int32_t numDataCodewords, int32_t &e)
{
- FX_INT32 numCodewords = codewordBytes.GetSize();
+ int32_t numCodewords = codewordBytes.GetSize();
CFX_Int32Array codewordsInts;
codewordsInts.SetSize(numCodewords);
- FX_INT32 i;
+ int32_t i;
for (i = 0; i < numCodewords; i++) {
codewordsInts[i] = codewordBytes[i] & 0xFF;
}
- FX_INT32 numECCodewords = codewordBytes.GetSize() - numDataCodewords;
+ int32_t numECCodewords = codewordBytes.GetSize() - numDataCodewords;
m_rsDecoder->Decode(&codewordsInts, numECCodewords, e);
if (e != BCExceptionNO) {
e = BCExceptionChecksumException;
return ;
}
for (i = 0; i < numDataCodewords; i++) {
- codewordBytes[i] = (FX_BYTE) codewordsInts[i];
+ codewordBytes[i] = (uint8_t) codewordsInts[i];
}
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.h index 1d6059379b..d4d2cc7bb9 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDecoder.h @@ -14,10 +14,10 @@ class CBC_DataMatrixDecoder public:
CBC_DataMatrixDecoder();
virtual ~CBC_DataMatrixDecoder();
- CBC_CommonDecoderResult *Decode(CBC_CommonBitMatrix *bits, FX_INT32 &e);
+ CBC_CommonDecoderResult *Decode(CBC_CommonBitMatrix *bits, int32_t &e);
virtual void Init();
private:
- void CorrectErrors(CFX_ByteArray &codewordBytes, FX_INT32 numDataCodewords, FX_INT32 &e);
+ void CorrectErrors(CFX_ByteArray &codewordBytes, int32_t numDataCodewords, int32_t &e);
CBC_ReedSolomonDecoder *m_rsDecoder;
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp index 12877c5c3a..bdcbc4c418 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.cpp @@ -28,12 +28,12 @@ #include "../qrcode/BC_QRDetectorResult.h"
#include "../qrcode/BC_QRGridSampler.h"
#include "BC_DataMatrixDetector.h"
-const FX_INT32 CBC_DataMatrixDetector::INTEGERS[5] = {0, 1, 2, 3, 4};
+const int32_t CBC_DataMatrixDetector::INTEGERS[5] = {0, 1, 2, 3, 4};
CBC_DataMatrixDetector::CBC_DataMatrixDetector(CBC_CommonBitMatrix *image):
m_image(image), m_rectangleDetector(NULL)
{
}
-void CBC_DataMatrixDetector::Init(FX_INT32 &e)
+void CBC_DataMatrixDetector::Init(int32_t &e)
{
m_rectangleDetector = FX_NEW CBC_WhiteRectangleDetector(m_image);
m_rectangleDetector->Init(e);
@@ -50,7 +50,7 @@ inline FX_BOOL ResultPointsAndTransitionsComparator(FX_LPVOID a, FX_LPVOID b) {
return ((CBC_ResultPointsAndTransitions *)b)->GetTransitions() > ((CBC_ResultPointsAndTransitions *)a)->GetTransitions();
}
-CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(FX_INT32 &e)
+CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(int32_t &e)
{
CFX_PtrArray* cornerPoints = m_rectangleDetector->Detect(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -70,7 +70,7 @@ CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(FX_INT32 &e) delete ( (CBC_ResultPointsAndTransitions *)transitions[3] );
CBC_ResultPointsAndTransitions *lSideOne = (CBC_ResultPointsAndTransitions*)transitions[0];
CBC_ResultPointsAndTransitions *lSideTwo = (CBC_ResultPointsAndTransitions*)transitions[1];
- CFX_MapPtrTemplate<CBC_ResultPoint*, FX_INT32> pointCount;
+ CFX_MapPtrTemplate<CBC_ResultPoint*, int32_t> pointCount;
Increment(pointCount, lSideOne->GetFrom());
Increment(pointCount, lSideOne->GetTo());
Increment(pointCount, lSideTwo->GetFrom());
@@ -84,7 +84,7 @@ CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(FX_INT32 &e) FX_POSITION itBegin = pointCount.GetStartPosition();
while(itBegin != NULL) {
CBC_ResultPoint *key = 0;
- FX_INT32 value = 0;
+ int32_t value = 0;
pointCount.GetNextAssoc(itBegin, key, value);
if(value == 2) {
bottomLeft = key;
@@ -114,7 +114,7 @@ CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(FX_INT32 &e) bottomLeft = (CBC_ResultPoint*)corners[1];
CBC_ResultPoint *topLeft = (CBC_ResultPoint*)corners[2];
CBC_ResultPoint *topRight = NULL;
- FX_INT32 value;
+ int32_t value;
if (!pointCount.Lookup(pointA, value)) {
topRight = pointA;
} else if (!pointCount.Lookup(pointB, value)) {
@@ -124,8 +124,8 @@ CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(FX_INT32 &e) } else {
topRight = pointD;
}
- FX_INT32 dimensionTop = CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, topRight))->GetTransitions();
- FX_INT32 dimensionRight = CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(bottomRight, topRight))->GetTransitions();
+ int32_t dimensionTop = CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, topRight))->GetTransitions();
+ int32_t dimensionRight = CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(bottomRight, topRight))->GetTransitions();
if ((dimensionTop & 0x01) == 1) {
dimensionTop++;
}
@@ -158,7 +158,7 @@ CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(FX_INT32 &e) correctedTopRight.get(), dimensionTop, dimensionRight, e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
} else {
- FX_INT32 dimension = FX_MIN(dimensionRight, dimensionTop);
+ int32_t dimension = FX_MIN(dimensionRight, dimensionTop);
correctedTopRight = CBC_AutoPtr<CBC_ResultPoint>(CorrectTopRight(bottomLeft, bottomRight,
topLeft, topRight, dimension));
if (correctedTopRight.get() == NULL) {
@@ -167,7 +167,7 @@ CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(FX_INT32 &e) delete topRight;
topRight = NULL;
}
- FX_INT32 dimensionCorrected = FX_MAX(CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, correctedTopRight.get()))->GetTransitions(),
+ int32_t dimensionCorrected = FX_MAX(CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, correctedTopRight.get()))->GetTransitions(),
CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(bottomRight, correctedTopRight.get()))->GetTransitions());
dimensionCorrected++;
if ((dimensionCorrected & 0x01) == 1) {
@@ -190,10 +190,10 @@ CBC_QRDetectorResult *CBC_DataMatrixDetector::Detect(FX_INT32 &e) result->Add(correctedTopRight.release());
return FX_NEW CBC_QRDetectorResult(bits.release(), result);
}
-CBC_ResultPoint *CBC_DataMatrixDetector::CorrectTopRightRectangular(CBC_ResultPoint *bottomLeft, CBC_ResultPoint *bottomRight, CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, FX_INT32 dimensionTop, FX_INT32 dimensionRight)
+CBC_ResultPoint *CBC_DataMatrixDetector::CorrectTopRightRectangular(CBC_ResultPoint *bottomLeft, CBC_ResultPoint *bottomRight, CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, int32_t dimensionTop, int32_t dimensionRight)
{
FX_FLOAT corr = Distance(bottomLeft, bottomRight) / (FX_FLOAT)dimensionTop;
- FX_INT32 norm = Distance(topLeft, topRight);
+ int32_t norm = Distance(topLeft, topRight);
FX_FLOAT cos = (topRight->GetX() - topLeft->GetX()) / norm;
FX_FLOAT sin = (topRight->GetY() - topLeft->GetY()) / norm;
CBC_AutoPtr<CBC_ResultPoint> c1(FX_NEW CBC_ResultPoint(topRight->GetX() + corr * cos, topRight->GetY() + corr * sin));
@@ -210,19 +210,19 @@ CBC_ResultPoint *CBC_DataMatrixDetector::CorrectTopRightRectangular(CBC_ResultPo } else if (!IsValid(c2.get())) {
return c1.release();
}
- FX_INT32 l1 = FXSYS_abs(dimensionTop - CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, c1.get()))->GetTransitions()) +
+ int32_t l1 = FXSYS_abs(dimensionTop - CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, c1.get()))->GetTransitions()) +
FXSYS_abs(dimensionRight - CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(bottomRight, c1.get()))->GetTransitions());
- FX_INT32 l2 = FXSYS_abs(dimensionTop - CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, c2.get()))->GetTransitions()) +
+ int32_t l2 = FXSYS_abs(dimensionTop - CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, c2.get()))->GetTransitions()) +
FXSYS_abs(dimensionRight - CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(bottomRight, c2.get()))->GetTransitions());
if (l1 <= l2) {
return c1.release();
}
return c2.release();
}
-CBC_ResultPoint *CBC_DataMatrixDetector::CorrectTopRight(CBC_ResultPoint *bottomLeft, CBC_ResultPoint *bottomRight, CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, FX_INT32 dimension)
+CBC_ResultPoint *CBC_DataMatrixDetector::CorrectTopRight(CBC_ResultPoint *bottomLeft, CBC_ResultPoint *bottomRight, CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, int32_t dimension)
{
FX_FLOAT corr = Distance(bottomLeft, bottomRight) / (FX_FLOAT) dimension;
- FX_INT32 norm = Distance(topLeft, topRight);
+ int32_t norm = Distance(topLeft, topRight);
FX_FLOAT cos = (topRight->GetX() - topLeft->GetX()) / norm;
FX_FLOAT sin = (topRight->GetY() - topLeft->GetY()) / norm;
CBC_AutoPtr<CBC_ResultPoint> c1(FX_NEW CBC_ResultPoint(topRight->GetX() + corr * cos, topRight->GetY() + corr * sin));
@@ -239,9 +239,9 @@ CBC_ResultPoint *CBC_DataMatrixDetector::CorrectTopRight(CBC_ResultPoint *bottom } else if (!IsValid(c2.get())) {
return c1.release();
}
- FX_INT32 l1 = FXSYS_abs(CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, c1.get()))->GetTransitions() -
+ int32_t l1 = FXSYS_abs(CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, c1.get()))->GetTransitions() -
CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(bottomRight, c1.get()))->GetTransitions());
- FX_INT32 l2 = FXSYS_abs(CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, c2.get()))->GetTransitions() -
+ int32_t l2 = FXSYS_abs(CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(topLeft, c2.get()))->GetTransitions() -
CBC_AutoPtr<CBC_ResultPointsAndTransitions>(TransitionsBetween(bottomRight, c2.get()))->GetTransitions());
return l1 <= l2 ? c1.release() : c2.release();
}
@@ -249,19 +249,19 @@ FX_BOOL CBC_DataMatrixDetector::IsValid(CBC_ResultPoint *p) {
return p->GetX() >= 0 && p->GetX() < m_image->GetWidth() && p->GetY() > 0 && p->GetY() < m_image->GetHeight();
}
-FX_INT32 CBC_DataMatrixDetector::Round(FX_FLOAT d)
+int32_t CBC_DataMatrixDetector::Round(FX_FLOAT d)
{
- return (FX_INT32) (d + 0.5f);
+ return (int32_t) (d + 0.5f);
}
-FX_INT32 CBC_DataMatrixDetector::Distance(CBC_ResultPoint *a, CBC_ResultPoint *b)
+int32_t CBC_DataMatrixDetector::Distance(CBC_ResultPoint *a, CBC_ResultPoint *b)
{
return Round((FX_FLOAT) sqrt((a->GetX() - b->GetX())
* (a->GetX() - b->GetX()) + (a->GetY() - b->GetY())
* (a->GetY() - b->GetY())));
}
-void CBC_DataMatrixDetector::Increment(CFX_MapPtrTemplate<CBC_ResultPoint*, FX_INT32> &table, CBC_ResultPoint *key)
+void CBC_DataMatrixDetector::Increment(CFX_MapPtrTemplate<CBC_ResultPoint*, int32_t> &table, CBC_ResultPoint *key)
{
- FX_INT32 value;
+ int32_t value;
if(table.Lookup(key, value)) {
table.SetAt(key, INTEGERS[value + 1]);
} else {
@@ -273,7 +273,7 @@ CBC_CommonBitMatrix *CBC_DataMatrixDetector::SampleGrid(CBC_CommonBitMatrix *ima CBC_ResultPoint *bottomLeft,
CBC_ResultPoint *bottomRight,
CBC_ResultPoint *topRight,
- FX_INT32 dimensionX, FX_INT32 dimensionY, FX_INT32 &e)
+ int32_t dimensionX, int32_t dimensionY, int32_t &e)
{
CBC_QRGridSampler &sampler = CBC_QRGridSampler::GetInstance();
CBC_CommonBitMatrix* cbm = sampler.SampleGrid(image,
@@ -300,27 +300,27 @@ CBC_CommonBitMatrix *CBC_DataMatrixDetector::SampleGrid(CBC_CommonBitMatrix *ima }
CBC_ResultPointsAndTransitions *CBC_DataMatrixDetector::TransitionsBetween(CBC_ResultPoint *from, CBC_ResultPoint *to)
{
- FX_INT32 fromX = (FX_INT32) from->GetX();
- FX_INT32 fromY = (FX_INT32) from->GetY();
- FX_INT32 toX = (FX_INT32) to->GetX();
- FX_INT32 toY = (FX_INT32) to->GetY();
+ int32_t fromX = (int32_t) from->GetX();
+ int32_t fromY = (int32_t) from->GetY();
+ int32_t toX = (int32_t) to->GetX();
+ int32_t toY = (int32_t) to->GetY();
FX_BOOL steep = FXSYS_abs(toY - fromY) > FXSYS_abs(toX - fromX);
if (steep) {
- FX_INT32 temp = fromX;
+ int32_t temp = fromX;
fromX = fromY;
fromY = temp;
temp = toX;
toX = toY;
toY = temp;
}
- FX_INT32 dx = FXSYS_abs(toX - fromX);
- FX_INT32 dy = FXSYS_abs(toY - fromY);
- FX_INT32 error = -dx >> 1;
- FX_INT32 ystep = fromY < toY ? 1 : -1;
- FX_INT32 xstep = fromX < toX ? 1 : -1;
- FX_INT32 transitions = 0;
+ int32_t dx = FXSYS_abs(toX - fromX);
+ int32_t dy = FXSYS_abs(toY - fromY);
+ int32_t error = -dx >> 1;
+ int32_t ystep = fromY < toY ? 1 : -1;
+ int32_t xstep = fromX < toX ? 1 : -1;
+ int32_t transitions = 0;
FX_BOOL inBlack = m_image->Get(steep ? fromY : fromX, steep ? fromX : fromY);
- for (FX_INT32 x = fromX, y = fromY; x != toX; x += xstep) {
+ for (int32_t x = fromX, y = fromY; x != toX; x += xstep) {
FX_BOOL isBlack = m_image->Get(steep ? y : x, steep ? x : y);
if (isBlack != inBlack) {
transitions++;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.h index a9e244c5f4..e36ef678cd 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDetector.h @@ -15,7 +15,7 @@ class ResultPointsAndTransitions; class CBC_ResultPointsAndTransitions
{
public:
- CBC_ResultPointsAndTransitions(CBC_ResultPoint *from, CBC_ResultPoint *to, FX_INT32 transitions)
+ CBC_ResultPointsAndTransitions(CBC_ResultPoint *from, CBC_ResultPoint *to, int32_t transitions)
{
m_from = from;
m_to = to;
@@ -32,47 +32,47 @@ public: {
return m_to;
}
- FX_INT32 GetTransitions()
+ int32_t GetTransitions()
{
return m_transitions;
}
private:
CBC_ResultPoint *m_from;
CBC_ResultPoint *m_to;
- FX_INT32 m_transitions;
+ int32_t m_transitions;
};
class CBC_DataMatrixDetector
{
public:
CBC_DataMatrixDetector(CBC_CommonBitMatrix *image);
virtual ~CBC_DataMatrixDetector();
- CBC_QRDetectorResult *Detect(FX_INT32 &e);
+ CBC_QRDetectorResult *Detect(int32_t &e);
CBC_ResultPoint *CorrectTopRightRectangular(CBC_ResultPoint *bottomLeft,
CBC_ResultPoint *bottomRight,
CBC_ResultPoint *topLeft,
CBC_ResultPoint *topRight,
- FX_INT32 dimensionTop, FX_INT32 dimensionRight);
+ int32_t dimensionTop, int32_t dimensionRight);
CBC_ResultPoint *CorrectTopRight(CBC_ResultPoint *bottomLeft,
CBC_ResultPoint *bottomRight,
CBC_ResultPoint *topLeft,
CBC_ResultPoint *topRight,
- FX_INT32 dimension);
+ int32_t dimension);
CBC_CommonBitMatrix *SampleGrid(CBC_CommonBitMatrix *image,
CBC_ResultPoint *topLeft,
CBC_ResultPoint *bottomLeft,
CBC_ResultPoint *bottomRight,
CBC_ResultPoint *topRight,
- FX_INT32 dimensionX, FX_INT32 dimensionY, FX_INT32 &e);
+ int32_t dimensionX, int32_t dimensionY, int32_t &e);
CBC_ResultPointsAndTransitions *TransitionsBetween(CBC_ResultPoint *from, CBC_ResultPoint *to);
FX_BOOL IsValid(CBC_ResultPoint *p);
- FX_INT32 Distance(CBC_ResultPoint *a, CBC_ResultPoint *b);
- void Increment(CFX_MapPtrTemplate<CBC_ResultPoint*, FX_INT32> &table, CBC_ResultPoint *key);
- FX_INT32 Round(FX_FLOAT d);
+ int32_t Distance(CBC_ResultPoint *a, CBC_ResultPoint *b);
+ void Increment(CFX_MapPtrTemplate<CBC_ResultPoint*, int32_t> &table, CBC_ResultPoint *key);
+ int32_t Round(FX_FLOAT d);
void OrderBestPatterns(CFX_PtrArray *patterns);
- virtual void Init(FX_INT32 &e);
+ virtual void Init(int32_t &e);
private:
CBC_CommonBitMatrix *m_image;
CBC_WhiteRectangleDetector *m_rectangleDetector;
- const static FX_INT32 INTEGERS[5];
+ const static int32_t INTEGERS[5];
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp index cf076cd313..1b9f55dc9f 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.cpp @@ -44,7 +44,7 @@ CBC_DataMatrixReader::~CBC_DataMatrixReader() }
m_decoder = NULL;
}
-CFX_ByteString CBC_DataMatrixReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_DataMatrixReader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
CBC_CommonBitMatrix *cdr = image->GetBlackMatrix(e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -59,7 +59,7 @@ CFX_ByteString CBC_DataMatrixReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hi CBC_AutoPtr<CBC_CommonDecoderResult> decodeResult(ResultTemp);
return decodeResult->GetText();
}
-CFX_ByteString CBC_DataMatrixReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e)
+CFX_ByteString CBC_DataMatrixReader::Decode(CBC_BinaryBitmap *image, int32_t &e)
{
CFX_ByteString bs = Decode(image, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.h index 4301512d70..6ba17a89e3 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixReader.h @@ -15,8 +15,8 @@ class CBC_DataMatrixReader : public CBC_Reader public:
CBC_DataMatrixReader();
virtual ~CBC_DataMatrixReader();
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e);
- CFX_ByteString Decode(CBC_BinaryBitmap *image, int hints, FX_INT32 &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int hints, int32_t &e);
virtual void Init();
private:
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp index 256117883d..dfe0e11f1c 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.cpp @@ -33,11 +33,11 @@ CBC_DataMatrixSymbolInfo144::CBC_DataMatrixSymbolInfo144() : CBC_SymbolInfo(FALS CBC_DataMatrixSymbolInfo144::~CBC_DataMatrixSymbolInfo144()
{
}
-FX_INT32 CBC_DataMatrixSymbolInfo144::getInterleavedBlockCount()
+int32_t CBC_DataMatrixSymbolInfo144::getInterleavedBlockCount()
{
return 10;
}
-FX_INT32 CBC_DataMatrixSymbolInfo144getDataLengthForInterleavedBlock(FX_INT32 index)
+int32_t CBC_DataMatrixSymbolInfo144getDataLengthForInterleavedBlock(int32_t index)
{
return (index <= 8) ? 156 : 155;
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h index e749b27d86..2c13551145 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixSymbolInfo144.h @@ -13,7 +13,7 @@ class CBC_DataMatrixSymbolInfo144 : public CBC_SymbolInfo public:
CBC_DataMatrixSymbolInfo144();
virtual ~CBC_DataMatrixSymbolInfo144();
- FX_INT32 getInterleavedBlockCount();
- FX_INT32 getDataLengthForInterleavedBlock(FX_INT32 index);
+ int32_t getInterleavedBlockCount();
+ int32_t getDataLengthForInterleavedBlock(int32_t index);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp index 1a4e59864e..bbbf4bdee5 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.cpp @@ -29,17 +29,17 @@ void CBC_DataMatrixVersion::Initialize() }
void CBC_DataMatrixVersion::Finalize()
{
- for (FX_INT32 i = 0; i < VERSIONS->GetSize(); i++) {
+ for (int32_t i = 0; i < VERSIONS->GetSize(); i++) {
delete ( (CBC_DataMatrixVersion*)(VERSIONS->GetAt(i)) );
}
VERSIONS->RemoveAll();
delete VERSIONS;
}
-CBC_DataMatrixVersion::CBC_DataMatrixVersion(FX_INT32 versionNumber,
- FX_INT32 symbolSizeRows,
- FX_INT32 symbolSizeColumns,
- FX_INT32 dataRegionSizeRows,
- FX_INT32 dataRegionSizeColumns,
+CBC_DataMatrixVersion::CBC_DataMatrixVersion(int32_t versionNumber,
+ int32_t symbolSizeRows,
+ int32_t symbolSizeColumns,
+ int32_t dataRegionSizeRows,
+ int32_t dataRegionSizeColumns,
ECBlocks *ecBlocks)
{
m_versionNumber = versionNumber;
@@ -48,10 +48,10 @@ CBC_DataMatrixVersion::CBC_DataMatrixVersion(FX_INT32 versionNumber, m_dataRegionSizeRows = dataRegionSizeRows;
m_dataRegionSizeColumns = dataRegionSizeColumns;
m_ecBlocks = ecBlocks;
- FX_INT32 total = 0;
- FX_INT32 ecCodewords = ecBlocks->GetECCodewords();
+ int32_t total = 0;
+ int32_t ecCodewords = ecBlocks->GetECCodewords();
const CFX_PtrArray &ecbArray = ecBlocks->GetECBlocks();
- for (FX_INT32 i = 0; i < ecbArray.GetSize(); i++) {
+ for (int32_t i = 0; i < ecbArray.GetSize(); i++) {
total += ((ECB*)ecbArray[i])->GetCount() * (((ECB*)ecbArray[i])->GetDataCodewords() + ecCodewords);
}
m_totalCodewords = total;
@@ -63,27 +63,27 @@ CBC_DataMatrixVersion::~CBC_DataMatrixVersion() }
m_ecBlocks = NULL;
}
-FX_INT32 CBC_DataMatrixVersion::GetVersionNumber()
+int32_t CBC_DataMatrixVersion::GetVersionNumber()
{
return m_versionNumber;
}
-FX_INT32 CBC_DataMatrixVersion::GetSymbolSizeRows()
+int32_t CBC_DataMatrixVersion::GetSymbolSizeRows()
{
return m_symbolSizeRows;
}
-FX_INT32 CBC_DataMatrixVersion::GetSymbolSizeColumns()
+int32_t CBC_DataMatrixVersion::GetSymbolSizeColumns()
{
return m_symbolSizeColumns;
}
-FX_INT32 CBC_DataMatrixVersion::GetDataRegionSizeRows()
+int32_t CBC_DataMatrixVersion::GetDataRegionSizeRows()
{
return m_dataRegionSizeRows;
}
-FX_INT32 CBC_DataMatrixVersion::GetDataRegionSizeColumns()
+int32_t CBC_DataMatrixVersion::GetDataRegionSizeColumns()
{
return m_dataRegionSizeColumns;
}
-FX_INT32 CBC_DataMatrixVersion::GetTotalCodewords()
+int32_t CBC_DataMatrixVersion::GetTotalCodewords()
{
return m_totalCodewords;
}
@@ -93,12 +93,12 @@ ECBlocks *CBC_DataMatrixVersion::GetECBlocks() }
void CBC_DataMatrixVersion::ReleaseAll()
{
- for (FX_INT32 i = 0; i < VERSIONS->GetSize(); i++) {
+ for (int32_t i = 0; i < VERSIONS->GetSize(); i++) {
delete (CBC_DataMatrixVersion*)VERSIONS->GetAt(i);
}
VERSIONS->RemoveAll();
}
-CBC_DataMatrixVersion *CBC_DataMatrixVersion::GetVersionForDimensions(FX_INT32 numRows, FX_INT32 numColumns, FX_INT32 &e)
+CBC_DataMatrixVersion *CBC_DataMatrixVersion::GetVersionForDimensions(int32_t numRows, int32_t numColumns, int32_t &e)
{
if ((numRows & 0x01) != 0 || (numColumns & 0x01) != 0) {
e = BCExceptionNotFound;
@@ -136,8 +136,8 @@ CBC_DataMatrixVersion *CBC_DataMatrixVersion::GetVersionForDimensions(FX_INT32 n VERSIONS->Add(FX_NEW CBC_DataMatrixVersion(29, 16, 36, 14, 16, FX_NEW ECBlocks(24, FX_NEW ECB(1, 32))));
VERSIONS->Add(FX_NEW CBC_DataMatrixVersion(30, 16, 48, 14, 22, FX_NEW ECBlocks(28, FX_NEW ECB(1, 49))));
}
- FX_INT32 numVersions = VERSIONS->GetSize();
- for (FX_INT32 i = 0; i < numVersions; ++i) {
+ int32_t numVersions = VERSIONS->GetSize();
+ for (int32_t i = 0; i < numVersions; ++i) {
if (((CBC_DataMatrixVersion*)((*VERSIONS)[i]))->m_symbolSizeRows == numRows && ((CBC_DataMatrixVersion*)((*VERSIONS)[i]))->m_symbolSizeColumns == numColumns) {
return (CBC_DataMatrixVersion*)(*VERSIONS)[i];
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h index 9661834bd8..90f6509f0f 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h @@ -11,35 +11,35 @@ class CBC_DataMatrixVersion; class ECB
{
public:
- ECB(FX_INT32 count, FX_INT32 dataCodewords)
+ ECB(int32_t count, int32_t dataCodewords)
{
m_count = count;
m_dataCodewords = dataCodewords;
}
- FX_INT32 GetCount()
+ int32_t GetCount()
{
return m_count;
}
- FX_INT32 GetDataCodewords()
+ int32_t GetDataCodewords()
{
return m_dataCodewords;
}
private:
- FX_INT32 m_count;
- FX_INT32 m_dataCodewords;
+ int32_t m_count;
+ int32_t m_dataCodewords;
};
class ECBlocks
{
public:
- ECBlocks(FX_INT32 ecCodewords, ECB *ecBlocks)
+ ECBlocks(int32_t ecCodewords, ECB *ecBlocks)
{
m_ecCodewords = ecCodewords;
m_ecBlocks.Add(ecBlocks);
}
- ECBlocks(FX_INT32 ecCodewords, ECB *ecBlocks1, ECB *ecBlocks2)
+ ECBlocks(int32_t ecCodewords, ECB *ecBlocks1, ECB *ecBlocks2)
{
m_ecCodewords = ecCodewords;
m_ecBlocks.Add(ecBlocks1);
@@ -47,13 +47,13 @@ public: }
~ECBlocks()
{
- for(FX_INT32 i = 0; i < m_ecBlocks.GetSize(); i++) {
+ for(int32_t i = 0; i < m_ecBlocks.GetSize(); i++) {
delete (ECB*)m_ecBlocks[i];
}
m_ecBlocks.RemoveAll();
}
- FX_INT32 GetECCodewords()
+ int32_t GetECCodewords()
{
return m_ecCodewords;
}
@@ -63,38 +63,38 @@ public: return m_ecBlocks;
}
private:
- FX_INT32 m_ecCodewords;
+ int32_t m_ecCodewords;
CFX_PtrArray m_ecBlocks;
};
class CBC_DataMatrixVersion
{
public:
- CBC_DataMatrixVersion(FX_INT32 versionNumber,
- FX_INT32 symbolSizeRows,
- FX_INT32 symbolSizeColumns,
- FX_INT32 dataRegionSizeRows,
- FX_INT32 dataRegionSizeColumns,
+ CBC_DataMatrixVersion(int32_t versionNumber,
+ int32_t symbolSizeRows,
+ int32_t symbolSizeColumns,
+ int32_t dataRegionSizeRows,
+ int32_t dataRegionSizeColumns,
ECBlocks *ecBlocks);
virtual ~CBC_DataMatrixVersion();
static void Initialize();
static void Finalize();
- FX_INT32 GetVersionNumber();
- FX_INT32 GetSymbolSizeRows();
- FX_INT32 GetSymbolSizeColumns();
- FX_INT32 GetDataRegionSizeRows();
- FX_INT32 GetDataRegionSizeColumns();
- FX_INT32 GetTotalCodewords();
+ int32_t GetVersionNumber();
+ int32_t GetSymbolSizeRows();
+ int32_t GetSymbolSizeColumns();
+ int32_t GetDataRegionSizeRows();
+ int32_t GetDataRegionSizeColumns();
+ int32_t GetTotalCodewords();
ECBlocks *GetECBlocks();
- static CBC_DataMatrixVersion *GetVersionForDimensions(FX_INT32 numRows, FX_INT32 numColumns, FX_INT32 &e);
+ static CBC_DataMatrixVersion *GetVersionForDimensions(int32_t numRows, int32_t numColumns, int32_t &e);
static void ReleaseAll();
private:
- FX_INT32 m_versionNumber;
- FX_INT32 m_symbolSizeRows;
- FX_INT32 m_symbolSizeColumns;
- FX_INT32 m_dataRegionSizeRows;
- FX_INT32 m_dataRegionSizeColumns;
+ int32_t m_versionNumber;
+ int32_t m_symbolSizeRows;
+ int32_t m_symbolSizeColumns;
+ int32_t m_dataRegionSizeRows;
+ int32_t m_dataRegionSizeColumns;
ECBlocks *m_ecBlocks;
- FX_INT32 m_totalCodewords;
+ int32_t m_totalCodewords;
static CFX_PtrArray* VERSIONS;
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp index 652758a635..4bccdd0bf8 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixWriter.cpp @@ -49,12 +49,12 @@ CBC_DataMatrixWriter::CBC_DataMatrixWriter() CBC_DataMatrixWriter::~CBC_DataMatrixWriter()
{
}
-FX_BOOL CBC_DataMatrixWriter::SetErrorCorrectionLevel (FX_INT32 level)
+FX_BOOL CBC_DataMatrixWriter::SetErrorCorrectionLevel (int32_t level)
{
m_iCorrectLevel = level;
return TRUE;
}
-FX_BYTE* CBC_DataMatrixWriter::Encode(const CFX_WideString &contents, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t* CBC_DataMatrixWriter::Encode(const CFX_WideString &contents, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
if (outWidth < 0 || outHeight < 0) {
e = BCExceptionHeightAndWidthMustBeAtLeast1;
@@ -77,42 +77,42 @@ FX_BYTE* CBC_DataMatrixWriter::Encode(const CFX_WideString &contents, FX_INT32 & BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
outWidth = bytematrix->GetWidth();
outHeight = bytematrix->GetHeight();
- FX_BYTE* result = FX_Alloc(FX_BYTE, outWidth * outHeight);
+ uint8_t* result = FX_Alloc(uint8_t, outWidth * outHeight);
FXSYS_memcpy32(result, bytematrix->GetArray(), outWidth * outHeight);
delete bytematrix;
delete placement;
return result;
}
-FX_BYTE *CBC_DataMatrixWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_DataMatrixWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
return NULL;
}
-FX_BYTE *CBC_DataMatrixWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_DataMatrixWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
return NULL;
}
-CBC_CommonByteMatrix* CBC_DataMatrixWriter::encodeLowLevel(CBC_DefaultPlacement* placement, CBC_SymbolInfo* symbolInfo, FX_INT32 &e)
+CBC_CommonByteMatrix* CBC_DataMatrixWriter::encodeLowLevel(CBC_DefaultPlacement* placement, CBC_SymbolInfo* symbolInfo, int32_t &e)
{
- FX_INT32 symbolWidth = symbolInfo->getSymbolDataWidth(e);
+ int32_t symbolWidth = symbolInfo->getSymbolDataWidth(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 symbolHeight = symbolInfo->getSymbolDataHeight(e);
+ int32_t symbolHeight = symbolInfo->getSymbolDataHeight(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_CommonByteMatrix* matrix = FX_NEW CBC_CommonByteMatrix(symbolInfo->getSymbolWidth(e), symbolInfo->getSymbolHeight(e));
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
matrix->Init();
- FX_INT32 matrixY = 0;
- for (FX_INT32 y = 0; y < symbolHeight; y++) {
- FX_INT32 matrixX;
+ int32_t matrixY = 0;
+ for (int32_t y = 0; y < symbolHeight; y++) {
+ int32_t matrixX;
if ((y % symbolInfo->m_matrixHeight) == 0) {
matrixX = 0;
- for (FX_INT32 x = 0; x < symbolInfo->getSymbolWidth(e); x++) {
+ for (int32_t x = 0; x < symbolInfo->getSymbolWidth(e); x++) {
matrix->Set(matrixX, matrixY, (x % 2) == 0);
matrixX++;
}
matrixY++;
}
matrixX = 0;
- for (FX_INT32 x = 0; x < symbolWidth; x++) {
+ for (int32_t x = 0; x < symbolWidth; x++) {
if ((x % symbolInfo->m_matrixWidth) == 0) {
matrix->Set(matrixX, matrixY, TRUE);
matrixX++;
@@ -127,7 +127,7 @@ CBC_CommonByteMatrix* CBC_DataMatrixWriter::encodeLowLevel(CBC_DefaultPlacement* matrixY++;
if ((y % symbolInfo->m_matrixHeight) == symbolInfo->m_matrixHeight - 1) {
matrixX = 0;
- for (FX_INT32 x = 0; x < symbolInfo->getSymbolWidth(e); x++) {
+ for (int32_t x = 0; x < symbolInfo->getSymbolWidth(e); x++) {
matrix->Set(matrixX, matrixY, TRUE);
matrixX++;
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixWriter.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixWriter.h index c8a6bdd823..241229b467 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixWriter.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixWriter.h @@ -18,13 +18,13 @@ class CBC_DataMatrixWriter : public CBC_TwoDimWriter public:
CBC_DataMatrixWriter();
virtual ~CBC_DataMatrixWriter();
- FX_BYTE* Encode(const CFX_WideString &contents, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BOOL SetErrorCorrectionLevel (FX_INT32 level);
+ uint8_t* Encode(const CFX_WideString &contents, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ FX_BOOL SetErrorCorrectionLevel (int32_t level);
private:
- static CBC_CommonByteMatrix* encodeLowLevel(CBC_DefaultPlacement* placement, CBC_SymbolInfo* symbolInfo, FX_INT32 &e);
- FX_INT32 m_iCorrectLevel;
+ static CBC_CommonByteMatrix* encodeLowLevel(CBC_DefaultPlacement* placement, CBC_SymbolInfo* symbolInfo, int32_t &e);
+ int32_t m_iCorrectLevel;
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DefaultPlacement.cpp b/xfa/src/fxbarcode/datamatrix/BC_DefaultPlacement.cpp index e6bab5a65e..57c6cc92d2 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DefaultPlacement.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DefaultPlacement.cpp @@ -23,25 +23,25 @@ #include "../barcode.h"
#include "BC_Encoder.h"
#include "BC_DefaultPlacement.h"
-CBC_DefaultPlacement::CBC_DefaultPlacement(CFX_WideString codewords, FX_INT32 numcols, FX_INT32 numrows)
+CBC_DefaultPlacement::CBC_DefaultPlacement(CFX_WideString codewords, int32_t numcols, int32_t numrows)
{
m_codewords = codewords;
m_numcols = numcols;
m_numrows = numrows;
m_bits.SetSize(numcols * numrows);
- for (FX_INT32 i = 0; i < numcols * numrows; i++) {
- m_bits[i] = (FX_BYTE) 2;
+ for (int32_t i = 0; i < numcols * numrows; i++) {
+ m_bits[i] = (uint8_t) 2;
}
}
CBC_DefaultPlacement::~CBC_DefaultPlacement()
{
m_bits.RemoveAll();
}
-FX_INT32 CBC_DefaultPlacement::getNumrows()
+int32_t CBC_DefaultPlacement::getNumrows()
{
return m_numrows;
}
-FX_INT32 CBC_DefaultPlacement::getNumcols()
+int32_t CBC_DefaultPlacement::getNumcols()
{
return m_numcols;
}
@@ -49,23 +49,23 @@ CFX_ByteArray& CBC_DefaultPlacement::getBits() {
return m_bits;
}
-FX_BOOL CBC_DefaultPlacement::getBit(FX_INT32 col, FX_INT32 row)
+FX_BOOL CBC_DefaultPlacement::getBit(int32_t col, int32_t row)
{
return m_bits[row * m_numcols + col] == 1;
}
-void CBC_DefaultPlacement::setBit(FX_INT32 col, FX_INT32 row, FX_BOOL bit)
+void CBC_DefaultPlacement::setBit(int32_t col, int32_t row, FX_BOOL bit)
{
- m_bits[row * m_numcols + col] = bit ? (FX_BYTE) 1 : (FX_BYTE) 0;
+ m_bits[row * m_numcols + col] = bit ? (uint8_t) 1 : (uint8_t) 0;
}
-FX_BOOL CBC_DefaultPlacement::hasBit(FX_INT32 col, FX_INT32 row)
+FX_BOOL CBC_DefaultPlacement::hasBit(int32_t col, int32_t row)
{
return m_bits[row * m_numcols + col] != 2;
}
void CBC_DefaultPlacement::place()
{
- FX_INT32 pos = 0;
- FX_INT32 row = 4;
- FX_INT32 col = 0;
+ int32_t pos = 0;
+ int32_t row = 4;
+ int32_t col = 0;
do {
if ((row == m_numrows) && (col == 0)) {
corner1(pos++);
@@ -103,7 +103,7 @@ void CBC_DefaultPlacement::place() setBit(m_numcols - 2, m_numrows - 2, TRUE);
}
}
-void CBC_DefaultPlacement::module(FX_INT32 row, FX_INT32 col, FX_INT32 pos, FX_INT32 bit)
+void CBC_DefaultPlacement::module(int32_t row, int32_t col, int32_t pos, int32_t bit)
{
if (row < 0) {
row += m_numrows;
@@ -113,11 +113,11 @@ void CBC_DefaultPlacement::module(FX_INT32 row, FX_INT32 col, FX_INT32 pos, FX_I col += m_numcols;
row += 4 - ((m_numcols + 4) % 8);
}
- FX_INT32 v = m_codewords.GetAt(pos);
+ int32_t v = m_codewords.GetAt(pos);
v &= 1 << (8 - bit);
setBit(col, row, v != 0);
}
-void CBC_DefaultPlacement::utah(FX_INT32 row, FX_INT32 col, FX_INT32 pos)
+void CBC_DefaultPlacement::utah(int32_t row, int32_t col, int32_t pos)
{
module(row - 2, col - 2, pos, 1);
module(row - 2, col - 1, pos, 2);
@@ -128,7 +128,7 @@ void CBC_DefaultPlacement::utah(FX_INT32 row, FX_INT32 col, FX_INT32 pos) module(row, col - 1, pos, 7);
module(row, col, pos, 8);
}
-void CBC_DefaultPlacement::corner1(FX_INT32 pos)
+void CBC_DefaultPlacement::corner1(int32_t pos)
{
module(m_numrows - 1, 0, pos, 1);
module(m_numrows - 1, 1, pos, 2);
@@ -139,7 +139,7 @@ void CBC_DefaultPlacement::corner1(FX_INT32 pos) module(2, m_numcols - 1, pos, 7);
module(3, m_numcols - 1, pos, 8);
}
-void CBC_DefaultPlacement::corner2(FX_INT32 pos)
+void CBC_DefaultPlacement::corner2(int32_t pos)
{
module(m_numrows - 3, 0, pos, 1);
module(m_numrows - 2, 0, pos, 2);
@@ -150,7 +150,7 @@ void CBC_DefaultPlacement::corner2(FX_INT32 pos) module(0, m_numcols - 1, pos, 7);
module(1, m_numcols - 1, pos, 8);
}
-void CBC_DefaultPlacement::corner3(FX_INT32 pos)
+void CBC_DefaultPlacement::corner3(int32_t pos)
{
module(m_numrows - 3, 0, pos, 1);
module(m_numrows - 2, 0, pos, 2);
@@ -161,7 +161,7 @@ void CBC_DefaultPlacement::corner3(FX_INT32 pos) module(2, m_numcols - 1, pos, 7);
module(3, m_numcols - 1, pos, 8);
}
-void CBC_DefaultPlacement::corner4(FX_INT32 pos)
+void CBC_DefaultPlacement::corner4(int32_t pos)
{
module(m_numrows - 1, 0, pos, 1);
module(m_numrows - 1, m_numcols - 1, pos, 2);
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DefaultPlacement.h b/xfa/src/fxbarcode/datamatrix/BC_DefaultPlacement.h index 2194e9f18a..dec26a6c70 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DefaultPlacement.h +++ b/xfa/src/fxbarcode/datamatrix/BC_DefaultPlacement.h @@ -9,26 +9,26 @@ class CBC_DefaultPlacement
{
public:
- CBC_DefaultPlacement(CFX_WideString codewords, FX_INT32 numcols, FX_INT32 numrows);
+ CBC_DefaultPlacement(CFX_WideString codewords, int32_t numcols, int32_t numrows);
virtual ~CBC_DefaultPlacement();
- FX_INT32 getNumrows();
- FX_INT32 getNumcols();
+ int32_t getNumrows();
+ int32_t getNumcols();
CFX_ByteArray& getBits();
- FX_BOOL getBit(FX_INT32 col, FX_INT32 row);
- void setBit(FX_INT32 col, FX_INT32 row, FX_BOOL bit);
- FX_BOOL hasBit(FX_INT32 col, FX_INT32 row);
+ FX_BOOL getBit(int32_t col, int32_t row);
+ void setBit(int32_t col, int32_t row, FX_BOOL bit);
+ FX_BOOL hasBit(int32_t col, int32_t row);
void place();
private:
CFX_WideString m_codewords;
- FX_INT32 m_numrows;
- FX_INT32 m_numcols;
+ int32_t m_numrows;
+ int32_t m_numcols;
CFX_ByteArray m_bits;
- void module(FX_INT32 row, FX_INT32 col, FX_INT32 pos, FX_INT32 bit);
- void utah(FX_INT32 row, FX_INT32 col, FX_INT32 pos);
- void corner1(FX_INT32 pos);
- void corner2(FX_INT32 pos);
- void corner3(FX_INT32 pos);
- void corner4(FX_INT32 pos);
+ void module(int32_t row, int32_t col, int32_t pos, int32_t bit);
+ void utah(int32_t row, int32_t col, int32_t pos);
+ void corner1(int32_t pos);
+ void corner2(int32_t pos);
+ void corner3(int32_t pos);
+ void corner4(int32_t pos);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_EdifactEncoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_EdifactEncoder.cpp index d1e84af73e..8a0271f1a0 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_EdifactEncoder.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_EdifactEncoder.cpp @@ -35,11 +35,11 @@ CBC_EdifactEncoder::CBC_EdifactEncoder() CBC_EdifactEncoder::~CBC_EdifactEncoder()
{
}
-FX_INT32 CBC_EdifactEncoder::getEncodingMode()
+int32_t CBC_EdifactEncoder::getEncodingMode()
{
return EDIFACT_ENCODATION;
}
-void CBC_EdifactEncoder::Encode(CBC_EncoderContext &context, FX_INT32 &e)
+void CBC_EdifactEncoder::Encode(CBC_EncoderContext &context, int32_t &e)
{
CFX_WideString buffer;
while (context.hasMoreCharacters()) {
@@ -49,14 +49,14 @@ void CBC_EdifactEncoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) return;
}
context.m_pos++;
- FX_INT32 count = buffer.GetLength();
+ int32_t count = buffer.GetLength();
if (count >= 4) {
context.writeCodewords(encodeToCodewords(buffer, 0, e));
if (e != BCExceptionNO) {
return;
}
buffer.Delete(0, 4);
- FX_INT32 newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
if (newMode != getEncodingMode()) {
context.signalEncoderChange(ASCII_ENCODATION);
break;
@@ -66,9 +66,9 @@ void CBC_EdifactEncoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) buffer += (FX_WCHAR)31;
handleEOD(context, buffer, e);
}
-void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext &context, CFX_WideString buffer, FX_INT32 &e)
+void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext &context, CFX_WideString buffer, int32_t &e)
{
- FX_INT32 count = buffer.GetLength();
+ int32_t count = buffer.GetLength();
if (count == 0) {
return;
}
@@ -77,8 +77,8 @@ void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext &context, CFX_WideString b if (e != BCExceptionNO) {
return;
}
- FX_INT32 available = context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
- FX_INT32 remaining = context.getRemainingCharacters();
+ int32_t available = context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
+ int32_t remaining = context.getRemainingCharacters();
if (remaining == 0 && available <= 2) {
return;
}
@@ -87,7 +87,7 @@ void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext &context, CFX_WideString b e = BCExceptionIllegalStateCountMustNotExceed4;
return;
}
- FX_INT32 restChars = count - 1;
+ int32_t restChars = count - 1;
CFX_WideString encoded = encodeToCodewords(buffer, 0, e);
if (e != BCExceptionNO) {
return;
@@ -99,7 +99,7 @@ void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext &context, CFX_WideString b if (e != BCExceptionNO) {
return;
}
- FX_INT32 available = context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
+ int32_t available = context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
if (available >= 3) {
restInAscii = FALSE;
context.updateSymbolInfo(context.getCodewordCount() + encoded.GetLength(), e);
@@ -116,7 +116,7 @@ void CBC_EdifactEncoder::handleEOD(CBC_EncoderContext &context, CFX_WideString b }
context.signalEncoderChange(ASCII_ENCODATION);
}
-void CBC_EdifactEncoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e)
+void CBC_EdifactEncoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e)
{
if (c >= ' ' && c <= '?') {
sb += c;
@@ -126,9 +126,9 @@ void CBC_EdifactEncoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e) CBC_HighLevelEncoder::illegalCharacter(c, e);
}
}
-CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb, FX_INT32 startPos, FX_INT32 &e)
+CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb, int32_t startPos, int32_t &e)
{
- FX_INT32 len = sb.GetLength() - startPos;
+ int32_t len = sb.GetLength() - startPos;
if (len == 0) {
e = BCExceptionNoContents;
return (FX_LPWSTR)"";
@@ -137,7 +137,7 @@ CFX_WideString CBC_EdifactEncoder::encodeToCodewords(CFX_WideString sb, FX_INT32 FX_WCHAR c2 = len >= 2 ? sb.GetAt(startPos + 1) : 0;
FX_WCHAR c3 = len >= 3 ? sb.GetAt(startPos + 2) : 0;
FX_WCHAR c4 = len >= 4 ? sb.GetAt(startPos + 3) : 0;
- FX_INT32 v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
+ int32_t v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
FX_WCHAR cw1 = (FX_WCHAR) ((v >> 16) & 255);
FX_WCHAR cw2 = (FX_WCHAR) ((v >> 8) & 255);
FX_WCHAR cw3 = (FX_WCHAR) (v & 255);
diff --git a/xfa/src/fxbarcode/datamatrix/BC_EdifactEncoder.h b/xfa/src/fxbarcode/datamatrix/BC_EdifactEncoder.h index 7e2453a71d..6b102c689c 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_EdifactEncoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_EdifactEncoder.h @@ -13,11 +13,11 @@ class CBC_EdifactEncoder : public CBC_Encoder public:
CBC_EdifactEncoder();
virtual ~CBC_EdifactEncoder();
- FX_INT32 getEncodingMode();
- void Encode(CBC_EncoderContext &context, FX_INT32 &e);
+ int32_t getEncodingMode();
+ void Encode(CBC_EncoderContext &context, int32_t &e);
private:
- static void handleEOD(CBC_EncoderContext &context, CFX_WideString buffer, FX_INT32 &e);
- static void encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e);
- static CFX_WideString encodeToCodewords(CFX_WideString sb, FX_INT32 startPos, FX_INT32 &e);
+ static void handleEOD(CBC_EncoderContext &context, CFX_WideString buffer, int32_t &e);
+ static void encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e);
+ static CFX_WideString encodeToCodewords(CFX_WideString sb, int32_t startPos, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_Encoder.h b/xfa/src/fxbarcode/datamatrix/BC_Encoder.h index 7d1a1b5b62..9a51af06e9 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_Encoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_Encoder.h @@ -12,7 +12,7 @@ class CBC_Encoder public:
CBC_Encoder();
virtual ~CBC_Encoder();
- virtual FX_INT32 getEncodingMode() = 0;
- virtual void Encode(CBC_EncoderContext &context, FX_INT32 &e) = 0;
+ virtual int32_t getEncodingMode() = 0;
+ virtual void Encode(CBC_EncoderContext &context, int32_t &e) = 0;
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_EncoderContext.cpp b/xfa/src/fxbarcode/datamatrix/BC_EncoderContext.cpp index f65c9f29bc..066b4b2037 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_EncoderContext.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_EncoderContext.cpp @@ -28,13 +28,13 @@ #include "BC_SymbolShapeHint.h"
#include "BC_SymbolInfo.h"
#include "BC_EncoderContext.h"
-CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString msg, CFX_WideString ecLevel, FX_INT32 &e)
+CBC_EncoderContext::CBC_EncoderContext(const CFX_WideString msg, CFX_WideString ecLevel, int32_t &e)
{
CFX_ByteString dststr;
CBC_UtilCodingConvert::UnicodeToUTF8(msg, dststr);
CFX_WideString sb;
- FX_INT32 c = dststr.GetLength();
- for (FX_INT32 i = 0; i < c; i++) {
+ int32_t c = dststr.GetLength();
+ for (int32_t i = 0; i < c; i++) {
FX_WCHAR ch = (FX_WCHAR)(dststr.GetAt(i) & 0xff);
if (ch == '?' && dststr.GetAt(i) != '?') {
e = BCExceptionCharactersOutsideISO88591Encoding;
@@ -66,7 +66,7 @@ CFX_WideString CBC_EncoderContext::getMessage() {
return m_msg;
}
-void CBC_EncoderContext::setSkipAtEnd(FX_INT32 count)
+void CBC_EncoderContext::setSkipAtEnd(int32_t count)
{
m_skipAtEnd = count;
}
@@ -86,11 +86,11 @@ void CBC_EncoderContext::writeCodeword(FX_WCHAR codeword) {
m_codewords += codeword;
}
-FX_INT32 CBC_EncoderContext::getCodewordCount()
+int32_t CBC_EncoderContext::getCodewordCount()
{
return m_codewords.GetLength();
}
-void CBC_EncoderContext::signalEncoderChange(FX_INT32 encoding)
+void CBC_EncoderContext::signalEncoderChange(int32_t encoding)
{
m_newEncoding = encoding;
}
@@ -102,15 +102,15 @@ FX_BOOL CBC_EncoderContext::hasMoreCharacters() {
return m_pos < getTotalMessageCharCount();
}
-FX_INT32 CBC_EncoderContext::getRemainingCharacters()
+int32_t CBC_EncoderContext::getRemainingCharacters()
{
return getTotalMessageCharCount() - m_pos;
}
-void CBC_EncoderContext::updateSymbolInfo(FX_INT32 &e)
+void CBC_EncoderContext::updateSymbolInfo(int32_t &e)
{
updateSymbolInfo(getCodewordCount(), e);
}
-void CBC_EncoderContext::updateSymbolInfo(FX_INT32 len, FX_INT32 &e)
+void CBC_EncoderContext::updateSymbolInfo(int32_t len, int32_t &e)
{
if (m_symbolInfo == NULL || len > m_symbolInfo->m_dataCapacity) {
m_symbolInfo = CBC_SymbolInfo::lookup(len, m_shape, m_minSize, m_maxSize, true, e);
@@ -121,7 +121,7 @@ void CBC_EncoderContext::resetSymbolInfo() {
m_shape = FORCE_NONE;
}
-FX_INT32 CBC_EncoderContext::getTotalMessageCharCount()
+int32_t CBC_EncoderContext::getTotalMessageCharCount()
{
return m_msg.GetLength() - m_skipAtEnd;
}
diff --git a/xfa/src/fxbarcode/datamatrix/BC_EncoderContext.h b/xfa/src/fxbarcode/datamatrix/BC_EncoderContext.h index 0099dbc9f0..e2dd0b35bb 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_EncoderContext.h +++ b/xfa/src/fxbarcode/datamatrix/BC_EncoderContext.h @@ -13,36 +13,36 @@ class CBC_EncoderContext; class CBC_EncoderContext : public CBC_SymbolShapeHint
{
public:
- CBC_EncoderContext(const CFX_WideString msg, CFX_WideString ecLevel, FX_INT32 &e);
+ CBC_EncoderContext(const CFX_WideString msg, CFX_WideString ecLevel, int32_t &e);
virtual ~CBC_EncoderContext();
void setSymbolShape(SymbolShapeHint shape);
void setSizeConstraints(CBC_Dimension* minSize, CBC_Dimension* maxSize);
CFX_WideString getMessage();
- void setSkipAtEnd(FX_INT32 count);
+ void setSkipAtEnd(int32_t count);
FX_WCHAR getCurrentChar();
FX_WCHAR getCurrent();
void writeCodewords(CFX_WideString codewords);
void writeCodeword(FX_WCHAR codeword);
- FX_INT32 getCodewordCount();
- void signalEncoderChange(FX_INT32 encoding);
+ int32_t getCodewordCount();
+ void signalEncoderChange(int32_t encoding);
void resetEncoderSignal();
FX_BOOL hasMoreCharacters();
- FX_INT32 getRemainingCharacters();
- void updateSymbolInfo(FX_INT32 &e);
- void updateSymbolInfo(FX_INT32 len, FX_INT32 &e);
+ int32_t getRemainingCharacters();
+ void updateSymbolInfo(int32_t &e);
+ void updateSymbolInfo(int32_t len, int32_t &e);
void resetSymbolInfo();
public:
CFX_WideString m_msg;
CFX_WideString m_codewords;
- FX_INT32 m_pos;
- FX_INT32 m_newEncoding;
+ int32_t m_pos;
+ int32_t m_newEncoding;
CBC_SymbolInfo* m_symbolInfo;
private:
- FX_INT32 getTotalMessageCharCount();
+ int32_t getTotalMessageCharCount();
private:
SymbolShapeHint m_shape;
CBC_Dimension* m_minSize;
CBC_Dimension* m_maxSize;
- FX_INT32 m_skipAtEnd;
+ int32_t m_skipAtEnd;
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/src/fxbarcode/datamatrix/BC_ErrorCorrection.cpp index f346072499..e574742b54 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_ErrorCorrection.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_ErrorCorrection.cpp @@ -25,8 +25,8 @@ #include "BC_SymbolShapeHint.h"
#include "BC_SymbolInfo.h"
#include "BC_ErrorCorrection.h"
-FX_INT32 CBC_ErrorCorrection::FACTOR_SETS[] = {5, 7, 10, 11, 12, 14, 18, 20, 24, 28, 36, 42, 48, 56, 62, 68};
-FX_INT32 CBC_ErrorCorrection::FACTORS[][100] = {
+int32_t CBC_ErrorCorrection::FACTOR_SETS[] = {5, 7, 10, 11, 12, 14, 18, 20, 24, 28, 36, 42, 48, 56, 62, 68};
+int32_t CBC_ErrorCorrection::FACTORS[][100] = {
{228, 48, 15, 111, 62},
{23, 68, 144, 134, 240, 92, 254},
{28, 24, 185, 166, 223, 248, 116, 255, 110, 61},
@@ -78,13 +78,13 @@ FX_INT32 CBC_ErrorCorrection::FACTORS[][100] = { 96, 103, 82, 186
}
};
-FX_INT32 CBC_ErrorCorrection::MODULO_VALUE = 0x12D;
-FX_INT32 CBC_ErrorCorrection::LOG[256] = {0};
-FX_INT32 CBC_ErrorCorrection::ALOG[256] = {0};
+int32_t CBC_ErrorCorrection::MODULO_VALUE = 0x12D;
+int32_t CBC_ErrorCorrection::LOG[256] = {0};
+int32_t CBC_ErrorCorrection::ALOG[256] = {0};
void CBC_ErrorCorrection::Initialize()
{
- FX_INT32 p = 1;
- for (FX_INT32 i = 0; i < 255; i++) {
+ int32_t p = 1;
+ for (int32_t i = 0; i < 255; i++) {
ALOG[i] = p;
LOG[p] = i;
p <<= 1;
@@ -102,7 +102,7 @@ CBC_ErrorCorrection::CBC_ErrorCorrection() CBC_ErrorCorrection::~CBC_ErrorCorrection()
{
}
-CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, CBC_SymbolInfo* symbolInfo, FX_INT32 &e)
+CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, CBC_SymbolInfo* symbolInfo, int32_t &e)
{
if (codewords.GetLength() != symbolInfo->m_dataCapacity) {
e = BCExceptionIllegalArgument;
@@ -110,7 +110,7 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, CBC_S }
CFX_WideString sb;
sb += codewords;
- FX_INT32 blockCount = symbolInfo->getInterleavedBlockCount();
+ int32_t blockCount = symbolInfo->getInterleavedBlockCount();
if (blockCount == 1) {
CFX_WideString ecc = createECCBlock(codewords, symbolInfo->m_errorCodewords, e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_LPWSTR)"");
@@ -122,7 +122,7 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, CBC_S errorSizes.SetSize(blockCount);
CFX_Int32Array startPos;
startPos.SetSize(blockCount);
- for (FX_INT32 i = 0; i < blockCount; i++) {
+ for (int32_t i = 0; i < blockCount; i++) {
dataSizes[i] = symbolInfo->getDataLengthForInterleavedBlock(i + 1);
errorSizes[i] = symbolInfo->getErrorLengthForInterleavedBlock(i + 1);
startPos[i] = 0;
@@ -130,29 +130,29 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, CBC_S startPos[i] = startPos[i - 1] + dataSizes[i];
}
}
- for (FX_INT32 block = 0; block < blockCount; block++) {
+ for (int32_t block = 0; block < blockCount; block++) {
CFX_WideString temp;
- for (FX_INT32 d = block; d < symbolInfo->m_dataCapacity; d += blockCount) {
+ for (int32_t d = block; d < symbolInfo->m_dataCapacity; d += blockCount) {
temp += (FX_WCHAR)codewords.GetAt(d);
}
CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_LPWSTR)"");
- FX_INT32 pos = 0;
- for (FX_INT32 l = block; l < errorSizes[block] * blockCount; l += blockCount) {
+ int32_t pos = 0;
+ for (int32_t l = block; l < errorSizes[block] * blockCount; l += blockCount) {
sb.SetAt(symbolInfo->m_dataCapacity + l, ecc.GetAt(pos++));
}
}
}
return sb;
}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, FX_INT32 numECWords, FX_INT32 &e)
+CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, int32_t numECWords, int32_t &e)
{
return createECCBlock(codewords, 0, codewords.GetLength(), numECWords, e);
}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, FX_INT32 start, FX_INT32 len, FX_INT32 numECWords, FX_INT32 &e)
+CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, int32_t start, int32_t len, int32_t numECWords, int32_t &e)
{
- FX_INT32 table = -1;
- for (FX_INT32 i = 0; i < sizeof(FACTOR_SETS) / sizeof(FX_INT32); i++) {
+ int32_t table = -1;
+ for (int32_t i = 0; i < sizeof(FACTOR_SETS) / sizeof(int32_t); i++) {
if (FACTOR_SETS[i] == numECWords) {
table = i;
break;
@@ -164,14 +164,14 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, FX_ }
FX_WORD* ecc = FX_Alloc(FX_WORD, numECWords);
FXSYS_memset32(ecc, 0, numECWords * sizeof(FX_WORD));
- for (FX_INT32 l = start; l < start + len; l++) {
- FX_BYTE A = (FX_BYTE)codewords.GetAt(l);
+ for (int32_t l = start; l < start + len; l++) {
+ uint8_t A = (uint8_t)codewords.GetAt(l);
FX_WORD B = ecc[numECWords - 1];
FX_WORD m = ecc[numECWords - 1] ^ codewords.GetAt(l);
- for (FX_INT32 k = numECWords - 1; k > 0; k--) {
+ for (int32_t k = numECWords - 1; k > 0; k--) {
if (m != 0 && FACTORS[table][k] != 0) {
- FX_INT32 a = LOG[FACTORS[table][k]];
- FX_INT32 b = ALOG[(LOG[m] + LOG[FACTORS[table][k]]) % 255];
+ int32_t a = LOG[FACTORS[table][k]];
+ int32_t b = ALOG[(LOG[m] + LOG[FACTORS[table][k]]) % 255];
FX_WORD c = ecc[k - 1];
FX_WORD D = (ecc[k - 1] ^ ALOG[(LOG[m] + LOG[FACTORS[table][k]]) % 255]);
ecc[k] = (FX_WORD ) (ecc[k - 1] ^ ALOG[(LOG[m] + LOG[FACTORS[table][k]]) % 255]);
@@ -186,7 +186,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords, FX_ }
}
CFX_WideString strecc;
- for (FX_INT32 j = 0; j < numECWords; j++) {
+ for (int32_t j = 0; j < numECWords; j++) {
strecc += (FX_WCHAR)ecc[numECWords - j - 1];
}
FX_Free(ecc);
diff --git a/xfa/src/fxbarcode/datamatrix/BC_ErrorCorrection.h b/xfa/src/fxbarcode/datamatrix/BC_ErrorCorrection.h index 0bc71cdeb5..2ec7b27aaa 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_ErrorCorrection.h +++ b/xfa/src/fxbarcode/datamatrix/BC_ErrorCorrection.h @@ -14,15 +14,15 @@ public: virtual ~CBC_ErrorCorrection();
static void Initialize();
static void Finalize();
- static CFX_WideString encodeECC200(CFX_WideString codewords, CBC_SymbolInfo* symbolInfo, FX_INT32 &e);
+ static CFX_WideString encodeECC200(CFX_WideString codewords, CBC_SymbolInfo* symbolInfo, int32_t &e);
private:
- static FX_INT32 FACTOR_SETS[];
- static FX_INT32 FACTORS[][100];
- static FX_INT32 MODULO_VALUE;
- static FX_INT32 LOG[256];
- static FX_INT32 ALOG[256];
+ static int32_t FACTOR_SETS[];
+ static int32_t FACTORS[][100];
+ static int32_t MODULO_VALUE;
+ static int32_t LOG[256];
+ static int32_t ALOG[256];
private:
- static CFX_WideString createECCBlock(CFX_WideString codewords, FX_INT32 numECWords, FX_INT32 &e);
- static CFX_WideString createECCBlock(CFX_WideString codewords, FX_INT32 start, FX_INT32 len, FX_INT32 numECWords, FX_INT32 &e);
+ static CFX_WideString createECCBlock(CFX_WideString codewords, int32_t numECWords, int32_t &e);
+ static CFX_WideString createECCBlock(CFX_WideString codewords, int32_t start, int32_t len, int32_t numECWords, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp index 5b46612d62..3866f45a5e 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp @@ -60,16 +60,16 @@ CFX_ByteArray& CBC_HighLevelEncoder::getBytesForMessage(CFX_WideString msg) {
CFX_ByteString bytestr;
CBC_UtilCodingConvert::UnicodeToUTF8(msg, bytestr);
- for (FX_INT32 i = 0; i < bytestr.GetLength(); i++) {
+ for (int32_t i = 0; i < bytestr.GetLength(); i++) {
m_bytearray.Add(bytestr.GetAt(i));
}
return m_bytearray;
}
-CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, FX_INT32 &e)
+CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, int32_t &e)
{
return encodeHighLevel(msg, ecLevel, FORCE_NONE, NULL, NULL, e);
}
-CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, FX_INT32 &e)
+CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, int32_t &e)
{
CBC_EncoderContext context(msg, ecLevel, e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_LPWSTR)"");
@@ -91,11 +91,11 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_Wi encoders.Add(FX_NEW CBC_X12Encoder());
encoders.Add(FX_NEW CBC_EdifactEncoder());
encoders.Add(FX_NEW CBC_Base256Encoder());
- FX_INT32 encodingMode = ASCII_ENCODATION;
+ int32_t encodingMode = ASCII_ENCODATION;
while (context.hasMoreCharacters()) {
((CBC_Encoder*)encoders.GetAt(encodingMode))->Encode(context, e);
if (e != BCExceptionNO) {
- for (FX_INT32 i = 0; i < encoders.GetSize(); i++) {
+ for (int32_t i = 0; i < encoders.GetSize(); i++) {
delete (CBC_Encoder*)encoders.GetAt(i);
}
encoders.RemoveAll();
@@ -106,16 +106,16 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_Wi context.resetEncoderSignal();
}
}
- FX_INT32 len = context.m_codewords.GetLength();
+ int32_t len = context.m_codewords.GetLength();
context.updateSymbolInfo(e);
if (e != BCExceptionNO) {
- for (FX_INT32 i = 0; i < encoders.GetSize(); i++) {
+ for (int32_t i = 0; i < encoders.GetSize(); i++) {
delete (CBC_Encoder*)encoders.GetAt(i);
}
encoders.RemoveAll();
return (FX_LPWSTR)"";
}
- FX_INT32 capacity = context.m_symbolInfo->m_dataCapacity;
+ int32_t capacity = context.m_symbolInfo->m_dataCapacity;
if (len < capacity) {
if (encodingMode != ASCII_ENCODATION && encodingMode != BASE256_ENCODATION) {
context.writeCodeword(0x00fe);
@@ -128,13 +128,13 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg, CFX_Wi while (codewords.GetLength() < capacity) {
codewords += (randomize253State(PAD, codewords.GetLength() + 1));
}
- for (FX_INT32 i = 0; i < encoders.GetSize(); i++) {
+ for (int32_t i = 0; i < encoders.GetSize(); i++) {
delete (CBC_Encoder*)encoders.GetAt(i);
}
encoders.RemoveAll();
return codewords;
}
-FX_INT32 CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, FX_INT32 startpos, FX_INT32 currentMode)
+int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, int32_t startpos, int32_t currentMode)
{
if (startpos >= msg.GetLength()) {
return currentMode;
@@ -156,7 +156,7 @@ FX_INT32 CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, FX_INT32 startp charCounts.Add(2.25f);
charCounts[currentMode] = 0;
}
- FX_INT32 charsProcessed = 0;
+ int32_t charsProcessed = 0;
while (TRUE) {
if ((startpos + charsProcessed) == msg.GetLength()) {
FX_DWORD min = Integer_MAX_VALUE;
@@ -165,7 +165,7 @@ FX_INT32 CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, FX_INT32 startp CFX_Int32Array intCharCounts;
intCharCounts.SetSize(6);
min = findMinimums(charCounts, intCharCounts, min, mins);
- FX_INT32 minCount = getMinimumCount(mins);
+ int32_t minCount = getMinimumCount(mins);
if (intCharCounts[ASCII_ENCODATION] == min) {
return ASCII_ENCODATION;
}
@@ -233,7 +233,7 @@ FX_INT32 CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, FX_INT32 startp CFX_ByteArray mins;
mins.SetSize(6);
findMinimums(charCounts, intCharCounts, Integer_MAX_VALUE, mins);
- FX_INT32 minCount = getMinimumCount(mins);
+ int32_t minCount = getMinimumCount(mins);
if (intCharCounts[ASCII_ENCODATION] < intCharCounts[BASE256_ENCODATION]
&& intCharCounts[ASCII_ENCODATION] < intCharCounts[C40_ENCODATION]
&& intCharCounts[ASCII_ENCODATION] < intCharCounts[TEXT_ENCODATION]
@@ -262,7 +262,7 @@ FX_INT32 CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, FX_INT32 startp return C40_ENCODATION;
}
if (intCharCounts[C40_ENCODATION] == intCharCounts[X12_ENCODATION]) {
- FX_INT32 p = startpos + charsProcessed + 1;
+ int32_t p = startpos + charsProcessed + 1;
while (p < msg.GetLength()) {
FX_WCHAR tc = msg.GetAt(p);
if (isX12TermSep(tc)) {
@@ -287,11 +287,11 @@ FX_BOOL CBC_HighLevelEncoder::isExtendedASCII(FX_WCHAR ch) {
return ch >= 128 && ch <= 255;
}
-FX_INT32 CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, FX_INT32 startpos)
+int32_t CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos)
{
- FX_INT32 count = 0;
- FX_INT32 len = msg.GetLength();
- FX_INT32 idx = startpos;
+ int32_t count = 0;
+ int32_t len = msg.GetLength();
+ int32_t idx = startpos;
if (idx < len) {
FX_WCHAR ch = msg.GetAt(idx);
while (isDigit(ch) && idx < len) {
@@ -304,28 +304,28 @@ FX_INT32 CBC_HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg }
return count;
}
-void CBC_HighLevelEncoder::illegalCharacter(FX_WCHAR c, FX_INT32 &e)
+void CBC_HighLevelEncoder::illegalCharacter(FX_WCHAR c, int32_t &e)
{
e = BCExceptionIllegalArgument;
}
-FX_WCHAR CBC_HighLevelEncoder::randomize253State(FX_WCHAR ch, FX_INT32 codewordPosition)
+FX_WCHAR CBC_HighLevelEncoder::randomize253State(FX_WCHAR ch, int32_t codewordPosition)
{
- FX_INT32 pseudoRandom = ((149 * codewordPosition) % 253) + 1;
- FX_INT32 tempVariable = ch + pseudoRandom;
+ int32_t pseudoRandom = ((149 * codewordPosition) % 253) + 1;
+ int32_t tempVariable = ch + pseudoRandom;
return tempVariable <= 254 ? (FX_WCHAR) tempVariable : (FX_WCHAR) (tempVariable - 254);
}
-FX_INT32 CBC_HighLevelEncoder::findMinimums(CFX_FloatArray &charCounts, CFX_Int32Array &intCharCounts, FX_INT32 min, CFX_ByteArray &mins)
+int32_t CBC_HighLevelEncoder::findMinimums(CFX_FloatArray &charCounts, CFX_Int32Array &intCharCounts, int32_t min, CFX_ByteArray &mins)
{
- for (FX_INT32 l = 0; l < mins.GetSize(); l++) {
- mins[l] = (FX_BYTE)0;
+ for (int32_t l = 0; l < mins.GetSize(); l++) {
+ mins[l] = (uint8_t)0;
}
- for (FX_INT32 i = 0; i < 6; i++) {
- intCharCounts[i] = (FX_INT32)ceil(charCounts[i]);
- FX_INT32 current = intCharCounts[i];
+ for (int32_t i = 0; i < 6; i++) {
+ intCharCounts[i] = (int32_t)ceil(charCounts[i]);
+ int32_t current = intCharCounts[i];
if (min > current) {
min = current;
- for (FX_INT32 j = 0; j < mins.GetSize(); j++) {
- mins[j] = (FX_BYTE)0;
+ for (int32_t j = 0; j < mins.GetSize(); j++) {
+ mins[j] = (uint8_t)0;
}
}
if (min == current) {
@@ -334,10 +334,10 @@ FX_INT32 CBC_HighLevelEncoder::findMinimums(CFX_FloatArray &charCounts, CFX_Int3 }
return min;
}
-FX_INT32 CBC_HighLevelEncoder::getMinimumCount(CFX_ByteArray &mins)
+int32_t CBC_HighLevelEncoder::getMinimumCount(CFX_ByteArray &mins)
{
- FX_INT32 minCount = 0;
- for (FX_INT32 i = 0; i < 6; i++) {
+ int32_t minCount = 0;
+ for (int32_t i = 0; i < 6; i++) {
minCount += mins[i];
}
return minCount;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.h index 170ca9f8fa..c2bfdccb1b 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.h @@ -20,13 +20,13 @@ public: CBC_HighLevelEncoder();
virtual ~CBC_HighLevelEncoder();
CFX_ByteArray& getBytesForMessage(CFX_WideString msg);
- static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, FX_INT32 &e);
- static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, FX_INT32 &e);
- static FX_INT32 lookAheadTest(CFX_WideString msg, FX_INT32 startpos, FX_INT32 currentMode);
+ static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, int32_t &e);
+ static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, int32_t &e);
+ static int32_t lookAheadTest(CFX_WideString msg, int32_t startpos, int32_t currentMode);
static FX_BOOL isDigit(FX_WCHAR ch);
static FX_BOOL isExtendedASCII(FX_WCHAR ch);
- static FX_INT32 determineConsecutiveDigitCount(CFX_WideString msg, FX_INT32 startpos);
- static void illegalCharacter(FX_WCHAR c, FX_INT32 &e);
+ static int32_t determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos);
+ static void illegalCharacter(FX_WCHAR c, int32_t &e);
public:
static FX_WCHAR LATCH_TO_C40;
@@ -46,9 +46,9 @@ private: static const wchar_t MACRO_TRAILER;
CFX_ByteArray m_bytearray;
private:
- static FX_WCHAR randomize253State(FX_WCHAR ch, FX_INT32 codewordPosition);
- static FX_INT32 findMinimums(CFX_FloatArray &charCounts, CFX_Int32Array &intCharCounts, FX_INT32 min, CFX_ByteArray &mins);
- static FX_INT32 getMinimumCount(CFX_ByteArray &mins);
+ static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition);
+ static int32_t findMinimums(CFX_FloatArray &charCounts, CFX_Int32Array &intCharCounts, int32_t min, CFX_ByteArray &mins);
+ static int32_t getMinimumCount(CFX_ByteArray &mins);
static FX_BOOL isNativeC40(FX_WCHAR ch);
static FX_BOOL isNativeText(FX_WCHAR ch);
static FX_BOOL isNativeX12(FX_WCHAR ch);
diff --git a/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp b/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp index 415cbd6b3c..0044683a5c 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp @@ -62,19 +62,19 @@ void CBC_SymbolInfo::Initialize() m_PROD_SYMBOLS[27] = FX_NEW CBC_SymbolInfo(FALSE, 1050, 408, 18, 18, 36, 175, 68);
m_PROD_SYMBOLS[28] = FX_NEW CBC_SymbolInfo(FALSE, 1304, 496, 20, 20, 36, 163, 62);
m_PROD_SYMBOLS[29] = FX_NEW CBC_DataMatrixSymbolInfo144();
- for (FX_INT32 i = 0; i < SYMBOLS_COUNT; i++) {
+ for (int32_t i = 0; i < SYMBOLS_COUNT; i++) {
m_symbols[i] = m_PROD_SYMBOLS[i];
}
}
void CBC_SymbolInfo::Finalize()
{
- for (FX_INT32 i = 0; i < SYMBOLS_COUNT; i++) {
+ for (int32_t i = 0; i < SYMBOLS_COUNT; i++) {
delete m_PROD_SYMBOLS[i];
m_PROD_SYMBOLS[i] = NULL;
m_symbols[i] = NULL;
}
}
-CBC_SymbolInfo::CBC_SymbolInfo(FX_BOOL rectangular, FX_INT32 dataCapacity, FX_INT32 errorCodewords, FX_INT32 matrixWidth, FX_INT32 matrixHeight, FX_INT32 dataRegions)
+CBC_SymbolInfo::CBC_SymbolInfo(FX_BOOL rectangular, int32_t dataCapacity, int32_t errorCodewords, int32_t matrixWidth, int32_t matrixHeight, int32_t dataRegions)
{
m_rectangular = rectangular;
m_dataCapacity = dataCapacity;
@@ -85,8 +85,8 @@ CBC_SymbolInfo::CBC_SymbolInfo(FX_BOOL rectangular, FX_INT32 dataCapacity, FX_IN m_rsBlockData = dataCapacity;
m_rsBlockError = errorCodewords;
}
-CBC_SymbolInfo::CBC_SymbolInfo(FX_BOOL rectangular, FX_INT32 dataCapacity, FX_INT32 errorCodewords, FX_INT32 matrixWidth, FX_INT32 matrixHeight, FX_INT32 dataRegions,
- FX_INT32 rsBlockData, FX_INT32 rsBlockError)
+CBC_SymbolInfo::CBC_SymbolInfo(FX_BOOL rectangular, int32_t dataCapacity, int32_t errorCodewords, int32_t matrixWidth, int32_t matrixHeight, int32_t dataRegions,
+ int32_t rsBlockData, int32_t rsBlockError)
{
m_rectangular = rectangular;
m_dataCapacity = dataCapacity;
@@ -101,26 +101,26 @@ CBC_SymbolInfo::~CBC_SymbolInfo() {
}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(FX_INT32 dataCodewords, FX_INT32 &e)
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, int32_t &e)
{
return lookup(dataCodewords, FORCE_NONE, TRUE, e);
}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(FX_INT32 dataCodewords, SymbolShapeHint shape, FX_INT32 &e)
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, SymbolShapeHint shape, int32_t &e)
{
return lookup(dataCodewords, shape, TRUE, e);
}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(FX_INT32 dataCodewords, FX_BOOL allowRectangular, FX_BOOL fail, FX_INT32 &e)
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, FX_BOOL allowRectangular, FX_BOOL fail, int32_t &e)
{
SymbolShapeHint shape = allowRectangular ? FORCE_NONE : FORCE_SQUARE;
return lookup(dataCodewords, shape, fail, e);
}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(FX_INT32 dataCodewords, SymbolShapeHint shape, FX_BOOL fail, FX_INT32 &e)
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, SymbolShapeHint shape, FX_BOOL fail, int32_t &e)
{
return lookup(dataCodewords, shape, NULL, NULL, fail, e);
}
-CBC_SymbolInfo* CBC_SymbolInfo::lookup(FX_INT32 dataCodewords, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, FX_BOOL fail, FX_INT32 &e)
+CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, FX_BOOL fail, int32_t &e)
{
- for (FX_INT32 i = 0; i < SYMBOLS_COUNT; i++) {
+ for (int32_t i = 0; i < SYMBOLS_COUNT; i++) {
CBC_SymbolInfo* symbol = m_symbols[i];
if (shape == FORCE_SQUARE && symbol->m_rectangular) {
continue;
@@ -146,7 +146,7 @@ CBC_SymbolInfo* CBC_SymbolInfo::lookup(FX_INT32 dataCodewords, SymbolShapeHint s }
return NULL;
}
-FX_INT32 CBC_SymbolInfo::getHorizontalDataRegions(FX_INT32 &e)
+int32_t CBC_SymbolInfo::getHorizontalDataRegions(int32_t &e)
{
switch (m_dataRegions) {
case 1:
@@ -164,7 +164,7 @@ FX_INT32 CBC_SymbolInfo::getHorizontalDataRegions(FX_INT32 &e) return 0;
}
}
-FX_INT32 CBC_SymbolInfo::getVerticalDataRegions(FX_INT32 &e)
+int32_t CBC_SymbolInfo::getVerticalDataRegions(int32_t &e)
{
switch (m_dataRegions) {
case 1:
@@ -182,39 +182,39 @@ FX_INT32 CBC_SymbolInfo::getVerticalDataRegions(FX_INT32 &e) return 0;
}
}
-FX_INT32 CBC_SymbolInfo::getSymbolDataWidth(FX_INT32 &e)
+int32_t CBC_SymbolInfo::getSymbolDataWidth(int32_t &e)
{
return getHorizontalDataRegions(e) * m_matrixWidth;
}
-FX_INT32 CBC_SymbolInfo::getSymbolDataHeight(FX_INT32 &e)
+int32_t CBC_SymbolInfo::getSymbolDataHeight(int32_t &e)
{
return getVerticalDataRegions(e) * m_matrixHeight;
}
-FX_INT32 CBC_SymbolInfo::getSymbolWidth(FX_INT32 &e)
+int32_t CBC_SymbolInfo::getSymbolWidth(int32_t &e)
{
return getSymbolDataWidth(e) + (getHorizontalDataRegions(e) * 2);
}
-FX_INT32 CBC_SymbolInfo::getSymbolHeight(FX_INT32 &e)
+int32_t CBC_SymbolInfo::getSymbolHeight(int32_t &e)
{
return getSymbolDataHeight(e) + (getVerticalDataRegions(e) * 2);
}
-FX_INT32 CBC_SymbolInfo::getCodewordCount()
+int32_t CBC_SymbolInfo::getCodewordCount()
{
return m_dataCapacity + m_errorCodewords;
}
-FX_INT32 CBC_SymbolInfo::getInterleavedBlockCount()
+int32_t CBC_SymbolInfo::getInterleavedBlockCount()
{
return m_dataCapacity / m_rsBlockData;
}
-FX_INT32 CBC_SymbolInfo::getDataLengthForInterleavedBlock(FX_INT32 index)
+int32_t CBC_SymbolInfo::getDataLengthForInterleavedBlock(int32_t index)
{
return m_rsBlockData;
}
-FX_INT32 CBC_SymbolInfo::getErrorLengthForInterleavedBlock(FX_INT32 index)
+int32_t CBC_SymbolInfo::getErrorLengthForInterleavedBlock(int32_t index)
{
return m_rsBlockError;
}
-CFX_WideString CBC_SymbolInfo::toString(FX_INT32 &e)
+CFX_WideString CBC_SymbolInfo::toString(int32_t &e)
{
CFX_WideString sb;
sb += (FX_LPWSTR)(m_rectangular ? "Rectangular Symbol:" : "Square Symbol:");
diff --git a/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.h b/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.h index 0450a28725..5ace547442 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.h +++ b/xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.h @@ -12,42 +12,42 @@ class CBC_SymbolInfo; class CBC_SymbolInfo : public CBC_SymbolShapeHint
{
public:
- CBC_SymbolInfo(FX_BOOL rectangular, FX_INT32 dataCapacity, FX_INT32 errorCodewords,
- FX_INT32 matrixWidth, FX_INT32 matrixHeight, FX_INT32 dataRegions);
+ CBC_SymbolInfo(FX_BOOL rectangular, int32_t dataCapacity, int32_t errorCodewords,
+ int32_t matrixWidth, int32_t matrixHeight, int32_t dataRegions);
virtual ~CBC_SymbolInfo();
static void Initialize();
static void Finalize();
static void overrideSymbolSet(CBC_SymbolInfo* override);
- static CBC_SymbolInfo* lookup(FX_INT32 dataCodewords, FX_INT32 &e);
- static CBC_SymbolInfo* lookup(FX_INT32 dataCodewords, SymbolShapeHint shape, FX_INT32 &e);
- static CBC_SymbolInfo* lookup(FX_INT32 dataCodewords, FX_BOOL allowRectangular, FX_BOOL fail, FX_INT32 &e);
- static CBC_SymbolInfo* lookup(FX_INT32 dataCodewords, SymbolShapeHint shape, FX_BOOL fail, FX_INT32 &e);
- static CBC_SymbolInfo* lookup(FX_INT32 dataCodewords, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, FX_BOOL fail, FX_INT32 &e);
- FX_INT32 getHorizontalDataRegions(FX_INT32 &e);
- FX_INT32 getVerticalDataRegions(FX_INT32 &e);
- FX_INT32 getSymbolDataWidth(FX_INT32 &e);
- FX_INT32 getSymbolDataHeight(FX_INT32 &e);
- FX_INT32 getSymbolWidth(FX_INT32 &e);
- FX_INT32 getSymbolHeight(FX_INT32 &e);
- FX_INT32 getCodewordCount();
- FX_INT32 getInterleavedBlockCount();
- FX_INT32 getDataLengthForInterleavedBlock(FX_INT32 index);
- FX_INT32 getErrorLengthForInterleavedBlock(FX_INT32 index);
- CFX_WideString toString(FX_INT32 &e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords, int32_t &e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords, SymbolShapeHint shape, int32_t &e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords, FX_BOOL allowRectangular, FX_BOOL fail, int32_t &e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords, SymbolShapeHint shape, FX_BOOL fail, int32_t &e);
+ static CBC_SymbolInfo* lookup(int32_t dataCodewords, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, FX_BOOL fail, int32_t &e);
+ int32_t getHorizontalDataRegions(int32_t &e);
+ int32_t getVerticalDataRegions(int32_t &e);
+ int32_t getSymbolDataWidth(int32_t &e);
+ int32_t getSymbolDataHeight(int32_t &e);
+ int32_t getSymbolWidth(int32_t &e);
+ int32_t getSymbolHeight(int32_t &e);
+ int32_t getCodewordCount();
+ int32_t getInterleavedBlockCount();
+ int32_t getDataLengthForInterleavedBlock(int32_t index);
+ int32_t getErrorLengthForInterleavedBlock(int32_t index);
+ CFX_WideString toString(int32_t &e);
public:
- FX_INT32 m_dataCapacity;
- FX_INT32 m_errorCodewords;
- FX_INT32 m_matrixWidth;
- FX_INT32 m_matrixHeight;
- FX_INT32 m_rsBlockData;
- FX_INT32 m_rsBlockError;
+ int32_t m_dataCapacity;
+ int32_t m_errorCodewords;
+ int32_t m_matrixWidth;
+ int32_t m_matrixHeight;
+ int32_t m_rsBlockData;
+ int32_t m_rsBlockError;
static CBC_SymbolInfo* m_PROD_SYMBOLS[30];
private:
static CBC_SymbolInfo* m_symbols[30];
FX_BOOL m_rectangular;
- FX_INT32 m_dataRegions;
+ int32_t m_dataRegions;
private:
- CBC_SymbolInfo(FX_BOOL rectangular, FX_INT32 dataCapacity, FX_INT32 errorCodewords, FX_INT32 matrixWidth, FX_INT32 matrixHeight, FX_INT32 dataRegions,
- FX_INT32 rsBlockData, FX_INT32 rsBlockError);
+ CBC_SymbolInfo(FX_BOOL rectangular, int32_t dataCapacity, int32_t errorCodewords, int32_t matrixWidth, int32_t matrixHeight, int32_t dataRegions,
+ int32_t rsBlockData, int32_t rsBlockError);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp index 45abec4d4a..afccce598f 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp @@ -36,11 +36,11 @@ CBC_TextEncoder::CBC_TextEncoder() CBC_TextEncoder::~CBC_TextEncoder()
{
}
-FX_INT32 CBC_TextEncoder::getEncodingMode()
+int32_t CBC_TextEncoder::getEncodingMode()
{
return TEXT_ENCODATION;
}
-FX_INT32 CBC_TextEncoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e)
+int32_t CBC_TextEncoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e)
{
if (c == ' ') {
sb += (FX_WCHAR)'\3';
@@ -92,7 +92,7 @@ FX_INT32 CBC_TextEncoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e if (c >= 0x0080) {
sb += (FX_WCHAR)'\1';
sb += (FX_WCHAR)0x001e;
- FX_INT32 len = 2;
+ int32_t len = 2;
len += encodeChar((FX_WCHAR) (c - 128), sb, e);
BC_EXCEPTION_CHECK_ReturnValue(e, -1);
return len;
diff --git a/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.h b/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.h index f1168679a6..7d46e92d5d 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.h @@ -12,7 +12,7 @@ class CBC_TextEncoder : public CBC_C40Encoder public:
CBC_TextEncoder();
virtual ~CBC_TextEncoder();
- FX_INT32 getEncodingMode();
- FX_INT32 encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e);
+ int32_t getEncodingMode();
+ int32_t encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/datamatrix/BC_X12Encoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_X12Encoder.cpp index f6263f6777..7f56de7aed 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_X12Encoder.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_X12Encoder.cpp @@ -36,11 +36,11 @@ CBC_X12Encoder::CBC_X12Encoder() CBC_X12Encoder::~CBC_X12Encoder()
{
}
-FX_INT32 CBC_X12Encoder::getEncodingMode()
+int32_t CBC_X12Encoder::getEncodingMode()
{
return X12_ENCODATION;
}
-void CBC_X12Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e)
+void CBC_X12Encoder::Encode(CBC_EncoderContext &context, int32_t &e)
{
CFX_WideString buffer;
while (context.hasMoreCharacters()) {
@@ -50,10 +50,10 @@ void CBC_X12Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) if (e != BCExceptionNO) {
return;
}
- FX_INT32 count = buffer.GetLength();
+ int32_t count = buffer.GetLength();
if ((count % 3) == 0) {
writeNextTriplet(context, buffer);
- FX_INT32 newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
+ int32_t newMode = CBC_HighLevelEncoder::lookAheadTest(context.m_msg, context.m_pos, getEncodingMode());
if (newMode != getEncodingMode()) {
context.signalEncoderChange(newMode);
break;
@@ -62,14 +62,14 @@ void CBC_X12Encoder::Encode(CBC_EncoderContext &context, FX_INT32 &e) }
handleEOD(context, buffer, e);
}
-void CBC_X12Encoder::handleEOD(CBC_EncoderContext &context, CFX_WideString &buffer, FX_INT32 &e)
+void CBC_X12Encoder::handleEOD(CBC_EncoderContext &context, CFX_WideString &buffer, int32_t &e)
{
context.updateSymbolInfo(e);
if (e != BCExceptionNO) {
return;
}
- FX_INT32 available = context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
- FX_INT32 count = buffer.GetLength();
+ int32_t available = context.m_symbolInfo->m_dataCapacity - context.getCodewordCount();
+ int32_t count = buffer.GetLength();
if (count == 2) {
context.writeCodeword(CBC_HighLevelEncoder::X12_UNLATCH);
context.m_pos -= 2;
@@ -82,7 +82,7 @@ void CBC_X12Encoder::handleEOD(CBC_EncoderContext &context, CFX_WideString &buff context.signalEncoderChange(ASCII_ENCODATION);
}
}
-FX_INT32 CBC_X12Encoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e)
+int32_t CBC_X12Encoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e)
{
if (c == '\r') {
sb += (FX_WCHAR)'\0';
diff --git a/xfa/src/fxbarcode/datamatrix/BC_X12Encoder.h b/xfa/src/fxbarcode/datamatrix/BC_X12Encoder.h index 21111bc5cc..210f07a5d9 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_X12Encoder.h +++ b/xfa/src/fxbarcode/datamatrix/BC_X12Encoder.h @@ -13,9 +13,9 @@ class CBC_X12Encoder : public CBC_C40Encoder public:
CBC_X12Encoder();
virtual ~CBC_X12Encoder();
- FX_INT32 getEncodingMode();
- void Encode(CBC_EncoderContext &context, FX_INT32 &e);
- void handleEOD(CBC_EncoderContext &context, CFX_WideString &buffer, FX_INT32 &e);
- FX_INT32 encodeChar(FX_WCHAR c, CFX_WideString &sb, FX_INT32 &e);
+ int32_t getEncodingMode();
+ void Encode(CBC_EncoderContext &context, int32_t &e);
+ void handleEOD(CBC_EncoderContext &context, CFX_WideString &buffer, int32_t &e);
+ int32_t encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp index 1079c348d0..810b2c70c7 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp @@ -25,44 +25,44 @@ #include "../BC_BinaryBitmap.h"
#include "../common/BC_CommonBitArray.h"
#include "BC_OneDReader.h"
-const FX_INT32 CBC_OneDReader::INTEGER_MATH_SHIFT = 8;
-const FX_INT32 CBC_OneDReader::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << 8;
+const int32_t CBC_OneDReader::INTEGER_MATH_SHIFT = 8;
+const int32_t CBC_OneDReader::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << 8;
CBC_OneDReader::CBC_OneDReader()
{
}
CBC_OneDReader::~CBC_OneDReader()
{
}
-CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e)
+CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap *image, int32_t &e)
{
CFX_ByteString strtemp = Decode(image, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
return strtemp;
}
-CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
CFX_ByteString strtemp = DeDecode(image, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
return strtemp;
}
-CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
- FX_INT32 width = image->GetWidth();
- FX_INT32 height = image->GetHeight();
+ int32_t width = image->GetWidth();
+ int32_t height = image->GetHeight();
CBC_CommonBitArray *row = NULL;
- FX_INT32 middle = height >> 1;
+ int32_t middle = height >> 1;
FX_BOOL tryHarder = FALSE;
- FX_INT32 rowStep = FX_MAX(1, height >> (tryHarder ? 8 : 5));
- FX_INT32 maxLines;
+ int32_t rowStep = FX_MAX(1, height >> (tryHarder ? 8 : 5));
+ int32_t maxLines;
if (tryHarder) {
maxLines = height;
} else {
maxLines = 15;
}
- for (FX_INT32 x = 0; x < maxLines; x++) {
- FX_INT32 rowStepsAboveOrBelow = (x + 1) >> 1;
+ for (int32_t x = 0; x < maxLines; x++) {
+ int32_t rowStepsAboveOrBelow = (x + 1) >> 1;
FX_BOOL isAbove = (x & 0x01) == 0;
- FX_INT32 rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
+ int32_t rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
if (rowNumber < 0 || rowNumber >= height) {
break;
}
@@ -75,7 +75,7 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap *image, FX_INT32 hints, }
continue;
}
- for (FX_INT32 attempt = 0; attempt < 2; attempt++) {
+ for (int32_t attempt = 0; attempt < 2; attempt++) {
if (attempt == 1) {
row->Reverse();
}
@@ -98,20 +98,20 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap *image, FX_INT32 hints, e = BCExceptionNotFound;
return "";
}
-void CBC_OneDReader::RecordPattern(CBC_CommonBitArray *row, FX_INT32 start, CFX_Int32Array *counters, FX_INT32 &e)
+void CBC_OneDReader::RecordPattern(CBC_CommonBitArray *row, int32_t start, CFX_Int32Array *counters, int32_t &e)
{
- FX_INT32 numCounters = counters->GetSize();
- for (FX_INT32 i = 0; i < numCounters; i++) {
+ int32_t numCounters = counters->GetSize();
+ for (int32_t i = 0; i < numCounters; i++) {
(*counters)[i] = 0;
}
- FX_INT32 end = row->GetSize();
+ int32_t end = row->GetSize();
if (start >= end) {
e = BCExceptionNotFound;
return;
}
FX_BOOL isWhite = !row->Get(start);
- FX_INT32 counterPosition = 0;
- FX_INT32 j = start;
+ int32_t counterPosition = 0;
+ int32_t j = start;
while (j < end) {
FX_BOOL pixel = row->Get(j);
if (pixel ^ isWhite) {
@@ -132,9 +132,9 @@ void CBC_OneDReader::RecordPattern(CBC_CommonBitArray *row, FX_INT32 start, CFX_ return;
}
}
-void CBC_OneDReader::RecordPatternInReverse(CBC_CommonBitArray *row, FX_INT32 start, CFX_Int32Array *counters, FX_INT32 &e)
+void CBC_OneDReader::RecordPatternInReverse(CBC_CommonBitArray *row, int32_t start, CFX_Int32Array *counters, int32_t &e)
{
- FX_INT32 numTransitionsLeft = counters->GetSize();
+ int32_t numTransitionsLeft = counters->GetSize();
FX_BOOL last = row->Get(start);
while (start > 0 && numTransitionsLeft >= 0) {
if (row->Get(--start) != last) {
@@ -149,12 +149,12 @@ void CBC_OneDReader::RecordPatternInReverse(CBC_CommonBitArray *row, FX_INT32 st RecordPattern(row, start + 1, counters, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-FX_INT32 CBC_OneDReader::PatternMatchVariance(CFX_Int32Array *counters, const FX_INT32 *pattern, FX_INT32 maxIndividualVariance)
+int32_t CBC_OneDReader::PatternMatchVariance(CFX_Int32Array *counters, const int32_t *pattern, int32_t maxIndividualVariance)
{
- FX_INT32 numCounters = counters->GetSize();
- FX_INT32 total = 0;
- FX_INT32 patternLength = 0;
- for (FX_INT32 i = 0; i < numCounters; i++) {
+ int32_t numCounters = counters->GetSize();
+ int32_t total = 0;
+ int32_t patternLength = 0;
+ for (int32_t i = 0; i < numCounters; i++) {
total += (*counters)[i];
patternLength += pattern[i];
}
@@ -162,13 +162,13 @@ FX_INT32 CBC_OneDReader::PatternMatchVariance(CFX_Int32Array *counters, const FX #undef max
return FXSYS_IntMax;
}
- FX_INT32 unitBarWidth = (total << INTEGER_MATH_SHIFT) / patternLength;
+ int32_t unitBarWidth = (total << INTEGER_MATH_SHIFT) / patternLength;
maxIndividualVariance = (maxIndividualVariance * unitBarWidth) >> INTEGER_MATH_SHIFT;
- FX_INT32 totalVariance = 0;
- for (FX_INT32 x = 0; x < numCounters; x++) {
- FX_INT32 counter = (*counters)[x] << INTEGER_MATH_SHIFT;
- FX_INT32 scaledPattern = pattern[x] * unitBarWidth;
- FX_INT32 variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
+ int32_t totalVariance = 0;
+ for (int32_t x = 0; x < numCounters; x++) {
+ int32_t counter = (*counters)[x] << INTEGER_MATH_SHIFT;
+ int32_t scaledPattern = pattern[x] * unitBarWidth;
+ int32_t variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
if (variance > maxIndividualVariance) {
#undef max
return FXSYS_IntMax;
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.h b/xfa/src/fxbarcode/oned/BC_OneDReader.h index 8645c9edf9..064f5edae0 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDReader.h +++ b/xfa/src/fxbarcode/oned/BC_OneDReader.h @@ -15,20 +15,20 @@ class CBC_OneDReader : public CBC_Reader public:
CBC_OneDReader();
virtual ~CBC_OneDReader();
- virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e);
- virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e);
- virtual CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+ virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e);
+ virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e);
+ virtual CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
return "";
}
private:
- CFX_ByteString DeDecode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString DeDecode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e);
protected:
- const static FX_INT32 INTEGER_MATH_SHIFT;
- const static FX_INT32 PATTERN_MATCH_RESULT_SCALE_FACTOR;
- void RecordPattern(CBC_CommonBitArray *row, FX_INT32 start, CFX_Int32Array *counters, FX_INT32 &e);
- void RecordPatternInReverse(CBC_CommonBitArray *row, FX_INT32 start, CFX_Int32Array *counters, FX_INT32 &e);
- FX_INT32 PatternMatchVariance(CFX_Int32Array *counters, const FX_INT32 *pattern, FX_INT32 maxIndividualVariance);
+ const static int32_t INTEGER_MATH_SHIFT;
+ const static int32_t PATTERN_MATCH_RESULT_SCALE_FACTOR;
+ void RecordPattern(CBC_CommonBitArray *row, int32_t start, CFX_Int32Array *counters, int32_t &e);
+ void RecordPatternInReverse(CBC_CommonBitArray *row, int32_t start, CFX_Int32Array *counters, int32_t &e);
+ int32_t PatternMatchVariance(CFX_Int32Array *counters, const int32_t *pattern, int32_t maxIndividualVariance);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp index f1db94a6a1..a2dd7a1972 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp @@ -25,11 +25,11 @@ #include "../common/BC_CommonBitArray.h"
#include "BC_OneDReader.h"
#include "BC_OneDimReader.h"
-const FX_INT32 CBC_OneDimReader::MAX_AVG_VARIANCE = (FX_INT32)(256 * 0.48f);
-const FX_INT32 CBC_OneDimReader::MAX_INDIVIDUAL_VARIANCE = (FX_INT32)(256 * 0.7f);
-const FX_INT32 CBC_OneDimReader::START_END_PATTERN[3] = {1, 1, 1};
-const FX_INT32 CBC_OneDimReader::MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
-const FX_INT32 CBC_OneDimReader::L_PATTERNS[10][4] = {
+const int32_t CBC_OneDimReader::MAX_AVG_VARIANCE = (int32_t)(256 * 0.48f);
+const int32_t CBC_OneDimReader::MAX_INDIVIDUAL_VARIANCE = (int32_t)(256 * 0.7f);
+const int32_t CBC_OneDimReader::START_END_PATTERN[3] = {1, 1, 1};
+const int32_t CBC_OneDimReader::MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
+const int32_t CBC_OneDimReader::L_PATTERNS[10][4] = {
{3, 2, 1, 1},
{2, 2, 2, 1},
{2, 1, 2, 2},
@@ -41,7 +41,7 @@ const FX_INT32 CBC_OneDimReader::L_PATTERNS[10][4] = { {1, 2, 1, 3},
{3, 1, 1, 2}
};
-const FX_INT32 CBC_OneDimReader::L_AND_G_PATTERNS[20][4] = {
+const int32_t CBC_OneDimReader::L_AND_G_PATTERNS[20][4] = {
{3, 2, 1, 1},
{2, 2, 2, 1},
{2, 1, 2, 2},
@@ -69,7 +69,7 @@ CBC_OneDimReader::CBC_OneDimReader() CBC_OneDimReader::~CBC_OneDimReader()
{
}
-CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, FX_INT32 &e)
+CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, int32_t &e)
{
FX_BOOL foundStart = FALSE;
CFX_Int32Array *startRange = NULL;
@@ -78,7 +78,7 @@ CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, startEndPattern[0] = START_END_PATTERN[0];
startEndPattern[1] = START_END_PATTERN[1];
startEndPattern[2] = START_END_PATTERN[2];
- FX_INT32 nextStart = 0;
+ int32_t nextStart = 0;
while (!foundStart) {
if(startRange != NULL) {
delete startRange;
@@ -86,12 +86,12 @@ CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, }
startRange = FindGuardPattern(row, nextStart, FALSE, &startEndPattern, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 start = (*startRange)[0];
+ int32_t start = (*startRange)[0];
nextStart = (*startRange)[1];
if (start <= 1) {
break;
}
- FX_INT32 quietStart = start - (nextStart - start);
+ int32_t quietStart = start - (nextStart - start);
if (quietStart >= 0) {
FX_BOOL booT = row->IsRange(quietStart, start, FALSE, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -100,7 +100,7 @@ CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, }
return startRange;
}
-CFX_ByteString CBC_OneDimReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OneDimReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_Int32Array* StartPattern = FindStartGuardPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -109,10 +109,10 @@ CFX_ByteString CBC_OneDimReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArra BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-CFX_ByteString CBC_OneDimReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OneDimReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, int32_t hints, int32_t &e)
{
CFX_ByteString result;
- FX_INT32 endStart = DecodeMiddle(row, startGuardRange, result, e);
+ int32_t endStart = DecodeMiddle(row, startGuardRange, result, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
FX_BOOL b = CheckChecksum(result, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -122,21 +122,21 @@ CFX_ByteString CBC_OneDimReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArra }
return result;
}
-FX_BOOL CBC_OneDimReader::CheckChecksum(CFX_ByteString &s, FX_INT32 &e)
+FX_BOOL CBC_OneDimReader::CheckChecksum(CFX_ByteString &s, int32_t &e)
{
FX_BOOL temp = CheckStandardUPCEANChecksum(s, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return temp;
}
-FX_BOOL CBC_OneDimReader::CheckStandardUPCEANChecksum(CFX_ByteString &s, FX_INT32 &e)
+FX_BOOL CBC_OneDimReader::CheckStandardUPCEANChecksum(CFX_ByteString &s, int32_t &e)
{
- FX_INT32 length = s.GetLength();
+ int32_t length = s.GetLength();
if (length == 0) {
return FALSE;
}
- FX_INT32 sum = 0;
- for (FX_INT32 i = length - 2; i >= 0; i -= 2) {
- FX_INT32 digit = (FX_INT32) s[i] - (FX_INT32) '0';
+ int32_t sum = 0;
+ for (int32_t i = length - 2; i >= 0; i -= 2) {
+ int32_t digit = (int32_t) s[i] - (int32_t) '0';
if (digit < 0 || digit > 9) {
e = BCExceptionFormatException;
return FALSE;
@@ -144,8 +144,8 @@ FX_BOOL CBC_OneDimReader::CheckStandardUPCEANChecksum(CFX_ByteString &s, FX_INT3 sum += digit;
}
sum *= 3;
- for (FX_INT32 j = length - 1; j >= 0; j -= 2) {
- FX_INT32 digit = (FX_INT32) s[j] - (FX_INT32) '0';
+ for (int32_t j = length - 1; j >= 0; j -= 2) {
+ int32_t digit = (int32_t) s[j] - (int32_t) '0';
if (digit < 0 || digit > 9) {
e = BCExceptionFormatException;
return FALSE;
@@ -154,7 +154,7 @@ FX_BOOL CBC_OneDimReader::CheckStandardUPCEANChecksum(CFX_ByteString &s, FX_INT3 }
return sum % 10 == 0;
}
-CFX_Int32Array *CBC_OneDimReader::DecodeEnd(CBC_CommonBitArray* row, FX_INT32 endStart, FX_INT32 &e)
+CFX_Int32Array *CBC_OneDimReader::DecodeEnd(CBC_CommonBitArray* row, int32_t endStart, int32_t &e)
{
CFX_Int32Array startEndPattern;
startEndPattern.Add(START_END_PATTERN[0]);
@@ -164,12 +164,12 @@ CFX_Int32Array *CBC_OneDimReader::DecodeEnd(CBC_CommonBitArray* row, FX_INT32 en BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return FindGuard;
}
-CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, FX_INT32 rowOffset, FX_BOOL whiteFirst, CFX_Int32Array *pattern, FX_INT32 &e)
+CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, int32_t rowOffset, FX_BOOL whiteFirst, CFX_Int32Array *pattern, int32_t &e)
{
- FX_INT32 patternLength = pattern->GetSize();
+ int32_t patternLength = pattern->GetSize();
CFX_Int32Array counters;
counters.SetSize(patternLength);
- FX_INT32 width = row->GetSize();
+ int32_t width = row->GetSize();
FX_BOOL isWhite = FALSE;
while (rowOffset < width) {
isWhite = !row->Get(rowOffset);
@@ -178,9 +178,9 @@ CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, FX_I }
rowOffset++;
}
- FX_INT32 counterPosition = 0;
- FX_INT32 patternStart = rowOffset;
- for (FX_INT32 x = rowOffset; x < width; x++) {
+ int32_t counterPosition = 0;
+ int32_t patternStart = rowOffset;
+ for (int32_t x = rowOffset; x < width; x++) {
FX_BOOL pixel = row->Get(x);
if (pixel ^ isWhite) {
counters[counterPosition]++;
@@ -194,7 +194,7 @@ CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, FX_I return result;
}
patternStart += counters[0] + counters[1];
- for (FX_INT32 y = 2; y < patternLength; y++) {
+ for (int32_t y = 2; y < patternLength; y++) {
counters[y - 2] = counters[y];
}
counters[patternLength - 2] = 0;
@@ -211,15 +211,15 @@ CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, FX_I BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return NULL;
}
-FX_INT32 CBC_OneDimReader::DecodeDigit(CBC_CommonBitArray *row, CFX_Int32Array *counters, FX_INT32 rowOffset, const FX_INT32* patterns, FX_INT32 patternLength, FX_INT32 &e)
+int32_t CBC_OneDimReader::DecodeDigit(CBC_CommonBitArray *row, CFX_Int32Array *counters, int32_t rowOffset, const int32_t* patterns, int32_t patternLength, int32_t &e)
{
RecordPattern(row, rowOffset, counters, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- FX_INT32 bestVariance = MAX_AVG_VARIANCE;
- FX_INT32 bestMatch = -1;
- FX_INT32 max = patternLength;
- for (FX_INT32 i = 0; i < max; i++) {
- FX_INT32 variance = PatternMatchVariance(counters, &patterns[i * 4], MAX_INDIVIDUAL_VARIANCE);
+ int32_t bestVariance = MAX_AVG_VARIANCE;
+ int32_t bestMatch = -1;
+ int32_t max = patternLength;
+ for (int32_t i = 0; i < max; i++) {
+ int32_t variance = PatternMatchVariance(counters, &patterns[i * 4], MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = i;
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimReader.h b/xfa/src/fxbarcode/oned/BC_OneDimReader.h index bb10060ba3..2e644de841 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimReader.h +++ b/xfa/src/fxbarcode/oned/BC_OneDimReader.h @@ -12,28 +12,28 @@ class CBC_OneDimReader; class CBC_OneDimReader : public CBC_OneDReader
{
private:
- const static FX_INT32 MAX_AVG_VARIANCE;
- const static FX_INT32 MAX_INDIVIDUAL_VARIANCE;
+ const static int32_t MAX_AVG_VARIANCE;
+ const static int32_t MAX_INDIVIDUAL_VARIANCE;
- FX_BOOL CheckStandardUPCEANChecksum(CFX_ByteString &s, FX_INT32 &e);
+ FX_BOOL CheckStandardUPCEANChecksum(CFX_ByteString &s, int32_t &e);
public:
- const static FX_INT32 START_END_PATTERN[3];
- const static FX_INT32 MIDDLE_PATTERN[5];
- const static FX_INT32 L_PATTERNS[10][4];
- const static FX_INT32 L_AND_G_PATTERNS[20][4];
+ const static int32_t START_END_PATTERN[3];
+ const static int32_t MIDDLE_PATTERN[5];
+ const static int32_t L_PATTERNS[10][4];
+ const static int32_t L_AND_G_PATTERNS[20][4];
CBC_OneDimReader();
virtual ~CBC_OneDimReader();
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, int32_t hints, int32_t &e);
protected:
- CFX_Int32Array *FindStartGuardPattern(CBC_CommonBitArray *row, FX_INT32 &e);
- virtual FX_BOOL CheckChecksum(CFX_ByteString &s, FX_INT32 &e);
- CFX_Int32Array *FindGuardPattern(CBC_CommonBitArray *row, FX_INT32 rowOffset, FX_BOOL whiteFirst, CFX_Int32Array *pattern, FX_INT32 &e);
- FX_INT32 DecodeDigit(CBC_CommonBitArray *row, CFX_Int32Array *counters, FX_INT32 rowOffset, const FX_INT32* patterns, FX_INT32 patternLength, FX_INT32 &e);
- virtual FX_INT32 DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultResult, FX_INT32 &e)
+ CFX_Int32Array *FindStartGuardPattern(CBC_CommonBitArray *row, int32_t &e);
+ virtual FX_BOOL CheckChecksum(CFX_ByteString &s, int32_t &e);
+ CFX_Int32Array *FindGuardPattern(CBC_CommonBitArray *row, int32_t rowOffset, FX_BOOL whiteFirst, CFX_Int32Array *pattern, int32_t &e);
+ int32_t DecodeDigit(CBC_CommonBitArray *row, CFX_Int32Array *counters, int32_t rowOffset, const int32_t* patterns, int32_t patternLength, int32_t &e);
+ virtual int32_t DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultResult, int32_t &e)
{
return 0;
}
- virtual CFX_Int32Array *DecodeEnd(CBC_CommonBitArray *row, FX_INT32 endStart, FX_INT32 &e);
+ virtual CFX_Int32Array *DecodeEnd(CBC_CommonBitArray *row, int32_t endStart, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp index 25f3fa5f6c..a1554a8047 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp @@ -50,11 +50,11 @@ void CBC_OneDimWriter::SetPrintChecksum(FX_BOOL checksum) {
m_bPrintChecksum = checksum;
}
-void CBC_OneDimWriter::SetDataLength(FX_INT32 length)
+void CBC_OneDimWriter::SetDataLength(int32_t length)
{
m_iDataLenth = length;
}
-void CBC_OneDimWriter::SetCalcChecksum(FX_INT32 state)
+void CBC_OneDimWriter::SetCalcChecksum(int32_t state)
{
m_bCalcChecksum = state;
}
@@ -70,7 +70,7 @@ void CBC_OneDimWriter::SetFontSize(FX_FLOAT size) {
m_fFontSize = size;
}
-void CBC_OneDimWriter::SetFontStyle(FX_INT32 style)
+void CBC_OneDimWriter::SetFontStyle(int32_t style)
{
m_iFontStyle = style;
}
@@ -85,10 +85,10 @@ FX_WCHAR CBC_OneDimWriter::Upper(FX_WCHAR ch) }
return ch;
}
-FX_BYTE* CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
- FX_BYTE *ret = NULL;
+ uint8_t *ret = NULL;
outHeight = 1;
if (m_Width >= 20) {
ret = Encode(contents, outWidth, e);
@@ -98,23 +98,23 @@ FX_BYTE* CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT forma BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_INT32 CBC_OneDimWriter::AppendPattern(FX_BYTE* target, FX_INT32 pos, const FX_INT32* pattern , FX_INT32 patternLength, FX_INT32 startColor, FX_INT32 &e)
+int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, int32_t pos, const int32_t* pattern , int32_t patternLength, int32_t startColor, int32_t &e)
{
if (startColor != 0 && startColor != 1) {
e = BCExceptionValueMustBeEither0or1;
return 0;
}
- FX_BYTE color = (FX_BYTE) startColor;
- FX_INT32 numAdded = 0;
- for (FX_INT32 i = 0; i < patternLength; i++) {
- for (FX_INT32 j = 0; j < pattern[i]; j++) {
+ uint8_t color = (uint8_t) startColor;
+ int32_t numAdded = 0;
+ for (int32_t i = 0; i < patternLength; i++) {
+ for (int32_t j = 0; j < pattern[i]; j++) {
target[pos] = color;
pos += 1;
numAdded += 1;
@@ -123,20 +123,20 @@ FX_INT32 CBC_OneDimWriter::AppendPattern(FX_BYTE* target, FX_INT32 pos, const FX }
return numAdded;
}
-void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS *charPos, CFX_Font *cFont, FX_FLOAT geWidth, FX_INT32 fontSize, FX_FLOAT &charsLen)
+void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS *charPos, CFX_Font *cFont, FX_FLOAT geWidth, int32_t fontSize, FX_FLOAT &charsLen)
{
#ifdef FXFM_ENCODING_NONE
IFX_FontEncodingEx* encoding = FX_CreateFontEncodingEx(cFont);
#else
IFX_FontEncoding * encoding = FXGE_CreateUnicodeEncoding(cFont);
#endif
- FX_INT32 length = text.GetLength();
+ int32_t length = text.GetLength();
FX_DWORD *pCharCode = FX_Alloc(FX_DWORD, text.GetLength());
FX_FLOAT charWidth = 0;
- for (FX_INT32 j = 0; j < text.GetLength(); j++) {
+ for (int32_t j = 0; j < text.GetLength(); j++) {
pCharCode[j] = encoding->CharCodeFromUnicode(text[j]);
- FX_INT32 glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
- FX_INT32 glyp_value = cFont->GetGlyphWidth(glyp_code);
+ int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
+ int32_t glyp_value = cFont->GetGlyphWidth(glyp_code);
FX_FLOAT temp = (FX_FLOAT)((glyp_value) * fontSize / 1000.0);
charWidth += temp;
}
@@ -157,7 +157,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS * charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
#endif
penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
- for (FX_INT32 i = 1; i < length; i++) {
+ for (int32_t i = 1; i < length; i++) {
charPos[i].m_OriginX = penX + left;
charPos[i].m_OriginY = penY + top;
charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]);
@@ -171,10 +171,10 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS * delete encoding;
encoding = NULL;
}
-void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matrix* matrix, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, FX_INT32 barWidth)
+void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matrix* matrix, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, int32_t barWidth)
{
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth), (FX_FLOAT)(locY + iTextHeight));
if (geWidth != m_Width) {
rect.right -= 1;
@@ -194,10 +194,10 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matri (CFX_AffineMatrix *) &affine_matrix,
m_fontColor, FXTEXT_CLEARTYPE);
}
-void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, FX_INT32 barWidth)
+void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, int32_t barWidth)
{
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
CFX_FxgeDevice ge;
ge.Create((int)geWidth, iTextHeight , m_colorSpace);
FX_RECT geRect(0, 0, (int)geWidth, iTextHeight);
@@ -214,7 +214,7 @@ void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteS geBitmap.Attach(pOutBitmap);
geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY);
}
-void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice *device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice *device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
@@ -225,7 +225,7 @@ void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX return;
}
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLen = str.GetLength();
+ int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
if (!pCharPos) {
return;
@@ -240,17 +240,17 @@ void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX m_locTextLoc == BC_TEXT_LOC_BELOW ) {
geWidth = (FX_FLOAT)barWidth;
}
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
CalcTextInfo(str, pCharPos, m_pFont, geWidth, iFontSize, charsLen);
if (charsLen < 1) {
return;
}
- FX_INT32 locX = 0;
- FX_INT32 locY = 0;
+ int32_t locX = 0;
+ int32_t locY = 0;
switch (m_locTextLoc) {
case BC_TEXT_LOC_ABOVEEMBED:
- locX = (FX_INT32)(barWidth - charsLen) / 2;
+ locX = (int32_t)(barWidth - charsLen) / 2;
locY = 0;
geWidth = charsLen;
break;
@@ -260,7 +260,7 @@ void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX geWidth = (FX_FLOAT)barWidth;
break;
case BC_TEXT_LOC_BELOWEMBED:
- locX = (FX_INT32)(barWidth - charsLen) / 2;
+ locX = (int32_t)(barWidth - charsLen) / 2;
locY = m_Height - iTextHeight;
geWidth = charsLen;
break;
@@ -278,7 +278,7 @@ void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX }
FX_Free(pCharPos);
}
-void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR contents, FX_INT32 &e)
+void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR contents, int32_t &e)
{
if (m_output == NULL) {
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -289,14 +289,14 @@ void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR con e = BCExceptionFailToCreateBitmap;
return;
}
- for (FX_INT32 x = 0; x < m_output->GetWidth(); x++) {
- for (FX_INT32 y = 0; y < m_output->GetHeight(); y++) {
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
if (m_output->Get(x, y)) {
pOutBitmap->SetPixel(x, y, m_barColor);
}
}
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for (; i < contents.GetLength(); i++)
if (contents.GetAt(i) != ' ') {
break;
@@ -311,7 +311,7 @@ void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR con }
pOutBitmap = pStretchBitmap;
}
-void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_WSTR contents, FX_INT32 &e)
+void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_WSTR contents, int32_t &e)
{
if (m_output == NULL) {
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -322,8 +322,8 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma device->DrawPath(&path, matrix, &stateData, m_backgroundColor, m_backgroundColor, FXFILL_ALTERNATE);
CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (FX_FLOAT)m_Height, 0.0, 0.0);
matri.Concat(*matrix);
- for (FX_INT32 x = 0; x < m_output->GetWidth(); x++) {
- for (FX_INT32 y = 0; y < m_output->GetHeight(); y++) {
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
CFX_PathData rect;
rect.AppendRect((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)(x + 1), (FX_FLOAT)(y + 1));
CFX_GraphStateData stateData;
@@ -332,7 +332,7 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma }
}
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for (; i < contents.GetLength(); i++)
if (contents.GetAt(i) != ' ') {
break;
@@ -342,7 +342,7 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OneDimWriter::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
if (codeLength < 1) {
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -350,9 +350,9 @@ void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 co if (m_ModuleHeight < 20.0) {
m_ModuleHeight = 20;
}
- FX_INT32 codeOldLength = codeLength;
- FX_INT32 leftPadding = 0;
- FX_INT32 rightPadding = 0;
+ int32_t codeOldLength = codeLength;
+ int32_t leftPadding = 0;
+ int32_t rightPadding = 0;
if (m_bLeftPadding) {
leftPadding = 7;
}
@@ -377,9 +377,9 @@ void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 co }
m_multiple = 1;
if (!isDevice) {
- m_multiple = (FX_INT32)ceil(m_outputHScale * dataLengthScale);
+ m_multiple = (int32_t)ceil(m_outputHScale * dataLengthScale);
}
- FX_INT32 outputHeight = 1;
+ int32_t outputHeight = 1;
if (!isDevice) {
if (m_Height == 0) {
outputHeight = FX_MAX(20, m_ModuleHeight);
@@ -387,9 +387,9 @@ void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 co outputHeight = m_Height;
}
}
- FX_INT32 outputWidth = codeLength;
+ int32_t outputWidth = codeLength;
if (!isDevice) {
- outputWidth = (FX_INT32)(codeLength * m_multiple / dataLengthScale);
+ outputWidth = (int32_t)(codeLength * m_multiple / dataLengthScale);
}
m_barWidth = m_Width;
if (!isDevice) {
@@ -397,8 +397,8 @@ void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 co }
m_output = FX_NEW CBC_CommonBitMatrix;
m_output->Init(outputWidth, outputHeight);
- FX_INT32 outputX = leftPadding * m_multiple;
- for (FX_INT32 inputX = 0; inputX < codeOldLength; inputX++) {
+ int32_t outputX = leftPadding * m_multiple;
+ for (int32_t inputX = 0; inputX < codeOldLength; inputX++) {
if (code[inputX] == 1) {
if (outputX >= outputWidth ) {
break;
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.h b/xfa/src/fxbarcode/oned/BC_OneDimWriter.h index cd5d937aca..aeb19e0081 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.h @@ -14,17 +14,17 @@ class CBC_OneDimWriter : public CBC_Writer public:
CBC_OneDimWriter();
virtual ~CBC_OneDimWriter();
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- virtual FX_BYTE *Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e)
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ virtual uint8_t *Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e)
{
return NULL;
};
- virtual void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
- virtual void RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR contents, FX_INT32 &e);
- virtual void RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_WSTR contents, FX_INT32 &e);
+ virtual void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
+ virtual void RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR contents, int32_t &e);
+ virtual void RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_WSTR contents, int32_t &e);
virtual FX_BOOL CheckContentValidity(FX_WSTR contents)
{
return TRUE;
@@ -38,33 +38,33 @@ public: return CFX_WideString();
}
virtual void SetPrintChecksum(FX_BOOL checksum);
- virtual void SetDataLength(FX_INT32 length);
- virtual void SetCalcChecksum(FX_INT32 state);
+ virtual void SetDataLength(int32_t length);
+ virtual void SetCalcChecksum(int32_t state);
virtual void SetFontSize(FX_FLOAT size);
- virtual void SetFontStyle(FX_INT32 style);
+ virtual void SetFontStyle(int32_t style);
virtual void SetFontColor(FX_ARGB color);
virtual FX_BOOL SetFont(CFX_Font * cFont);
protected:
FX_BOOL m_bPrintChecksum;
- FX_INT32 m_iDataLenth;
+ int32_t m_iDataLenth;
FX_BOOL m_bCalcChecksum;
CFX_Font* m_pFont;
FX_FLOAT m_fFontSize;
- FX_INT32 m_iFontStyle;
+ int32_t m_iFontStyle;
FX_DWORD m_fontColor;
BC_TEXT_LOC m_locTextLoc;
- FX_INT32 m_iContentLen;
+ int32_t m_iContentLen;
FX_BOOL m_bLeftPadding;
FX_BOOL m_bRightPadding;
CBC_CommonBitMatrix* m_output;
- FX_INT32 m_barWidth;
- FX_INT32 m_multiple;
+ int32_t m_barWidth;
+ int32_t m_multiple;
FX_FLOAT m_outputHScale;
- void CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS *charPos, CFX_Font *cFont, FX_FLOAT geWidth, FX_INT32 fontSize, FX_FLOAT &charsLen);
- virtual void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice *device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e);
- virtual void ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, FX_INT32 barWidth);
- virtual void ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matrix* matrix, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, FX_INT32 barWidth);
- FX_INT32 AppendPattern(FX_BYTE* target, FX_INT32 pos, const FX_INT32* pattern, FX_INT32 patternLength, FX_INT32 startColor, FX_INT32 &e);
+ void CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS *charPos, CFX_Font *cFont, FX_FLOAT geWidth, int32_t fontSize, FX_FLOAT &charsLen);
+ virtual void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice *device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e);
+ virtual void ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, int32_t barWidth);
+ virtual void ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matrix* matrix, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, int32_t barWidth);
+ int32_t AppendPattern(uint8_t* target, int32_t pos, const int32_t* pattern, int32_t patternLength, int32_t startColor, int32_t &e);
FX_WCHAR Upper(FX_WCHAR ch);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp index 5d94d7ac06..ca115391ef 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp @@ -27,12 +27,12 @@ #include "../oned/BC_OnedCode39Reader.h"
#include "../oned/BC_OnedCodaBarReader.h"
FX_LPCSTR CBC_OnedCodaBarReader::ALPHABET_STRING = "0123456789-$:/.+ABCDTN";
-const FX_INT32 CBC_OnedCodaBarReader::CHARACTER_ENCODINGS[22] = {
+const int32_t CBC_OnedCodaBarReader::CHARACTER_ENCODINGS[22] = {
0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048,
0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E,
0x01A, 0x029
};
-const FX_INT32 CBC_OnedCodaBarReader::minCharacterLength = 3;
+const int32_t CBC_OnedCodaBarReader::minCharacterLength = 3;
const FX_CHAR CBC_OnedCodaBarReader::STARTEND_ENCODING[8] = {'E', '*', 'A', 'B', 'C', 'D', 'T', 'N'};
CBC_OnedCodaBarReader::CBC_OnedCodaBarReader()
{
@@ -40,14 +40,14 @@ CBC_OnedCodaBarReader::CBC_OnedCodaBarReader() CBC_OnedCodaBarReader::~CBC_OnedCodaBarReader()
{
}
-CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_Int32Array *int32Ptr = FindAsteriskPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
CBC_AutoPtr<CFX_Int32Array> start(int32Ptr);
(*start)[1] = 0;
- FX_INT32 nextStart = (*start)[1];
- FX_INT32 end = row->GetSize();
+ int32_t nextStart = (*start)[1];
+ int32_t end = row->GetSize();
while (nextStart < end && !row->Get(nextStart)) {
nextStart++;
}
@@ -55,7 +55,7 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi CFX_Int32Array counters;
counters.SetSize(7);
FX_CHAR decodedChar;
- FX_INT32 lastStart;
+ int32_t lastStart;
do {
RecordPattern(row, nextStart, &counters, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -66,18 +66,18 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi }
result += decodedChar;
lastStart = nextStart;
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
nextStart += counters[i];
}
while (nextStart < end && !row->Get(nextStart)) {
nextStart++;
}
} while (nextStart < end);
- FX_INT32 lastPatternSize = 0;
- for (FX_INT32 j = 0; j < counters.GetSize(); j++) {
+ int32_t lastPatternSize = 0;
+ for (int32_t j = 0; j < counters.GetSize(); j++) {
lastPatternSize += counters[j];
}
- FX_INT32 whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
+ int32_t whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
if (nextStart != end && (whiteSpaceAfterEnd / 2 < lastPatternSize)) {
e = BCExceptionNotFound;
return "";
@@ -91,9 +91,9 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi e = BCExceptionNotFound;
return "";
}
- FX_INT32 len = result.GetLength();
+ int32_t len = result.GetLength();
CFX_ByteString temp = result;
- for (FX_INT32 k = 1; k < result.GetLength(); k++) {
+ for (int32_t k = 1; k < result.GetLength(); k++) {
if (ArrayContains(STARTEND_ENCODING, result[k])) {
if ((k + 1) != result.GetLength()) {
result.Delete(1, k);
@@ -102,7 +102,7 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi }
}
if (result.GetLength() < 5) {
- FX_INT32 index = temp.Find(result.Mid(1, result.GetLength() - 1));
+ int32_t index = temp.Find(result.Mid(1, result.GetLength() - 1));
if (index == len - (result.GetLength() - 1)) {
e = BCExceptionNotFound;
return "";
@@ -116,23 +116,23 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi }
return result;
}
-CFX_Int32Array *CBC_OnedCodaBarReader::FindAsteriskPattern(CBC_CommonBitArray *row, FX_INT32 &e)
+CFX_Int32Array *CBC_OnedCodaBarReader::FindAsteriskPattern(CBC_CommonBitArray *row, int32_t &e)
{
- FX_INT32 width = row->GetSize();
- FX_INT32 rowOffset = 0;
+ int32_t width = row->GetSize();
+ int32_t rowOffset = 0;
while (rowOffset < width) {
if (row->Get(rowOffset)) {
break;
}
rowOffset++;
}
- FX_INT32 counterPosition = 0;
+ int32_t counterPosition = 0;
CFX_Int32Array counters;
counters.SetSize(7);
- FX_INT32 patternStart = rowOffset;
+ int32_t patternStart = rowOffset;
FX_BOOL isWhite = FALSE;
- FX_INT32 patternLength = counters.GetSize();
- for (FX_INT32 i = rowOffset; i < width; i++) {
+ int32_t patternLength = counters.GetSize();
+ for (int32_t i = rowOffset; i < width; i++) {
FX_BOOL pixel = row->Get(i);
if (pixel ^ isWhite) {
counters[counterPosition]++;
@@ -150,7 +150,7 @@ CFX_Int32Array *CBC_OnedCodaBarReader::FindAsteriskPattern(CBC_CommonBitArray *r }
}
patternStart += counters[0] + counters[1];
- for (FX_INT32 y = 2; y < patternLength; y++) {
+ for (int32_t y = 2; y < patternLength; y++) {
counters[y - 2] = counters[y];
}
counters[patternLength - 2] = 0;
@@ -168,7 +168,7 @@ CFX_Int32Array *CBC_OnedCodaBarReader::FindAsteriskPattern(CBC_CommonBitArray *r }
FX_BOOL CBC_OnedCodaBarReader::ArrayContains(const FX_CHAR array[], FX_CHAR key)
{
- for(FX_INT32 i = 0; i < 8; i++) {
+ for(int32_t i = 0; i < 8; i++) {
if(array[i] == key) {
return TRUE;
}
@@ -177,26 +177,26 @@ FX_BOOL CBC_OnedCodaBarReader::ArrayContains(const FX_CHAR array[], FX_CHAR key) }
FX_CHAR CBC_OnedCodaBarReader::ToNarrowWidePattern(CFX_Int32Array *counter)
{
- FX_INT32 numCounters = counter->GetSize();
+ int32_t numCounters = counter->GetSize();
if (numCounters < 1) {
return '!';
}
- FX_INT32 averageCounter = 0;
- FX_INT32 totalCounters = 0;
- for (FX_INT32 i = 0; i < numCounters; i++) {
+ int32_t averageCounter = 0;
+ int32_t totalCounters = 0;
+ for (int32_t i = 0; i < numCounters; i++) {
totalCounters += (*counter)[i];
}
averageCounter = totalCounters / numCounters;
- FX_INT32 pattern = 0;
- FX_INT32 wideCounters = 0;
- for (FX_INT32 j = 0; j < numCounters; j++) {
+ int32_t pattern = 0;
+ int32_t wideCounters = 0;
+ for (int32_t j = 0; j < numCounters; j++) {
if ((*counter)[j] > averageCounter) {
pattern |= 1 << (numCounters - 1 - j);
wideCounters++;
}
}
if ((wideCounters == 2) || (wideCounters == 3)) {
- for (FX_INT32 k = 0; k < 22; k++) {
+ for (int32_t k = 0; k < 22; k++) {
if (CHARACTER_ENCODINGS[k] == pattern) {
return (ALPHABET_STRING)[k];
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h index 1d03491841..18aab8ba8d 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h @@ -14,16 +14,16 @@ class CBC_OnedCodaBarReader : public CBC_OneDReader public:
CBC_OnedCodaBarReader();
virtual ~CBC_OnedCodaBarReader();
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
- CFX_Int32Array *FindAsteriskPattern(CBC_CommonBitArray *row, FX_INT32 &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
+ CFX_Int32Array *FindAsteriskPattern(CBC_CommonBitArray *row, int32_t &e);
FX_BOOL ArrayContains(const FX_CHAR array[], FX_CHAR key);
FX_CHAR ToNarrowWidePattern(CFX_Int32Array *counter);
static FX_LPCSTR ALPHABET_STRING;
- const static FX_INT32 CHARACTER_ENCODINGS[22];
+ const static int32_t CHARACTER_ENCODINGS[22];
- const static FX_INT32 minCharacterLength;
+ const static int32_t minCharacterLength;
const static FX_CHAR STARTEND_ENCODING[8];
};
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 059d2d7df5..0049a54f7c 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -42,7 +42,7 @@ CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() }
FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start)
{
- for (FX_INT32 i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) {
+ for (int32_t i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) {
if (START_END_CHARS[i] == start) {
m_chStart = start;
return TRUE;
@@ -52,7 +52,7 @@ FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) }
FX_BOOL CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end)
{
- for (FX_INT32 i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) {
+ for (int32_t i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) {
if (START_END_CHARS[i] == end) {
m_chEnd = end;
return TRUE;
@@ -60,7 +60,7 @@ FX_BOOL CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) }
return FALSE;
}
-void CBC_OnedCodaBarWriter::SetDataLength(FX_INT32 length)
+void CBC_OnedCodaBarWriter::SetDataLength(int32_t length)
{
m_iDataLenth = length + 2;
}
@@ -72,7 +72,7 @@ FX_BOOL CBC_OnedCodaBarWriter::SetTextLocation(BC_TEXT_LOC location) m_locTextLoc = location;
return TRUE;
}
-FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(FX_INT32 ratio)
+FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio)
{
if(ratio < 2 || ratio > 3) {
return FALSE;
@@ -83,19 +83,19 @@ FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(FX_INT32 ratio) FX_BOOL CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, FX_BOOL isContent)
{
if(isContent) {
- for(FX_INT32 i = 0 ; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR) ; i++) {
+ for(int32_t i = 0 ; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR) ; i++) {
if(ch == (FX_WCHAR)CONTENT_CHARS[i]) {
return TRUE;
}
}
- for(FX_INT32 j = 0 ; j < sizeof(START_END_CHARS) / sizeof(FX_CHAR) ; j++) {
+ for(int32_t j = 0 ; j < sizeof(START_END_CHARS) / sizeof(FX_CHAR) ; j++) {
if(ch == (FX_WCHAR)START_END_CHARS[j]) {
return TRUE;
}
}
return FALSE;
} else {
- for(FX_INT32 i = 0 ; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR) ; i++) {
+ for(int32_t i = 0 ; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR) ; i++) {
if(ch == (FX_WCHAR)CONTENT_CHARS[i]) {
return TRUE;
}
@@ -106,7 +106,7 @@ FX_BOOL CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, FX_BOOL isContent) FX_BOOL CBC_OnedCodaBarWriter::CheckContentValidity(FX_WSTR contents)
{
FX_WCHAR ch;
- FX_INT32 index = 0;
+ int32_t index = 0;
for (index = 0; index < contents.GetLength(); index++) {
ch = contents.GetAt(index);
if (FindChar(ch, FALSE)) {
@@ -121,7 +121,7 @@ CFX_WideString CBC_OnedCodaBarWriter::FilterContents(FX_WSTR contents) {
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 index = 0; index < contents.GetLength(); index ++) {
+ for (int32_t index = 0; index < contents.GetLength(); index ++) {
ch = contents.GetAt(index);
if(ch > 175) {
index++;
@@ -135,31 +135,31 @@ CFX_WideString CBC_OnedCodaBarWriter::FilterContents(FX_WSTR contents) }
return filtercontents;
}
-FX_BYTE *CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0 , e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0 , e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if(format != BCFORMAT_CODABAR) {
e = BCExceptionOnlyEncodeCODEBAR;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e)
+uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e)
{
CBC_OnedCodaBarReader CodaBarR;
CFX_ByteString data = m_chStart + contents + m_chEnd;
m_iContentLen = data.GetLength();
- FX_BYTE *result = FX_Alloc(FX_BYTE, m_iWideNarrRatio * 7 * data.GetLength());
+ uint8_t *result = FX_Alloc(uint8_t, m_iWideNarrRatio * 7 * data.GetLength());
FX_CHAR ch;
- FX_INT32 position = 0;
- for (FX_INT32 index = 0; index < data.GetLength(); index++) {
+ int32_t position = 0;
+ for (int32_t index = 0; index < data.GetLength(); index++) {
ch = data.GetAt(index);
if (((ch >= 'a') && (ch <= 'z'))) {
ch = ch - 32;
@@ -180,17 +180,17 @@ FX_BYTE* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, FX_INT32 default:
break;
}
- FX_INT32 code = 0;
- FX_INT32 len = (FX_INT32)strlen(CodaBarR.ALPHABET_STRING);
- for (FX_INT32 i = 0; i < len; i++) {
+ int32_t code = 0;
+ int32_t len = (int32_t)strlen(CodaBarR.ALPHABET_STRING);
+ for (int32_t i = 0; i < len; i++) {
if (ch == CodaBarR.ALPHABET_STRING[i]) {
code = CodaBarR.CHARACTER_ENCODINGS[i];
break;
}
}
- FX_BYTE color = 1;
- FX_INT32 counter = 0;
- FX_INT32 bit = 0;
+ uint8_t color = 1;
+ int32_t counter = 0;
+ int32_t bit = 0;
while (bit < 7) {
result[position] = color;
position++;
@@ -216,7 +216,7 @@ CFX_WideString CBC_OnedCodaBarWriter::encodedContents(FX_WSTR contents) CFX_WideString strEnd(m_chEnd);
return strStart + contents + strEnd;
}
-void CBC_OnedCodaBarWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedCodaBarWriter::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(encodedContents(contents), code, codeLength, isDevice, e);
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h index b81839ca4a..c5c54b849f 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h @@ -14,25 +14,25 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter public:
CBC_OnedCodaBarWriter();
virtual ~CBC_OnedCodaBarWriter();
- FX_BYTE* Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
+ uint8_t* Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
CFX_WideString encodedContents(FX_WSTR contents);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
FX_BOOL SetStartChar(FX_CHAR start);
FX_BOOL SetEndChar(FX_CHAR end);
- void SetDataLength(FX_INT32 length);
+ void SetDataLength(int32_t length);
FX_BOOL SetTextLocation(BC_TEXT_LOC location);
- FX_BOOL SetWideNarrowRatio(FX_INT32 ratio);
+ FX_BOOL SetWideNarrowRatio(int32_t ratio);
FX_BOOL FindChar(FX_WCHAR ch, FX_BOOL isContent);
private:
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
const static FX_CHAR START_END_CHARS[];
const static FX_CHAR CONTENT_CHARS[];
FX_CHAR m_chStart;
FX_CHAR m_chEnd;
- FX_INT32 m_iWideNarrRatio;
+ int32_t m_iWideNarrRatio;
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp index 9dd9f629cf..d1f453345b 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp @@ -25,7 +25,7 @@ #include "../common/BC_CommonBitArray.h"
#include "BC_OneDReader.h"
#include "BC_OnedCode128Reader.h"
-const FX_INT32 CBC_OnedCode128Reader::CODE_PATTERNS[107][7] = {
+const int32_t CBC_OnedCode128Reader::CODE_PATTERNS[107][7] = {
{2, 1, 2, 2, 2, 2, 0},
{2, 2, 2, 1, 2, 2, 0},
{2, 2, 2, 2, 2, 1, 0},
@@ -134,53 +134,53 @@ const FX_INT32 CBC_OnedCode128Reader::CODE_PATTERNS[107][7] = { {2, 1, 1, 2, 3, 2, 0},
{2, 3, 3, 1, 1, 1, 2}
};
-const FX_INT32 CBC_OnedCode128Reader::MAX_AVG_VARIANCE = (FX_INT32) (256 * 0.25f);
-const FX_INT32 CBC_OnedCode128Reader::MAX_INDIVIDUAL_VARIANCE = (FX_INT32) (256 * 0.7f);
-const FX_INT32 CBC_OnedCode128Reader::CODE_SHIFT = 98;
-const FX_INT32 CBC_OnedCode128Reader::CODE_CODE_C = 99;
-const FX_INT32 CBC_OnedCode128Reader::CODE_CODE_B = 100;
-const FX_INT32 CBC_OnedCode128Reader::CODE_CODE_A = 101;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_1 = 102;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_2 = 97;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_3 = 96;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_4_A = 101;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_4_B = 100;
-const FX_INT32 CBC_OnedCode128Reader::CODE_START_A = 103;
-const FX_INT32 CBC_OnedCode128Reader::CODE_START_B = 104;
-const FX_INT32 CBC_OnedCode128Reader::CODE_START_C = 105;
-const FX_INT32 CBC_OnedCode128Reader::CODE_STOP = 106;
+const int32_t CBC_OnedCode128Reader::MAX_AVG_VARIANCE = (int32_t) (256 * 0.25f);
+const int32_t CBC_OnedCode128Reader::MAX_INDIVIDUAL_VARIANCE = (int32_t) (256 * 0.7f);
+const int32_t CBC_OnedCode128Reader::CODE_SHIFT = 98;
+const int32_t CBC_OnedCode128Reader::CODE_CODE_C = 99;
+const int32_t CBC_OnedCode128Reader::CODE_CODE_B = 100;
+const int32_t CBC_OnedCode128Reader::CODE_CODE_A = 101;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_1 = 102;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_2 = 97;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_3 = 96;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_4_A = 101;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_4_B = 100;
+const int32_t CBC_OnedCode128Reader::CODE_START_A = 103;
+const int32_t CBC_OnedCode128Reader::CODE_START_B = 104;
+const int32_t CBC_OnedCode128Reader::CODE_START_C = 105;
+const int32_t CBC_OnedCode128Reader::CODE_STOP = 106;
CBC_OnedCode128Reader::CBC_OnedCode128Reader()
{
}
CBC_OnedCode128Reader::~CBC_OnedCode128Reader()
{
}
-CFX_Int32Array *CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray *row, FX_INT32 &e)
+CFX_Int32Array *CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray *row, int32_t &e)
{
- FX_INT32 width = row->GetSize();
- FX_INT32 rowOffset = 0;
+ int32_t width = row->GetSize();
+ int32_t rowOffset = 0;
while (rowOffset < width) {
if (row->Get(rowOffset)) {
break;
}
rowOffset++;
}
- FX_INT32 counterPosition = 0;
+ int32_t counterPosition = 0;
CFX_Int32Array counters;
counters.SetSize(6);
- FX_INT32 patternStart = rowOffset;
+ int32_t patternStart = rowOffset;
FX_BOOL isWhite = FALSE;
- FX_INT32 patternLength = counters.GetSize();
- for (FX_INT32 i = rowOffset; i < width; i++) {
+ int32_t patternLength = counters.GetSize();
+ for (int32_t i = rowOffset; i < width; i++) {
FX_BOOL pixel = row->Get(i);
if (pixel ^ isWhite) {
counters[counterPosition]++;
} else {
if (counterPosition == patternLength - 1) {
- FX_INT32 bestVariance = MAX_AVG_VARIANCE;
- FX_INT32 bestMatch = -1;
- for (FX_INT32 startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
- FX_INT32 variance = PatternMatchVariance(&counters, &CODE_PATTERNS[startCode][0], MAX_INDIVIDUAL_VARIANCE);
+ int32_t bestVariance = MAX_AVG_VARIANCE;
+ int32_t bestMatch = -1;
+ for (int32_t startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
+ int32_t variance = PatternMatchVariance(&counters, &CODE_PATTERNS[startCode][0], MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = startCode;
@@ -199,7 +199,7 @@ CFX_Int32Array *CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray *row, }
}
patternStart += counters[0] + counters[1];
- for (FX_INT32 y = 2; y < patternLength; y++) {
+ for (int32_t y = 2; y < patternLength; y++) {
counters[y - 2] = counters[y];
}
counters[patternLength - 2] = 0;
@@ -215,14 +215,14 @@ CFX_Int32Array *CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray *row, e = BCExceptionNotFound;
return NULL;
}
-FX_INT32 CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray *row, CFX_Int32Array *counters, FX_INT32 rowOffset, FX_INT32 &e)
+int32_t CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray *row, CFX_Int32Array *counters, int32_t rowOffset, int32_t &e)
{
RecordPattern(row, rowOffset, counters, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- FX_INT32 bestVariance = MAX_AVG_VARIANCE;
- FX_INT32 bestMatch = -1;
- for (FX_INT32 d = 0; d < 107; d++) {
- FX_INT32 variance = PatternMatchVariance(counters, &CODE_PATTERNS[d][0], MAX_INDIVIDUAL_VARIANCE);
+ int32_t bestVariance = MAX_AVG_VARIANCE;
+ int32_t bestMatch = -1;
+ for (int32_t d = 0; d < 107; d++) {
+ int32_t variance = PatternMatchVariance(counters, &CODE_PATTERNS[d][0], MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = d;
@@ -236,12 +236,12 @@ FX_INT32 CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray *row, CFX_Int32Arr }
return 0;
}
-CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_Int32Array *startPatternInfo = FindStartPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
- FX_INT32 startCode = (*startPatternInfo)[2];
- FX_INT32 codeSet;
+ int32_t startCode = (*startPatternInfo)[2];
+ int32_t codeSet;
switch (startCode) {
case 103:
codeSet = CODE_CODE_A;
@@ -264,8 +264,8 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi FX_BOOL done = FALSE;
FX_BOOL isNextShifted = FALSE;
CFX_ByteString result;
- FX_INT32 lastStart = (*startPatternInfo)[0];
- FX_INT32 nextStart = (*startPatternInfo)[1];
+ int32_t lastStart = (*startPatternInfo)[0];
+ int32_t nextStart = (*startPatternInfo)[1];
if(startPatternInfo != NULL) {
startPatternInfo->RemoveAll();
delete startPatternInfo;
@@ -273,10 +273,10 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi }
CFX_Int32Array counters;
counters.SetSize(6);
- FX_INT32 lastCode = 0;
- FX_INT32 code = 0;
- FX_INT32 checksumTotal = startCode;
- FX_INT32 multiplier = 0;
+ int32_t lastCode = 0;
+ int32_t code = 0;
+ int32_t checksumTotal = startCode;
+ int32_t multiplier = 0;
FX_BOOL lastCharacterWasPrintable = TRUE;
while (!done) {
FX_BOOL unshift = isNextShifted;
@@ -292,7 +292,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi checksumTotal += multiplier * code;
}
lastStart = nextStart;
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
nextStart += counters[i];
}
switch (code) {
@@ -399,7 +399,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi codeSet = codeSet == CODE_CODE_A ? CODE_CODE_B : CODE_CODE_A;
}
}
- FX_INT32 width = row->GetSize();
+ int32_t width = row->GetSize();
while (nextStart < width && row->Get(nextStart)) {
nextStart++;
}
@@ -414,7 +414,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi e = BCExceptionChecksumException;
return "";
}
- FX_INT32 resultLength = result.GetLength();
+ int32_t resultLength = result.GetLength();
if (resultLength > 0 && lastCharacterWasPrintable) {
if (codeSet == CODE_CODE_C) {
result = result.Mid(0, result.GetLength() - 2);
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h index 94e1a6388b..558b111c22 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h @@ -14,27 +14,27 @@ class CBC_OnedCode128Reader : public CBC_OneDReader public:
CBC_OnedCode128Reader();
virtual ~CBC_OnedCode128Reader();
- virtual CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
- const static FX_INT32 CODE_PATTERNS[107][7];
- const static FX_INT32 MAX_AVG_VARIANCE;
- const static FX_INT32 MAX_INDIVIDUAL_VARIANCE;
+ virtual CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
+ const static int32_t CODE_PATTERNS[107][7];
+ const static int32_t MAX_AVG_VARIANCE;
+ const static int32_t MAX_INDIVIDUAL_VARIANCE;
- const static FX_INT32 CODE_SHIFT;
- const static FX_INT32 CODE_CODE_C;
- const static FX_INT32 CODE_CODE_B;
- const static FX_INT32 CODE_CODE_A;
- const static FX_INT32 CODE_FNC_1;
- const static FX_INT32 CODE_FNC_2;
- const static FX_INT32 CODE_FNC_3;
- const static FX_INT32 CODE_FNC_4_A;
- const static FX_INT32 CODE_FNC_4_B ;
+ const static int32_t CODE_SHIFT;
+ const static int32_t CODE_CODE_C;
+ const static int32_t CODE_CODE_B;
+ const static int32_t CODE_CODE_A;
+ const static int32_t CODE_FNC_1;
+ const static int32_t CODE_FNC_2;
+ const static int32_t CODE_FNC_3;
+ const static int32_t CODE_FNC_4_A;
+ const static int32_t CODE_FNC_4_B ;
- const static FX_INT32 CODE_START_A;
- const static FX_INT32 CODE_START_B;
- const static FX_INT32 CODE_START_C;
- const static FX_INT32 CODE_STOP;
+ const static int32_t CODE_START_A;
+ const static int32_t CODE_START_B;
+ const static int32_t CODE_START_C;
+ const static int32_t CODE_STOP;
private:
- CFX_Int32Array *FindStartPattern(CBC_CommonBitArray *row, FX_INT32 &e);
- FX_INT32 DecodeCode(CBC_CommonBitArray *row, CFX_Int32Array *counters, FX_INT32 rowOffset, FX_INT32 &e);
+ CFX_Int32Array *FindStartPattern(CBC_CommonBitArray *row, int32_t &e);
+ int32_t DecodeCode(CBC_CommonBitArray *row, CFX_Int32Array *counters, int32_t rowOffset, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp index 6dd3cbe8a5..5f7b32caa4 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -27,11 +27,11 @@ #include "BC_OneDimWriter.h"
#include "BC_OnedCode128Reader.h"
#include "BC_OnedCode128Writer.h"
-const FX_INT32 CBC_OnedCode128Writer::CODE_CODE_B = 100;
-const FX_INT32 CBC_OnedCode128Writer::CODE_CODE_C = 99;
-const FX_INT32 CBC_OnedCode128Writer::CODE_START_B = 104;
-const FX_INT32 CBC_OnedCode128Writer::CODE_START_C = 105;
-const FX_INT32 CBC_OnedCode128Writer::CODE_STOP = 106;
+const int32_t CBC_OnedCode128Writer::CODE_CODE_B = 100;
+const int32_t CBC_OnedCode128Writer::CODE_CODE_C = 99;
+const int32_t CBC_OnedCode128Writer::CODE_START_B = 104;
+const int32_t CBC_OnedCode128Writer::CODE_START_C = 105;
+const int32_t CBC_OnedCode128Writer::CODE_STOP = 106;
CBC_OnedCode128Writer::CBC_OnedCode128Writer()
{
m_codeFormat = BC_CODE128_B;
@@ -50,11 +50,11 @@ BC_TYPE CBC_OnedCode128Writer::GetType() FX_BOOL CBC_OnedCode128Writer::CheckContentValidity(FX_WSTR contents)
{
FX_BOOL ret = TRUE;
- FX_INT32 position = 0;
- FX_INT32 patternIndex = -1;
+ int32_t position = 0;
+ int32_t patternIndex = -1;
if (m_codeFormat == BC_CODE128_B || m_codeFormat == BC_CODE128_C) {
while (position < contents.GetLength()) {
- patternIndex = (FX_INT32)contents.GetAt(position);
+ patternIndex = (int32_t)contents.GetAt(position);
if (patternIndex >= 32 && patternIndex <= 126 && patternIndex != 34) {
position++;
continue;
@@ -73,7 +73,7 @@ CFX_WideString CBC_OnedCode128Writer::FilterContents(FX_WSTR contents) {
CFX_WideString filterChineseChar;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -83,7 +83,7 @@ CFX_WideString CBC_OnedCode128Writer::FilterContents(FX_WSTR contents) }
CFX_WideString filtercontents;
if (m_codeFormat == BC_CODE128_B) {
- for (FX_INT32 i = 0; i < filterChineseChar.GetLength(); i++) {
+ for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
ch = filterChineseChar.GetAt(i);
if (ch >= 32 && ch <= 126) {
filtercontents += ch;
@@ -92,7 +92,7 @@ CFX_WideString CBC_OnedCode128Writer::FilterContents(FX_WSTR contents) }
}
} else if (m_codeFormat == BC_CODE128_C) {
- for (FX_INT32 i = 0; i < filterChineseChar.GetLength(); i++) {
+ for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
ch = filterChineseChar.GetAt(i);
if (ch >= 32 && ch <= 106) {
filtercontents += ch;
@@ -113,41 +113,41 @@ FX_BOOL CBC_OnedCode128Writer::SetTextLocation(BC_TEXT_LOC location) m_locTextLoc = location;
return TRUE;
}
-FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if(format != BCFORMAT_CODE_128) {
e = BCExceptionOnlyEncodeCODE_128;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BOOL CBC_OnedCode128Writer::IsDigits(const CFX_ByteString &contents, FX_INT32 start, FX_INT32 length)
+FX_BOOL CBC_OnedCode128Writer::IsDigits(const CFX_ByteString &contents, int32_t start, int32_t length)
{
- FX_INT32 end = start + length;
- for (FX_INT32 i = start; i < end; i++) {
+ int32_t end = start + length;
+ for (int32_t i = start; i < end; i++) {
if (contents[i] < '0' || contents[i] > '9') {
return FALSE;
}
}
return TRUE;
}
-FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e)
+uint8_t *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e)
{
- FX_INT32 length = contents.GetLength();
+ int32_t length = contents.GetLength();
if(contents.GetLength() < 1 || contents.GetLength() > 80) {
e = BCExceptionContentsLengthShouldBetween1and80;
return NULL;
}
CFX_PtrArray patterns;
- FX_INT32 checkSum = 0;
+ int32_t checkSum = 0;
if (m_codeFormat == BC_CODE128_B) {
checkSum = Encode128B(contents, patterns);
} else if (m_codeFormat == BC_CODE128_C) {
@@ -157,21 +157,21 @@ FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, FX_INT32 return NULL;
}
checkSum %= 103;
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[checkSum]);
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_STOP]);
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[checkSum]);
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_STOP]);
m_iContentLen = contents.GetLength() + 3;
- FX_INT32 codeWidth = 0;
- for(FX_INT32 k = 0; k < patterns.GetSize(); k++) {
- FX_INT32 *pattern = (FX_INT32*)patterns[k];
- for(FX_INT32 j = 0; j < 7; j++) {
+ int32_t codeWidth = 0;
+ for(int32_t k = 0; k < patterns.GetSize(); k++) {
+ int32_t *pattern = (int32_t*)patterns[k];
+ for(int32_t j = 0; j < 7; j++) {
codeWidth += pattern[j];
}
}
outLength = codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, outLength);
- FX_INT32 pos = 0;
- for(FX_INT32 j = 0; j < patterns.GetSize(); j++) {
- FX_INT32* pattern = (FX_INT32*)patterns[j];
+ uint8_t *result = FX_Alloc(uint8_t, outLength);
+ int32_t pos = 0;
+ for(int32_t j = 0; j < patterns.GetSize(); j++) {
+ int32_t* pattern = (int32_t*)patterns[j];
pos += AppendPattern(result, pos, pattern, 7, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -180,18 +180,18 @@ FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, FX_INT32 }
return result;
}
-FX_INT32 CBC_OnedCode128Writer::Encode128B(const CFX_ByteString &contents, CFX_PtrArray &patterns)
+int32_t CBC_OnedCode128Writer::Encode128B(const CFX_ByteString &contents, CFX_PtrArray &patterns)
{
- FX_INT32 checkSum = 0;
- FX_INT32 checkWeight = 1;
- FX_INT32 position = 0;
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_B]);
+ int32_t checkSum = 0;
+ int32_t checkWeight = 1;
+ int32_t position = 0;
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_B]);
checkSum += CODE_START_B * checkWeight;
while (position < contents.GetLength()) {
- FX_INT32 patternIndex = 0;
+ int32_t patternIndex = 0;
patternIndex = contents[position] - ' ';
position += 1;
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
checkSum += patternIndex * checkWeight;
if (position != 0) {
checkWeight++;
@@ -199,18 +199,18 @@ FX_INT32 CBC_OnedCode128Writer::Encode128B(const CFX_ByteString &contents, CFX_ }
return checkSum;
}
-FX_INT32 CBC_OnedCode128Writer::Encode128C(const CFX_ByteString &contents, CFX_PtrArray &patterns)
+int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString &contents, CFX_PtrArray &patterns)
{
- FX_INT32 checkSum = 0;
- FX_INT32 checkWeight = 1;
- FX_INT32 position = 0;
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_C]);
+ int32_t checkSum = 0;
+ int32_t checkWeight = 1;
+ int32_t position = 0;
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_C]);
checkSum += CODE_START_C * checkWeight;
while (position < contents.GetLength()) {
- FX_INT32 patternIndex = 0;
+ int32_t patternIndex = 0;
FX_CHAR ch = contents.GetAt(position);
if (ch < '0' || ch > '9') {
- patternIndex = (FX_INT32)ch;
+ patternIndex = (int32_t)ch;
position++;
} else {
patternIndex = FXSYS_atoi(contents.Mid(position, 2));
@@ -220,7 +220,7 @@ FX_INT32 CBC_OnedCode128Writer::Encode128C(const CFX_ByteString &contents, CFX_ position += 2;
}
}
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
checkSum += patternIndex * checkWeight;
if (position != 0) {
checkWeight++;
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h index daa48eca51..f27e2e9f09 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h @@ -14,24 +14,24 @@ public: CBC_OnedCode128Writer();
CBC_OnedCode128Writer(BC_TYPE type);
virtual ~CBC_OnedCode128Writer();
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, FX_INT32 &outLength , FX_INT32 &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, int32_t &outLength , int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
FX_BOOL SetTextLocation(BC_TEXT_LOC location);
BC_TYPE GetType();
private:
- FX_BOOL IsDigits(const CFX_ByteString &contents, FX_INT32 start, FX_INT32 length);
- FX_INT32 Encode128B(const CFX_ByteString &contents, CFX_PtrArray &patterns);
- FX_INT32 Encode128C(const CFX_ByteString &contents, CFX_PtrArray &patterns);
+ FX_BOOL IsDigits(const CFX_ByteString &contents, int32_t start, int32_t length);
+ int32_t Encode128B(const CFX_ByteString &contents, CFX_PtrArray &patterns);
+ int32_t Encode128C(const CFX_ByteString &contents, CFX_PtrArray &patterns);
BC_TYPE m_codeFormat;
- const static FX_INT32 CODE_START_B;
- const static FX_INT32 CODE_START_C;
- const static FX_INT32 CODE_CODE_B;
- const static FX_INT32 CODE_CODE_C;
- const static FX_INT32 CODE_STOP;
+ const static int32_t CODE_START_B;
+ const static int32_t CODE_START_C;
+ const static int32_t CODE_CODE_B;
+ const static int32_t CODE_CODE_C;
+ const static int32_t CODE_STOP;
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp index b19343943b..e5e6392c17 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp @@ -27,14 +27,14 @@ #include "BC_OnedCode39Reader.h"
FX_LPCSTR CBC_OnedCode39Reader::ALPHABET_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
FX_LPCSTR CBC_OnedCode39Reader::CHECKSUM_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%";
-const FX_INT32 CBC_OnedCode39Reader::CHARACTER_ENCODINGS[44] = {
+const int32_t CBC_OnedCode39Reader::CHARACTER_ENCODINGS[44] = {
0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064,
0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C,
0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016,
0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094,
0x0A8, 0x0A2, 0x08A, 0x02A
};
-const FX_INT32 CBC_OnedCode39Reader::ASTERISK_ENCODING = 0x094;
+const int32_t CBC_OnedCode39Reader::ASTERISK_ENCODING = 0x094;
CBC_OnedCode39Reader::CBC_OnedCode39Reader(): m_extendedMode(FALSE), m_usingCheckDigit(FALSE)
{
}
@@ -51,16 +51,16 @@ CBC_OnedCode39Reader::CBC_OnedCode39Reader(FX_BOOL usingCheckDigit, FX_BOOL exte CBC_OnedCode39Reader::~CBC_OnedCode39Reader()
{
}
-CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedCode39Reader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_Int32Array *start = FindAsteriskPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
- FX_INT32 nextStart = (*start)[1];
+ int32_t nextStart = (*start)[1];
if(start != NULL) {
delete start;
start = NULL;
}
- FX_INT32 end = row->GetSize();
+ int32_t end = row->GetSize();
while (nextStart < end && !row->Get(nextStart)) {
nextStart++;
}
@@ -68,11 +68,11 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBit CFX_Int32Array counters;
counters.SetSize(9);
FX_CHAR decodedChar;
- FX_INT32 lastStart;
+ int32_t lastStart;
do {
RecordPattern(row, nextStart, &counters, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
- FX_INT32 pattern = ToNarrowWidePattern(&counters);
+ int32_t pattern = ToNarrowWidePattern(&counters);
if (pattern < 0) {
e = BCExceptionNotFound;
return "";
@@ -81,7 +81,7 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBit BC_EXCEPTION_CHECK_ReturnValue(e, "");
result += decodedChar;
lastStart = nextStart;
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
nextStart += counters[i];
}
while (nextStart < end && !row->Get(nextStart)) {
@@ -89,17 +89,17 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBit }
} while (decodedChar != '*');
result = result.Mid(0, result.GetLength() - 1);
- FX_INT32 lastPatternSize = 0;
- for (FX_INT32 j = 0; j < counters.GetSize(); j++) {
+ int32_t lastPatternSize = 0;
+ for (int32_t j = 0; j < counters.GetSize(); j++) {
lastPatternSize += counters[j];
}
- FX_INT32 whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
+ int32_t whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
if(m_usingCheckDigit) {
- FX_INT32 max = result.GetLength() - 1;
- FX_INT32 total = 0;
- FX_INT32 len = (FX_INT32)strlen(ALPHABET_STRING);
- for (FX_INT32 k = 0; k < max; k++) {
- for (FX_INT32 j = 0; j < len; j++)
+ int32_t max = result.GetLength() - 1;
+ int32_t total = 0;
+ int32_t len = (int32_t)strlen(ALPHABET_STRING);
+ for (int32_t k = 0; k < max; k++) {
+ for (int32_t j = 0; j < len; j++)
if (ALPHABET_STRING[j] == result[k]) {
total += j;
}
@@ -122,23 +122,23 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBit return result;
}
}
-CFX_Int32Array *CBC_OnedCode39Reader::FindAsteriskPattern(CBC_CommonBitArray *row, FX_INT32 &e)
+CFX_Int32Array *CBC_OnedCode39Reader::FindAsteriskPattern(CBC_CommonBitArray *row, int32_t &e)
{
- FX_INT32 width = row->GetSize();
- FX_INT32 rowOffset = 0;
+ int32_t width = row->GetSize();
+ int32_t rowOffset = 0;
while (rowOffset < width) {
if (row->Get(rowOffset)) {
break;
}
rowOffset++;
}
- FX_INT32 counterPosition = 0;
+ int32_t counterPosition = 0;
CFX_Int32Array counters;
counters.SetSize(9);
- FX_INT32 patternStart = rowOffset;
+ int32_t patternStart = rowOffset;
FX_BOOL isWhite = FALSE;
- FX_INT32 patternLength = counters.GetSize();
- for (FX_INT32 i = rowOffset; i < width; i++) {
+ int32_t patternLength = counters.GetSize();
+ for (int32_t i = rowOffset; i < width; i++) {
FX_BOOL pixel = row->Get(i);
if (pixel ^ isWhite) {
counters[counterPosition]++;
@@ -156,7 +156,7 @@ CFX_Int32Array *CBC_OnedCode39Reader::FindAsteriskPattern(CBC_CommonBitArray *ro }
}
patternStart += counters[0] + counters[1];
- for (FX_INT32 y = 2; y < patternLength; y++) {
+ for (int32_t y = 2; y < patternLength; y++) {
counters[y - 2] = counters[y];
}
counters[patternLength - 2] = 0;
@@ -172,26 +172,26 @@ CFX_Int32Array *CBC_OnedCode39Reader::FindAsteriskPattern(CBC_CommonBitArray *ro e = BCExceptionNotFound;
return NULL;
}
-FX_INT32 CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array *counters)
+int32_t CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array *counters)
{
- FX_INT32 numCounters = counters->GetSize();
- FX_INT32 maxNarrowCounter = 0;
- FX_INT32 wideCounters;
+ int32_t numCounters = counters->GetSize();
+ int32_t maxNarrowCounter = 0;
+ int32_t wideCounters;
do {
#undef max
- FX_INT32 minCounter = FXSYS_IntMax;
- for (FX_INT32 i = 0; i < numCounters; i++) {
- FX_INT32 counter = (*counters)[i];
+ int32_t minCounter = FXSYS_IntMax;
+ for (int32_t i = 0; i < numCounters; i++) {
+ int32_t counter = (*counters)[i];
if (counter < minCounter && counter > maxNarrowCounter) {
minCounter = counter;
}
}
maxNarrowCounter = minCounter;
wideCounters = 0;
- FX_INT32 totalWideCountersWidth = 0;
- FX_INT32 pattern = 0;
- for (FX_INT32 j = 0; j < numCounters; j++) {
- FX_INT32 counter = (*counters)[j];
+ int32_t totalWideCountersWidth = 0;
+ int32_t pattern = 0;
+ for (int32_t j = 0; j < numCounters; j++) {
+ int32_t counter = (*counters)[j];
if ((*counters)[j] > maxNarrowCounter) {
pattern |= 1 << (numCounters - 1 - j);
wideCounters++;
@@ -199,8 +199,8 @@ FX_INT32 CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array *counters) }
}
if (wideCounters == 3) {
- for (FX_INT32 k = 0; k < numCounters && wideCounters > 0; k++) {
- FX_INT32 counter = (*counters)[k];
+ for (int32_t k = 0; k < numCounters && wideCounters > 0; k++) {
+ int32_t counter = (*counters)[k];
if ((*counters)[k] > maxNarrowCounter) {
wideCounters--;
if ((counter << 1) >= totalWideCountersWidth) {
@@ -213,9 +213,9 @@ FX_INT32 CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array *counters) } while (wideCounters > 3);
return -1;
}
-FX_CHAR CBC_OnedCode39Reader::PatternToChar(FX_INT32 pattern, FX_INT32 &e)
+FX_CHAR CBC_OnedCode39Reader::PatternToChar(int32_t pattern, int32_t &e)
{
- for (FX_INT32 i = 0; i < 44; i++) {
+ for (int32_t i = 0; i < 44; i++) {
if (CHARACTER_ENCODINGS[i] == pattern) {
return (ALPHABET_STRING)[i];
}
@@ -223,12 +223,12 @@ FX_CHAR CBC_OnedCode39Reader::PatternToChar(FX_INT32 pattern, FX_INT32 &e) e = BCExceptionNotFound;
return 0;
}
-CFX_ByteString CBC_OnedCode39Reader::DecodeExtended(CFX_ByteString &encoded, FX_INT32 &e)
+CFX_ByteString CBC_OnedCode39Reader::DecodeExtended(CFX_ByteString &encoded, int32_t &e)
{
- FX_INT32 length = encoded.GetLength();
+ int32_t length = encoded.GetLength();
CFX_ByteString decoded;
FX_CHAR c, next;
- for(FX_INT32 i = 0; i < length; i++) {
+ for(int32_t i = 0; i < length; i++) {
c = encoded[i];
if(c == '+' || c == '$' || c == '%' || c == '/') {
next = encoded[i + 1];
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h index 81fd6b79e9..3e7db70f95 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h @@ -14,19 +14,19 @@ class CBC_OnedCode39Reader : public CBC_OneDReader public:
static FX_LPCSTR ALPHABET_STRING;
static FX_LPCSTR CHECKSUM_STRING;
- const static FX_INT32 CHARACTER_ENCODINGS[44];
- const static FX_INT32 ASTERISK_ENCODING;
+ const static int32_t CHARACTER_ENCODINGS[44];
+ const static int32_t ASTERISK_ENCODING;
CBC_OnedCode39Reader();
CBC_OnedCode39Reader(FX_BOOL usingCheckDigit);
CBC_OnedCode39Reader(FX_BOOL usingCheckDigit, FX_BOOL extendedMode);
virtual ~CBC_OnedCode39Reader();
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
private:
FX_BOOL m_usingCheckDigit;
FX_BOOL m_extendedMode;
- CFX_Int32Array *FindAsteriskPattern(CBC_CommonBitArray *row, FX_INT32 &e);
- FX_INT32 ToNarrowWidePattern(CFX_Int32Array *counters);
- FX_CHAR PatternToChar(FX_INT32 pattern, FX_INT32 &e);
- CFX_ByteString DecodeExtended(CFX_ByteString &encoded, FX_INT32 &e);
+ CFX_Int32Array *FindAsteriskPattern(CBC_CommonBitArray *row, int32_t &e);
+ int32_t ToNarrowWidePattern(CFX_Int32Array *counters);
+ FX_CHAR PatternToChar(int32_t pattern, int32_t &e);
+ CFX_ByteString DecodeExtended(CFX_ByteString &encoded, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.cpp index d9c77460ac..8d06ecdfc2 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -46,7 +46,7 @@ FX_BOOL CBC_OnedCode39Writer::CheckContentValidity(FX_WSTR contents) if (m_extendedMode) {
return CheckExtendedContentValidity(contents);
}
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') || (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z')
|| ch == (FX_WCHAR)'-' || ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*'
@@ -59,7 +59,7 @@ FX_BOOL CBC_OnedCode39Writer::CheckContentValidity(FX_WSTR contents) }
FX_BOOL CBC_OnedCode39Writer::CheckExtendedContentValidity(FX_WSTR contents)
{
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if (ch > 127) {
return FALSE;
@@ -73,7 +73,7 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents(FX_WSTR contents) return FilterExtendedContents(contents);
}
CFX_WideString filtercontents;
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ( ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1) ) {
continue;
@@ -95,7 +95,7 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents(FX_WSTR contents) CFX_WideString CBC_OnedCode39Writer::FilterExtendedContents(FX_WSTR contents)
{
CFX_WideString filtercontents;
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ( ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1) ) {
continue;
@@ -155,7 +155,7 @@ CFX_WideString CBC_OnedCode39Writer::RenderTextContents(FX_WSTR contents) return RenderExtendedTextContents(contents);
}
CFX_WideString renderContents;
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ( ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1) ) {
continue;
@@ -176,7 +176,7 @@ CFX_WideString CBC_OnedCode39Writer::RenderTextContents(FX_WSTR contents) CFX_WideString CBC_OnedCode39Writer::RenderExtendedTextContents(FX_WSTR contents)
{
CFX_WideString renderContents;
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ( ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1) ) {
continue;
@@ -200,7 +200,7 @@ FX_BOOL CBC_OnedCode39Writer::SetTextLocation(BC_TEXT_LOC location) m_locTextLoc = location;
return TRUE;
}
-FX_BOOL CBC_OnedCode39Writer::SetWideNarrowRatio(FX_INT32 ratio)
+FX_BOOL CBC_OnedCode39Writer::SetWideNarrowRatio(int32_t ratio)
{
if ( ratio < 2 || ratio > 3) {
return FALSE;
@@ -208,39 +208,39 @@ FX_BOOL CBC_OnedCode39Writer::SetWideNarrowRatio(FX_INT32 ratio) m_iWideNarrRatio = ratio;
return TRUE;
}
-FX_BYTE *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0 , e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0 , e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if(format != BCFORMAT_CODE_39) {
e = BCExceptionOnlyEncodeCODE_39;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-void CBC_OnedCode39Writer::ToIntArray(FX_INT32 a, FX_INT32 *toReturn)
+void CBC_OnedCode39Writer::ToIntArray(int32_t a, int32_t *toReturn)
{
- for(FX_INT32 i = 0; i < 9; i++) {
+ for(int32_t i = 0; i < 9; i++) {
toReturn[i] = (a & (1 << i) ) == 0 ? 1 : m_iWideNarrRatio;
}
}
-FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString &contents, FX_INT32 &e)
+FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString &contents, int32_t &e)
{
- FX_INT32 length = contents.GetLength();
+ int32_t length = contents.GetLength();
if (length > 80) {
e = BCExceptionContentsLengthShouldBetween1and80;
return '*';
}
- FX_INT32 checksum = 0;
- FX_INT32 len = (FX_INT32)strlen(CBC_OnedCode39Reader::ALPHABET_STRING);
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
- FX_INT32 j = 0;
+ int32_t checksum = 0;
+ int32_t len = (int32_t)strlen(CBC_OnedCode39Reader::ALPHABET_STRING);
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
+ int32_t j = 0;
for (; j < len; j++) {
if (CBC_OnedCode39Reader::ALPHABET_STRING[j] == contents[i]) {
if(contents[i] != '*') {
@@ -259,48 +259,48 @@ FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString &contents, FX_IN checksum = checksum % 43;
return CBC_OnedCode39Reader::CHECKSUM_STRING[checksum];
}
-FX_BYTE *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outlength , FX_INT32 &e)
+uint8_t *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, int32_t &outlength , int32_t &e)
{
FX_CHAR checksum = CalcCheckSum(contents, e);
if (checksum == '*') {
return NULL;
}
- FX_INT32 widths[9] = {0};
- FX_INT32 wideStrideNum = 3;
- FX_INT32 narrStrideNum = 9 - wideStrideNum;
+ int32_t widths[9] = {0};
+ int32_t wideStrideNum = 3;
+ int32_t narrStrideNum = 9 - wideStrideNum;
CFX_ByteString encodedContents = contents;
if ( m_bCalcChecksum ) {
encodedContents += checksum;
}
m_iContentLen = encodedContents.GetLength();
- FX_INT32 codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 + 1 + m_iContentLen;
- FX_INT32 len = (FX_INT32)strlen(CBC_OnedCode39Reader::ALPHABET_STRING);
- for (FX_INT32 j = 0; j < m_iContentLen; j++) {
- for (FX_INT32 i = 0; i < len; i++) {
+ int32_t codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 + 1 + m_iContentLen;
+ int32_t len = (int32_t)strlen(CBC_OnedCode39Reader::ALPHABET_STRING);
+ for (int32_t j = 0; j < m_iContentLen; j++) {
+ for (int32_t i = 0; i < len; i++) {
if (CBC_OnedCode39Reader::ALPHABET_STRING[i] == encodedContents[j]) {
ToIntArray(CBC_OnedCode39Reader::CHARACTER_ENCODINGS[i], widths);
- for(FX_INT32 k = 0; k < 9; k++) {
+ for(int32_t k = 0; k < 9; k++) {
codeWidth += widths[k];
}
}
}
}
outlength = codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, codeWidth);
+ uint8_t *result = FX_Alloc(uint8_t, codeWidth);
ToIntArray(CBC_OnedCode39Reader::CHARACTER_ENCODINGS[39], widths);
- FX_INT32 pos = AppendPattern(result, 0, widths, 9, 1 , e);
+ int32_t pos = AppendPattern(result, 0, widths, 9, 1 , e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- FX_INT32 narrowWhite[] = {1};
+ int32_t narrowWhite[] = {1};
pos += AppendPattern(result, pos, narrowWhite, 1, 0, e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- for(FX_INT32 l = m_iContentLen - 1; l >= 0; l--) {
- for (FX_INT32 i = 0; i < len; i++) {
+ for(int32_t l = m_iContentLen - 1; l >= 0; l--) {
+ for (int32_t i = 0; i < len; i++) {
if (CBC_OnedCode39Reader::ALPHABET_STRING[i] == encodedContents[l]) {
ToIntArray(CBC_OnedCode39Reader::CHARACTER_ENCODINGS[i], widths);
pos += AppendPattern(result, pos, widths, 9, 1, e);
@@ -322,14 +322,14 @@ FX_BYTE *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, FX_INT32 & FX_Free (result);
return NULL;
}
- for (FX_INT32 i = 0; i < codeWidth / 2; i++) {
+ for (int32_t i = 0; i < codeWidth / 2; i++) {
result[i] ^= result[codeWidth - 1 - i];
result[codeWidth - 1 - i] ^= result[i];
result[i] ^= result[codeWidth - 1 - i];
}
return result;
}
-CFX_WideString CBC_OnedCode39Writer::encodedContents(FX_WSTR contents, FX_INT32 &e)
+CFX_WideString CBC_OnedCode39Writer::encodedContents(FX_WSTR contents, int32_t &e)
{
CFX_WideString encodedContents = contents;
if (m_bCalcChecksum && m_bPrintChecksum) {
@@ -343,7 +343,7 @@ CFX_WideString CBC_OnedCode39Writer::encodedContents(FX_WSTR contents, FX_INT32 }
return encodedContents;
}
-void CBC_OnedCode39Writer::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedCode39Writer::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CFX_WideString encodedCon = encodedContents(contents, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.h b/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.h index b37d9d8e19..641d041809 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.h @@ -15,11 +15,11 @@ public: CBC_OnedCode39Writer();
CBC_OnedCode39Writer(FX_BOOL extendedMode);
virtual ~CBC_OnedCode39Writer();
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e);
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
- CFX_WideString encodedContents(FX_WSTR contents, FX_INT32 &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
+ CFX_WideString encodedContents(FX_WSTR contents, int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
FX_BOOL CheckExtendedContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
@@ -27,11 +27,11 @@ public: CFX_WideString RenderTextContents(FX_WSTR contents);
CFX_WideString RenderExtendedTextContents(FX_WSTR contents);
FX_BOOL SetTextLocation(BC_TEXT_LOC loction);
- FX_BOOL SetWideNarrowRatio(FX_INT32 ratio);
+ FX_BOOL SetWideNarrowRatio(int32_t ratio);
private:
- void ToIntArray(FX_INT32 a, FX_INT32 *toReturn);
- FX_CHAR CalcCheckSum(const CFX_ByteString &contents, FX_INT32 &e);
- FX_INT32 m_iWideNarrRatio;
+ void ToIntArray(int32_t a, int32_t *toReturn);
+ FX_CHAR CalcCheckSum(const CFX_ByteString &contents, int32_t &e);
+ int32_t m_iWideNarrRatio;
FX_BOOL m_extendedMode;
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp index ddce736bb8..288aace861 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp @@ -26,7 +26,7 @@ #include "BC_OneDReader.h"
#include "BC_OneDimReader.h"
#include "BC_OnedEAN13Reader.h"
-const FX_INT32 CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[10] = {
+const int32_t CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[10] = {
0x00, 0x0B, 0x0D, 0xE, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1A
};
CBC_OnedEAN13Reader::CBC_OnedEAN13Reader()
@@ -35,9 +35,9 @@ CBC_OnedEAN13Reader::CBC_OnedEAN13Reader() CBC_OnedEAN13Reader::~CBC_OnedEAN13Reader()
{
}
-void CBC_OnedEAN13Reader::DetermineFirstDigit(CFX_ByteString &result, FX_INT32 lgPatternFound, FX_INT32 &e)
+void CBC_OnedEAN13Reader::DetermineFirstDigit(CFX_ByteString &result, int32_t lgPatternFound, int32_t &e)
{
- for (FX_INT32 d = 0; d < 10; d++) {
+ for (int32_t d = 0; d < 10; d++) {
if (lgPatternFound == FIRST_DIGIT_ENCODINGS[d]) {
result.Insert(0, (FX_CHAR) ('0' + d));
return;
@@ -46,21 +46,21 @@ void CBC_OnedEAN13Reader::DetermineFirstDigit(CFX_ByteString &result, FX_INT32 l e = BCExceptionNotFound;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-FX_INT32 CBC_OnedEAN13Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, FX_INT32 &e)
+int32_t CBC_OnedEAN13Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, int32_t &e)
{
CFX_Int32Array counters;
counters.Add(0);
counters.Add(0);
counters.Add(0);
counters.Add(0);
- FX_INT32 end = row->GetSize();
- FX_INT32 rowOffset = (*startRange)[1];
- FX_INT32 lgPatternFound = 0;
- for (FX_INT32 x = 0; x < 6 && rowOffset < end; x++) {
- FX_INT32 bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_AND_G_PATTERNS[0][0]), 20, e);
+ int32_t end = row->GetSize();
+ int32_t rowOffset = (*startRange)[1];
+ int32_t lgPatternFound = 0;
+ for (int32_t x = 0; x < 6 && rowOffset < end; x++) {
+ int32_t bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_AND_G_PATTERNS[0][0]), 20, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
resultString += (FX_CHAR) ('0' + bestMatch % 10);
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
rowOffset += counters[i];
}
if (bestMatch >= 10) {
@@ -82,11 +82,11 @@ FX_INT32 CBC_OnedEAN13Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Arr delete middleRange;
middleRange = NULL;
}
- for (FX_INT32 Y = 0; Y < 6 && rowOffset < end; Y++) {
- FX_INT32 bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
+ for (int32_t Y = 0; Y < 6 && rowOffset < end; Y++) {
+ int32_t bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
resultString += (FX_CHAR) ('0' + bestMatch);
- for (FX_INT32 k = 0; k < counters.GetSize(); k++) {
+ for (int32_t k = 0; k < counters.GetSize(); k++) {
rowOffset += counters[k];
}
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h index 9afb9b6418..7c31fd4f20 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h @@ -12,13 +12,13 @@ class CBC_OnedEAN13Reader; class CBC_OnedEAN13Reader : public CBC_OneDimReader
{
public:
- const static FX_INT32 FIRST_DIGIT_ENCODINGS[10];
+ const static int32_t FIRST_DIGIT_ENCODINGS[10];
CBC_OnedEAN13Reader();
virtual ~CBC_OnedEAN13Reader();
private:
- void DetermineFirstDigit(CFX_ByteString &result, FX_INT32 lgPatternFound, FX_INT32 &e);
+ void DetermineFirstDigit(CFX_ByteString &result, int32_t lgPatternFound, int32_t &e);
protected:
- FX_INT32 DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, FX_INT32 &e);
+ int32_t DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, int32_t &e);
friend class CBC_OnedUPCAReader;
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 788cd8f7da..4b258a5a9f 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -42,7 +42,7 @@ CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() }
FX_BOOL CBC_OnedEAN13Writer::CheckContentValidity(FX_WSTR contents)
{
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
continue;
} else {
@@ -55,7 +55,7 @@ CFX_WideString CBC_OnedEAN13Writer::FilterContents(FX_WSTR contents) {
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -67,12 +67,12 @@ CFX_WideString CBC_OnedEAN13Writer::FilterContents(FX_WSTR contents) }
return filtercontents;
}
-FX_INT32 CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString &contents)
+int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString &contents)
{
- FX_INT32 odd = 0;
- FX_INT32 even = 0;
- FX_INT32 j = 1;
- for(FX_INT32 i = contents.GetLength() - 1; i >= 0; i--) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for(int32_t i = contents.GetLength() - 1; i >= 0; i--) {
if(j % 2) {
odd += FXSYS_atoi(contents.Mid(i, 1));
} else {
@@ -80,45 +80,45 @@ FX_INT32 CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString &contents) }
j++;
}
- FX_INT32 checksum = (odd * 3 + even) % 10;
+ int32_t checksum = (odd * 3 + even) % 10;
checksum = (10 - checksum) % 10;
return (checksum);
}
-FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if(format != BCFORMAT_EAN_13) {
e = BCExceptionOnlyEncodeEAN_13;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e)
+uint8_t *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e)
{
if (contents.GetLength() != 13) {
e = BCExceptionDigitLengthShould13;
return NULL;
}
m_iDataLenth = 13;
- FX_INT32 firstDigit = FXSYS_atoi(contents.Mid(0, 1));
- FX_INT32 parities = CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[firstDigit];
+ int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1));
+ int32_t parities = CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[firstDigit];
outLength = m_codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, m_codeWidth);
- FX_INT32 pos = 0;
+ uint8_t *result = FX_Alloc(uint8_t, m_codeWidth);
+ int32_t pos = 0;
pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for ( i = 1; i <= 6; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
if ((parities >> (6 - i) & 1) == 1) {
digit += 10;
}
@@ -134,7 +134,7 @@ FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, FX_INT32 &o return NULL;
}
for (i = 7; i <= 12; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -148,16 +148,16 @@ FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, FX_INT32 &o }
return result;
}
-void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
return;
}
- FX_INT32 leftPadding = 7 * multiple;
- FX_INT32 leftPosition = 3 * multiple + leftPadding;
+ int32_t leftPadding = 7 * multiple;
+ int32_t leftPosition = 3 * multiple + leftPadding;
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLen = str.GetLength();
+ int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
if (!pCharPos) {
return;
@@ -167,10 +167,10 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, if (pOutBitmap != NULL) {
geBitmap.Attach(pOutBitmap);
}
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
CFX_ByteString tempStr = str.Mid(1, 6);
- FX_INT32 strWidth = multiple * 42;
+ int32_t strWidth = multiple * 42;
if (pOutBitmap == NULL) {
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect((FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
@@ -184,7 +184,7 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, matr1.TransformRect(rect1);
re = rect1.GetOutterRect();
device->FillRect(&re, m_backgroundColor);
- FX_INT32 strWidth1 = multiple * 7;
+ int32_t strWidth1 = multiple * 7;
CFX_Matrix matr2(m_outputHScale, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
CFX_FloatRect rect2(0.0f, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)strWidth1 - 0.5f, (FX_FLOAT)m_Height);
matr2.Concat(*matrix);
@@ -196,7 +196,7 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, FX_FLOAT charsWidth = 0;
iLen = tempStr.GetLength();
if (pOutBitmap == NULL) {
- strWidth = (FX_INT32)(strWidth * m_outputHScale);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
}
CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize, blank);
CFX_AffineMatrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
@@ -258,7 +258,7 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, iLen = tempStr.GetLength();
strWidth = multiple * 7;
if (pOutBitmap == NULL) {
- strWidth = (FX_INT32)(strWidth * m_outputHScale);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
}
CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, blank);
if(pOutBitmap != NULL) {
@@ -288,7 +288,7 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, }
FX_Free(pCharPos);
}
-void CBC_OnedEAN13Writer::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedEAN13Writer::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.h b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.h index 2353cfda95..df9d635a4e 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.h +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.h @@ -11,21 +11,21 @@ class CBC_OnedEAN13Writer; class CBC_OnedEAN13Writer : public CBC_OneDimWriter
{
private:
- FX_INT32 m_codeWidth;
+ int32_t m_codeWidth;
public:
CBC_OnedEAN13Writer();
virtual ~CBC_OnedEAN13Writer();
- FX_BYTE* Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE* Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BYTE* Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e);
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
+ uint8_t* Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t* Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ uint8_t* Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
- FX_INT32 CalcChecksum(const CFX_ByteString &contents);
+ int32_t CalcChecksum(const CFX_ByteString &contents);
protected:
- void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e);
+ void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp index 48e24681df..4b5de72939 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp @@ -32,25 +32,25 @@ CBC_OnedEAN8Reader::CBC_OnedEAN8Reader() CBC_OnedEAN8Reader::~CBC_OnedEAN8Reader()
{
}
-FX_INT32 CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultResult, FX_INT32 &e)
+int32_t CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultResult, int32_t &e)
{
CFX_Int32Array counters;
counters.Add(0);
counters.Add(0);
counters.Add(0);
counters.Add(0);
- FX_INT32 end = row->GetSize();
- FX_INT32 rowOffset = (*startRange)[1];
- FX_INT32 rowOffsetLeft = rowOffset;
- for (FX_INT32 x = 0; x < 4 && rowOffset < end; x++) {
- FX_INT32 bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
+ int32_t end = row->GetSize();
+ int32_t rowOffset = (*startRange)[1];
+ int32_t rowOffsetLeft = rowOffset;
+ for (int32_t x = 0; x < 4 && rowOffset < end; x++) {
+ int32_t bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
resultResult += (FX_CHAR) ('0' + bestMatch);
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
rowOffset += counters[i];
}
}
- FX_INT32 RowOffsetLen = (rowOffset - rowOffsetLeft) / 4;
+ int32_t RowOffsetLen = (rowOffset - rowOffsetLeft) / 4;
CFX_Int32Array result;
result.Add(CBC_OneDimReader::MIDDLE_PATTERN[0]);
result.Add(CBC_OneDimReader::MIDDLE_PATTERN[1]);
@@ -59,7 +59,7 @@ FX_INT32 CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Arra result.Add(CBC_OneDimReader::MIDDLE_PATTERN[4]);
CFX_Int32Array *middleRange = FindGuardPattern(row, rowOffset, TRUE, &result, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- FX_INT32 rowOffsetMid = rowOffset;
+ int32_t rowOffsetMid = rowOffset;
rowOffset = (*middleRange)[1];
if((rowOffset - rowOffsetMid) > RowOffsetLen) {
e = BCExceptionNotFound;
@@ -69,11 +69,11 @@ FX_INT32 CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Arra delete middleRange;
middleRange = NULL;
}
- for (FX_INT32 y = 0; y < 4 && rowOffset < end; y++) {
- FX_INT32 bestMatch = DecodeDigit(row, & counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
+ for (int32_t y = 0; y < 4 && rowOffset < end; y++) {
+ int32_t bestMatch = DecodeDigit(row, & counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
resultResult += (FX_CHAR) ('0' + bestMatch);
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
rowOffset += counters[i];
}
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.h b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.h index a32bb63083..f2aa93c8ea 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.h @@ -15,6 +15,6 @@ public: CBC_OnedEAN8Reader();
virtual ~CBC_OnedEAN8Reader();
protected:
- FX_INT32 DecodeMiddle(CBC_CommonBitArray*, CFX_Int32Array *startRange, CFX_ByteString &result, FX_INT32 &e);
+ int32_t DecodeMiddle(CBC_CommonBitArray*, CFX_Int32Array *startRange, CFX_ByteString &result, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp index 19f7f7cede..fdf791c686 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -40,7 +40,7 @@ CBC_OnedEAN8Writer::CBC_OnedEAN8Writer() CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer()
{
}
-void CBC_OnedEAN8Writer::SetDataLength(FX_INT32 length)
+void CBC_OnedEAN8Writer::SetDataLength(int32_t length)
{
m_iDataLenth = 8;
}
@@ -54,7 +54,7 @@ FX_BOOL CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location) }
FX_BOOL CBC_OnedEAN8Writer::CheckContentValidity(FX_WSTR contents)
{
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
continue;
} else {
@@ -67,7 +67,7 @@ CFX_WideString CBC_OnedEAN8Writer::FilterContents(FX_WSTR contents) {
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -79,12 +79,12 @@ CFX_WideString CBC_OnedEAN8Writer::FilterContents(FX_WSTR contents) }
return filtercontents;
}
-FX_INT32 CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents)
+int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents)
{
- FX_INT32 odd = 0;
- FX_INT32 even = 0;
- FX_INT32 j = 1;
- for(FX_INT32 i = contents.GetLength() - 1; i >= 0; i--) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for(int32_t i = contents.GetLength() - 1; i >= 0; i--) {
if(j % 2) {
odd += FXSYS_atoi(contents.Mid(i, 1));
} else {
@@ -92,44 +92,44 @@ FX_INT32 CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents) }
j++;
}
- FX_INT32 checksum = (odd * 3 + even) % 10;
+ int32_t checksum = (odd * 3 + even) % 10;
checksum = (10 - checksum) % 10;
return (checksum);
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight , int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints , int32_t &e)
{
if (format != BCFORMAT_EAN_8) {
e = BCExceptionOnlyEncodeEAN_8;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outLength , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, int32_t &outLength , int32_t &e)
{
if (contents.GetLength() != 8) {
e = BCExceptionDigitLengthMustBe8;
return NULL;
}
outLength = m_codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, m_codeWidth);
- FX_INT32 pos = 0;
+ uint8_t *result = FX_Alloc(uint8_t, m_codeWidth);
+ int32_t pos = 0;
pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for (i = 0; i <= 3; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 0, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -142,7 +142,7 @@ FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &ou return NULL;
}
for (i = 4; i <= 7; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -156,31 +156,31 @@ FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &ou }
return result;
}
-void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
return;
}
- FX_INT32 leftPosition = 3 * multiple;
+ int32_t leftPosition = 3 * multiple;
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLength = str.GetLength();
+ int32_t iLength = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLength);
if (!pCharPos) {
return;
}
FXSYS_memset32(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLength);
CFX_ByteString tempStr = str.Mid(0, 4);
- FX_INT32 iLen = tempStr.GetLength();
- FX_INT32 strWidth = 7 * multiple * 4;
+ int32_t iLen = tempStr.GetLength();
+ int32_t strWidth = 7 * multiple * 4;
FX_FLOAT blank = 0.0;
CFX_FxgeDevice geBitmap;
if (pOutBitmap != NULL) {
geBitmap.Attach(pOutBitmap);
}
FX_FLOAT charsWidth = 0;
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
if (pOutBitmap == NULL) {
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect((FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
@@ -196,7 +196,7 @@ void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C device->FillRect(&re, m_backgroundColor);
}
if (pOutBitmap == NULL) {
- strWidth = (FX_INT32)(strWidth * m_outputHScale);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
}
CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, blank);
CFX_AffineMatrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
@@ -255,7 +255,7 @@ void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C }
FX_Free(pCharPos);
}
-void CBC_OnedEAN8Writer::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedEAN8Writer::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.h b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.h index 2b55734538..f2e5cc2cbe 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.h +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.h @@ -12,21 +12,21 @@ class CBC_OnedEAN8Writer; class CBC_OnedEAN8Writer : public CBC_OneDimWriter
{
private:
- FX_INT32 m_codeWidth;
+ int32_t m_codeWidth;
public:
CBC_OnedEAN8Writer();
virtual ~CBC_OnedEAN8Writer();
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight , FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints , FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e);
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight , int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints , int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
- void SetDataLength(FX_INT32 length);
+ void SetDataLength(int32_t length);
FX_BOOL SetTextLocation(BC_TEXT_LOC location);
- FX_INT32 CalcChecksum(const CFX_ByteString &contents);
+ int32_t CalcChecksum(const CFX_ByteString &contents);
protected:
- void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e);
+ void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp index 44c26acf7e..0156ba4af7 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp @@ -42,7 +42,7 @@ CBC_OnedUPCAReader::~CBC_OnedUPCAReader() }
m_ean13Reader = NULL;
}
-CFX_ByteString CBC_OnedUPCAReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_ByteString bytestring = m_ean13Reader->DecodeRow(rowNumber, row, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -50,7 +50,7 @@ CFX_ByteString CBC_OnedUPCAReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitAr BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-CFX_ByteString CBC_OnedUPCAReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, int32_t hints, int32_t &e)
{
CFX_ByteString bytestring = m_ean13Reader->DecodeRow(rowNumber, row, startGuardRange, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -58,7 +58,7 @@ CFX_ByteString CBC_OnedUPCAReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitAr BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, int32_t &e)
{
CFX_ByteString bytestring = m_ean13Reader->Decode(image, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -66,7 +66,7 @@ CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
CFX_ByteString bytestring = m_ean13Reader->Decode(image, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -74,13 +74,13 @@ CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hint BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-FX_INT32 CBC_OnedUPCAReader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, FX_INT32 &e)
+int32_t CBC_OnedUPCAReader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, int32_t &e)
{
- FX_INT32 temp = m_ean13Reader->DecodeMiddle(row, startRange, resultString, e);
+ int32_t temp = m_ean13Reader->DecodeMiddle(row, startRange, resultString, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
return temp;
}
-CFX_ByteString CBC_OnedUPCAReader::MaybeReturnResult(CFX_ByteString &result, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::MaybeReturnResult(CFX_ByteString &result, int32_t &e)
{
if(result[0] == '0') {
result.Delete(0);
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.h b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.h index 5df6c739ff..c1eccb57d1 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.h @@ -18,13 +18,13 @@ private: public:
CBC_OnedUPCAReader();
virtual ~CBC_OnedUPCAReader();
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, FX_INT32 hints, FX_INT32 &e);
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e);
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, int32_t hints, int32_t &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e);
virtual void Init();
protected:
- FX_INT32 DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, FX_INT32 &e);
- CFX_ByteString MaybeReturnResult(CFX_ByteString &result, FX_INT32 &e);
+ int32_t DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, int32_t &e);
+ CFX_ByteString MaybeReturnResult(CFX_ByteString &result, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 612c031c02..56324a8e1a 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -44,7 +44,7 @@ CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() }
FX_BOOL CBC_OnedUPCAWriter::CheckContentValidity(FX_WSTR contents)
{
- FX_INT32 i = 0;
+ int32_t i = 0;
for (i = 0; i < contents.GetLength(); i++) {
if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
continue;
@@ -58,7 +58,7 @@ CFX_WideString CBC_OnedUPCAWriter::FilterContents(FX_WSTR contents) {
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -70,12 +70,12 @@ CFX_WideString CBC_OnedUPCAWriter::FilterContents(FX_WSTR contents) }
return filtercontents;
}
-FX_INT32 CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString &contents)
+int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString &contents)
{
- FX_INT32 odd = 0;
- FX_INT32 even = 0;
- FX_INT32 j = 1;
- for(FX_INT32 i = contents.GetLength() - 1; i >= 0; i--) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for(int32_t i = contents.GetLength() - 1; i >= 0; i--) {
if(j % 2) {
odd += FXSYS_atoi(contents.Mid(i, 1));
} else {
@@ -83,17 +83,17 @@ FX_INT32 CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString &contents) }
j++;
}
- FX_INT32 checksum = (odd * 3 + even) % 10;
+ int32_t checksum = (odd * 3 + even) % 10;
checksum = (10 - checksum) % 10;
return (checksum);
}
-FX_BYTE *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if (format != BCFORMAT_UPC_A) {
e = BCExceptionOnlyEncodeUPC_A;
@@ -101,20 +101,20 @@ FX_BYTE *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT for }
CFX_ByteString toEAN13String = '0' + contents;
m_iDataLenth = 13;
- FX_BYTE *ret = m_subWriter->Encode(toEAN13String, BCFORMAT_EAN_13, outWidth, outHeight, hints, e);
+ uint8_t *ret = m_subWriter->Encode(toEAN13String, BCFORMAT_EAN_13, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-void CBC_OnedUPCAWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OnedUPCAWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
return;
}
- FX_INT32 leftPadding = 7 * multiple;
- FX_INT32 leftPosition = 10 * multiple + leftPadding;
+ int32_t leftPadding = 7 * multiple;
+ int32_t leftPosition = 10 * multiple + leftPadding;
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLen = str.GetLength();
+ int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
if (!pCharPos) {
return;
@@ -129,8 +129,8 @@ void CBC_OnedUPCAWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C }
FX_FLOAT charsWidth = 0;
iLen = tempStr.GetLength();
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
if (pOutBitmap == NULL) {
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect((FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
@@ -278,7 +278,7 @@ void CBC_OnedUPCAWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C }
FX_Free(pCharPos);
}
-void CBC_OnedUPCAWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedUPCAWriter::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.h b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.h index 4174ceb36e..ff59f9b660 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.h +++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.h @@ -17,15 +17,15 @@ public: CBC_OnedUPCAWriter();
virtual ~CBC_OnedUPCAWriter();
virtual void Init();
- FX_BYTE* Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE* Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
+ uint8_t* Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t* Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
- FX_INT32 CalcChecksum(const CFX_ByteString &contents);
+ int32_t CalcChecksum(const CFX_ByteString &contents);
protected:
- void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e);
+ void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp index 96d3a3b655..366b172863 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp @@ -27,9 +27,9 @@ #include "BC_PDF417ErrorCorrection.h"
#include "BC_PDF417HighLevelEncoder.h"
#include "BC_PDF417.h"
-FX_INT32 CBC_PDF417::START_PATTERN = 0x1fea8;
-FX_INT32 CBC_PDF417::STOP_PATTERN = 0x3fa29;
-FX_INT32 CBC_PDF417::CODEWORD_TABLE[][1000] = {
+int32_t CBC_PDF417::START_PATTERN = 0x1fea8;
+int32_t CBC_PDF417::STOP_PATTERN = 0x3fa29;
+int32_t CBC_PDF417::CODEWORD_TABLE[][1000] = {
{
0x1d5c0, 0x1eaf0, 0x1f57c, 0x1d4e0, 0x1ea78, 0x1f53e,
0x1a8c0, 0x1d470, 0x1a860, 0x15040, 0x1a830, 0x15020,
@@ -535,28 +535,28 @@ CBC_BarcodeMatrix* CBC_PDF417::getBarcodeMatrix() {
return m_barcodeMatrix;
}
-void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, FX_INT32 errorCorrectionLevel, FX_INT32 &e)
+void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionLevel, int32_t &e)
{
- FX_INT32 errorCorrectionCodeWords = CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(errorCorrectionLevel, e);
+ int32_t errorCorrectionCodeWords = CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(errorCorrectionLevel, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
CFX_WideString highLevel = CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 sourceCodeWords = highLevel.GetLength();
+ int32_t sourceCodeWords = highLevel.GetLength();
CFX_Int32Array* dimension = determineDimensions(sourceCodeWords, errorCorrectionCodeWords, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 cols = dimension->GetAt(0);
- FX_INT32 rows = dimension->GetAt(1);
+ int32_t cols = dimension->GetAt(0);
+ int32_t rows = dimension->GetAt(1);
delete dimension;
- FX_INT32 pad = getNumberOfPadCodewords(sourceCodeWords, errorCorrectionCodeWords, cols, rows);
+ int32_t pad = getNumberOfPadCodewords(sourceCodeWords, errorCorrectionCodeWords, cols, rows);
if (sourceCodeWords + errorCorrectionCodeWords + 1 > 929) {
e = BCExceptionEncodedMessageContainsTooManyCodeWords;
return;
}
- FX_INT32 n = sourceCodeWords + pad + 1;
+ int32_t n = sourceCodeWords + pad + 1;
CFX_WideString sb;
sb += (FX_WCHAR) n;
sb += highLevel;
- for (FX_INT32 i = 0; i < pad; i++) {
+ for (int32_t i = 0; i < pad; i++) {
sb += (FX_WCHAR) 900;
}
CFX_WideString dataCodewords(sb);
@@ -566,7 +566,7 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, FX_INT32 errorCorrecti m_barcodeMatrix = FX_NEW CBC_BarcodeMatrix(rows, cols);
encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel, m_barcodeMatrix);
}
-void CBC_PDF417::setDimensions(FX_INT32 maxCols, FX_INT32 minCols, FX_INT32 maxRows, FX_INT32 minRows)
+void CBC_PDF417::setDimensions(int32_t maxCols, int32_t minCols, int32_t maxRows, int32_t minRows)
{
m_maxCols = maxCols;
m_minCols = minCols;
@@ -581,25 +581,25 @@ void CBC_PDF417::setCompact(FX_BOOL compact) {
m_compact = compact;
}
-FX_INT32 CBC_PDF417::calculateNumberOfRows(FX_INT32 m, FX_INT32 k, FX_INT32 c)
+int32_t CBC_PDF417::calculateNumberOfRows(int32_t m, int32_t k, int32_t c)
{
- FX_INT32 r = ((m + 1 + k) / c) + 1;
+ int32_t r = ((m + 1 + k) / c) + 1;
if (c * r >= (m + 1 + k + c)) {
r--;
}
return r;
}
-FX_INT32 CBC_PDF417::getNumberOfPadCodewords(FX_INT32 m, FX_INT32 k, FX_INT32 c, FX_INT32 r)
+int32_t CBC_PDF417::getNumberOfPadCodewords(int32_t m, int32_t k, int32_t c, int32_t r)
{
- FX_INT32 n = c * r - k;
+ int32_t n = c * r - k;
return n > m + 1 ? n - m - 1 : 0;
}
-void CBC_PDF417::encodeChar(FX_INT32 pattern, FX_INT32 len, CBC_BarcodeRow* logic)
+void CBC_PDF417::encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic)
{
- FX_INT32 map = 1 << (len - 1);
+ int32_t map = 1 << (len - 1);
FX_BOOL last = ((pattern & map) != 0);
- FX_INT32 width = 0;
- for (FX_INT32 i = 0; i < len; i++) {
+ int32_t width = 0;
+ for (int32_t i = 0; i < len; i++) {
FX_BOOL black = ((pattern & map) != 0);
if (last == black) {
width++;
@@ -612,16 +612,16 @@ void CBC_PDF417::encodeChar(FX_INT32 pattern, FX_INT32 len, CBC_BarcodeRow* logi }
logic->addBar(last, width);
}
-void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, FX_INT32 c, FX_INT32 r, FX_INT32 errorCorrectionLevel, CBC_BarcodeMatrix* logic)
+void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, int32_t c, int32_t r, int32_t errorCorrectionLevel, CBC_BarcodeMatrix* logic)
{
- FX_INT32 idx = 0;
- for (FX_INT32 y = 0; y < r; y++) {
- FX_INT32 cluster = y % 3;
+ int32_t idx = 0;
+ for (int32_t y = 0; y < r; y++) {
+ int32_t cluster = y % 3;
logic->startRow();
- FX_INT32 a = START_PATTERN;
+ int32_t a = START_PATTERN;
encodeChar(START_PATTERN, 17, logic->getCurrentRow());
- FX_INT32 left;
- FX_INT32 right;
+ int32_t left;
+ int32_t right;
if (cluster == 0) {
left = (30 * (y / 3)) + ((r - 1) / 3);
right = (30 * (y / 3)) + (c - 1);
@@ -632,9 +632,9 @@ void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, FX_INT32 c, FX_INT left = (30 * (y / 3)) + (c - 1);
right = (30 * (y / 3)) + (errorCorrectionLevel * 3) + ((r - 1) % 3);
}
- FX_INT32 pattern = CODEWORD_TABLE[cluster][left];
+ int32_t pattern = CODEWORD_TABLE[cluster][left];
encodeChar(pattern, 17, logic->getCurrentRow());
- for (FX_INT32 x = 0; x < c; x++) {
+ for (int32_t x = 0; x < c; x++) {
pattern = CODEWORD_TABLE[cluster][fullCodewords.GetAt(idx)];
encodeChar(pattern, 17, logic->getCurrentRow());
idx++;
@@ -648,12 +648,12 @@ void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, FX_INT32 c, FX_INT }
}
}
-CFX_Int32Array* CBC_PDF417::determineDimensions(FX_INT32 sourceCodeWords, FX_INT32 errorCorrectionCodeWords, FX_INT32 &e)
+CFX_Int32Array* CBC_PDF417::determineDimensions(int32_t sourceCodeWords, int32_t errorCorrectionCodeWords, int32_t &e)
{
FX_FLOAT ratio = 0.0f;
CFX_Int32Array* dimension = NULL;
- for (FX_INT32 cols = m_minCols; cols <= m_maxCols; cols++) {
- FX_INT32 rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols);
+ for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) {
+ int32_t rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols);
if (rows < m_minRows) {
break;
}
@@ -673,7 +673,7 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(FX_INT32 sourceCodeWords, FX_INT dimension->Add(rows);
}
if (dimension == NULL) {
- FX_INT32 rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, m_minCols);
+ int32_t rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, m_minCols);
if (rows < m_minRows) {
dimension = FX_NEW CFX_Int32Array;
dimension->Add(m_minCols);
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417.h b/xfa/src/fxbarcode/pdf417/BC_PDF417.h index 928afe80d2..21d902ef7a 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417.h @@ -16,29 +16,29 @@ public: CBC_PDF417(FX_BOOL compact);
virtual ~CBC_PDF417();
CBC_BarcodeMatrix* getBarcodeMatrix();
- void generateBarcodeLogic(CFX_WideString msg, FX_INT32 errorCorrectionLevel, FX_INT32 &e);
- void setDimensions(FX_INT32 maxCols, FX_INT32 minCols, FX_INT32 maxRows, FX_INT32 minRows);
+ void generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionLevel, int32_t &e);
+ void setDimensions(int32_t maxCols, int32_t minCols, int32_t maxRows, int32_t minRows);
void setCompaction(Compaction compaction);
void setCompact(FX_BOOL compact);
private:
- static FX_INT32 START_PATTERN;
- static FX_INT32 STOP_PATTERN;
- static FX_INT32 CODEWORD_TABLE[][1000];
+ static int32_t START_PATTERN;
+ static int32_t STOP_PATTERN;
+ static int32_t CODEWORD_TABLE[][1000];
static FX_FLOAT PREFERRED_RATIO;
static FX_FLOAT DEFAULT_MODULE_WIDTH;
static FX_FLOAT HEIGHT;
CBC_BarcodeMatrix* m_barcodeMatrix;
FX_BOOL m_compact;
Compaction m_compaction;
- FX_INT32 m_minCols;
- FX_INT32 m_maxCols;
- FX_INT32 m_maxRows;
- FX_INT32 m_minRows;
+ int32_t m_minCols;
+ int32_t m_maxCols;
+ int32_t m_maxRows;
+ int32_t m_minRows;
private:
- static FX_INT32 calculateNumberOfRows(FX_INT32 m, FX_INT32 k, FX_INT32 c);
- static FX_INT32 getNumberOfPadCodewords(FX_INT32 m, FX_INT32 k, FX_INT32 c, FX_INT32 r);
- static void encodeChar(FX_INT32 pattern, FX_INT32 len, CBC_BarcodeRow* logic);
- void encodeLowLevel(CFX_WideString fullCodewords, FX_INT32 c, FX_INT32 r, FX_INT32 errorCorrectionLevel, CBC_BarcodeMatrix* logic);
- CFX_Int32Array* determineDimensions(FX_INT32 sourceCodeWords, FX_INT32 errorCorrectionCodeWords, FX_INT32 &e);
+ static int32_t calculateNumberOfRows(int32_t m, int32_t k, int32_t c);
+ static int32_t getNumberOfPadCodewords(int32_t m, int32_t k, int32_t c, int32_t r);
+ static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic);
+ void encodeLowLevel(CFX_WideString fullCodewords, int32_t c, int32_t r, int32_t errorCorrectionLevel, CBC_BarcodeMatrix* logic);
+ CFX_Int32Array* determineDimensions(int32_t sourceCodeWords, int32_t errorCorrectionCodeWords, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp index e45562ba79..aa30e25d49 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp @@ -23,10 +23,10 @@ #include "../barcode.h"
#include "BC_PDF417BarcodeRow.h"
#include "BC_PDF417BarcodeMatrix.h"
-CBC_BarcodeMatrix::CBC_BarcodeMatrix(FX_INT32 height, FX_INT32 width)
+CBC_BarcodeMatrix::CBC_BarcodeMatrix(int32_t height, int32_t width)
{
m_matrix.SetSize(height + 2);
- for (FX_INT32 i = 0, matrixLength = m_matrix.GetSize(); i < matrixLength; i++) {
+ for (int32_t i = 0, matrixLength = m_matrix.GetSize(); i < matrixLength; i++) {
m_matrix[i] = FX_NEW CBC_BarcodeRow((width + 4) * 17 + 1);
}
m_width = width * 17;
@@ -37,19 +37,19 @@ CBC_BarcodeMatrix::CBC_BarcodeMatrix(FX_INT32 height, FX_INT32 width) }
CBC_BarcodeMatrix::~CBC_BarcodeMatrix()
{
- for (FX_INT32 i = 0; i < m_matrix.GetSize(); i++) {
+ for (int32_t i = 0; i < m_matrix.GetSize(); i++) {
delete (CBC_BarcodeRow*)m_matrix.GetAt(i);
}
m_matrix.RemoveAll();
m_matrixOut.RemoveAll();
}
-void CBC_BarcodeMatrix::set(FX_INT32 x, FX_INT32 y, FX_BYTE value)
+void CBC_BarcodeMatrix::set(int32_t x, int32_t y, uint8_t value)
{
((CBC_BarcodeRow*)m_matrix[y])->set(x, value);
}
-void CBC_BarcodeMatrix::setMatrix(FX_INT32 x, FX_INT32 y, FX_BOOL black)
+void CBC_BarcodeMatrix::setMatrix(int32_t x, int32_t y, FX_BOOL black)
{
- set(x, y, (FX_BYTE) (black ? 1 : 0));
+ set(x, y, (uint8_t) (black ? 1 : 0));
}
void CBC_BarcodeMatrix::startRow()
{
@@ -59,11 +59,11 @@ CBC_BarcodeRow* CBC_BarcodeMatrix::getCurrentRow() {
return (CBC_BarcodeRow*)m_matrix[m_currentRow];
}
-FX_INT32 CBC_BarcodeMatrix::getWidth()
+int32_t CBC_BarcodeMatrix::getWidth()
{
return m_outWidth;
}
-FX_INT32 CBC_BarcodeMatrix::getHeight()
+int32_t CBC_BarcodeMatrix::getHeight()
{
return m_outHeight;
}
@@ -71,26 +71,26 @@ CFX_ByteArray& CBC_BarcodeMatrix::getMatrix() {
return getScaledMatrix(1, 1);
}
-CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(FX_INT32 scale)
+CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale)
{
return getScaledMatrix(scale, scale);
}
-CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(FX_INT32 xScale, FX_INT32 yScale)
+CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale, int32_t yScale)
{
- FX_INT32 yMax = m_height * yScale;
+ int32_t yMax = m_height * yScale;
CFX_ByteArray bytearray;
bytearray.Copy(((CBC_BarcodeRow*)m_matrix[0])->getScaledRow(xScale));
- FX_INT32 xMax = bytearray.GetSize();
+ int32_t xMax = bytearray.GetSize();
m_matrixOut.SetSize(xMax * yMax);
m_outWidth = xMax;
m_outHeight = yMax;
- FX_INT32 k = 0;
- for (FX_INT32 i = 0; i < yMax; i++) {
+ int32_t k = 0;
+ for (int32_t i = 0; i < yMax; i++) {
if (i != 0) {
bytearray.Copy(((CBC_BarcodeRow*)m_matrix[i / yScale])->getScaledRow(xScale));
}
k = i * xMax;
- for (FX_INT32 l = 0; l < xMax; l++) {
+ for (int32_t l = 0; l < xMax; l++) {
m_matrixOut[k + l] = bytearray.GetAt(l);
}
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h index ce0681bfa8..f5f035dbca 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h @@ -11,24 +11,24 @@ class CBC_BarcodeMatrix {
public:
CBC_BarcodeMatrix();
- CBC_BarcodeMatrix(FX_INT32 height, FX_INT32 width);
+ CBC_BarcodeMatrix(int32_t height, int32_t width);
virtual ~CBC_BarcodeMatrix();
- void set(FX_INT32 x, FX_INT32 y, FX_BYTE value);
- void setMatrix(FX_INT32 x, FX_INT32 y, FX_BOOL black);
+ void set(int32_t x, int32_t y, uint8_t value);
+ void setMatrix(int32_t x, int32_t y, FX_BOOL black);
void startRow();
CBC_BarcodeRow* getCurrentRow();
CFX_ByteArray& getMatrix();
- CFX_ByteArray& getScaledMatrix(FX_INT32 scale);
- CFX_ByteArray& getScaledMatrix(FX_INT32 xScale, FX_INT32 yScale);
- FX_INT32 getWidth();
- FX_INT32 getHeight();
+ CFX_ByteArray& getScaledMatrix(int32_t scale);
+ CFX_ByteArray& getScaledMatrix(int32_t xScale, int32_t yScale);
+ int32_t getWidth();
+ int32_t getHeight();
private:
CFX_PtrArray m_matrix;
CFX_ByteArray m_matrixOut;
- FX_INT32 m_currentRow;
- FX_INT32 m_height;
- FX_INT32 m_width;
- FX_INT32 m_outWidth;
- FX_INT32 m_outHeight;
+ int32_t m_currentRow;
+ int32_t m_height;
+ int32_t m_width;
+ int32_t m_outWidth;
+ int32_t m_outHeight;
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp index 456c0e6f2e..fc3f255ec0 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp @@ -22,7 +22,7 @@ #include "../barcode.h"
#include "BC_PDF417BarcodeMetadata.h"
-CBC_BarcodeMetadata::CBC_BarcodeMetadata(FX_INT32 columnCount, FX_INT32 rowCountUpperPart, FX_INT32 rowCountLowerPart, FX_INT32 errorCorrectionLevel)
+CBC_BarcodeMetadata::CBC_BarcodeMetadata(int32_t columnCount, int32_t rowCountUpperPart, int32_t rowCountLowerPart, int32_t errorCorrectionLevel)
{
m_columnCount = columnCount;
m_rowCountUpperPart = rowCountUpperPart;
@@ -33,23 +33,23 @@ CBC_BarcodeMetadata::CBC_BarcodeMetadata(FX_INT32 columnCount, FX_INT32 rowCount CBC_BarcodeMetadata::~CBC_BarcodeMetadata()
{
}
-FX_INT32 CBC_BarcodeMetadata::getColumnCount()
+int32_t CBC_BarcodeMetadata::getColumnCount()
{
return m_columnCount;
}
-FX_INT32 CBC_BarcodeMetadata::getErrorCorrectionLevel()
+int32_t CBC_BarcodeMetadata::getErrorCorrectionLevel()
{
return m_errorCorrectionLevel;
}
-FX_INT32 CBC_BarcodeMetadata::getRowCount()
+int32_t CBC_BarcodeMetadata::getRowCount()
{
return m_rowCount;
}
-FX_INT32 CBC_BarcodeMetadata::getRowCountUpperPart()
+int32_t CBC_BarcodeMetadata::getRowCountUpperPart()
{
return m_rowCountUpperPart;
}
-FX_INT32 CBC_BarcodeMetadata::getRowCountLowerPart()
+int32_t CBC_BarcodeMetadata::getRowCountLowerPart()
{
return m_rowCountLowerPart;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h index 6e2aa4d952..f25e37c1b4 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h @@ -10,18 +10,18 @@ class CBC_BarcodeMetadata; class CBC_BarcodeMetadata
{
public:
- CBC_BarcodeMetadata(FX_INT32 columnCount, FX_INT32 rowCountUpperPart, FX_INT32 rowCountLowerPart, FX_INT32 errorCorrectionLevel);
+ CBC_BarcodeMetadata(int32_t columnCount, int32_t rowCountUpperPart, int32_t rowCountLowerPart, int32_t errorCorrectionLevel);
virtual ~CBC_BarcodeMetadata();
- FX_INT32 getColumnCount();
- FX_INT32 getErrorCorrectionLevel();
- FX_INT32 getRowCount();
- FX_INT32 getRowCountUpperPart();
- FX_INT32 getRowCountLowerPart();
+ int32_t getColumnCount();
+ int32_t getErrorCorrectionLevel();
+ int32_t getRowCount();
+ int32_t getRowCountUpperPart();
+ int32_t getRowCountLowerPart();
private:
- FX_INT32 m_columnCount;
- FX_INT32 m_errorCorrectionLevel;
- FX_INT32 m_rowCountUpperPart;
- FX_INT32 m_rowCountLowerPart;
- FX_INT32 m_rowCount;
+ int32_t m_columnCount;
+ int32_t m_errorCorrectionLevel;
+ int32_t m_rowCountUpperPart;
+ int32_t m_rowCountLowerPart;
+ int32_t m_rowCount;
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp index 02bc0f5574..8918d32600 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp @@ -22,7 +22,7 @@ #include "../barcode.h"
#include "BC_PDF417BarcodeRow.h"
-CBC_BarcodeRow::CBC_BarcodeRow(FX_INT32 width)
+CBC_BarcodeRow::CBC_BarcodeRow(int32_t width)
{
m_row.SetSize(width);
m_currentLocation = 0;
@@ -32,17 +32,17 @@ CBC_BarcodeRow::~CBC_BarcodeRow() m_output.RemoveAll();
m_row.RemoveAll();
}
-void CBC_BarcodeRow::set(FX_INT32 x, FX_BYTE value)
+void CBC_BarcodeRow::set(int32_t x, uint8_t value)
{
m_row.SetAt(x, value);
}
-void CBC_BarcodeRow::set(FX_INT32 x, FX_BOOL black)
+void CBC_BarcodeRow::set(int32_t x, FX_BOOL black)
{
- m_row.SetAt(x, (FX_BYTE) (black ? 1 : 0));
+ m_row.SetAt(x, (uint8_t) (black ? 1 : 0));
}
-void CBC_BarcodeRow::addBar(FX_BOOL black, FX_INT32 width)
+void CBC_BarcodeRow::addBar(FX_BOOL black, int32_t width)
{
- for (FX_INT32 ii = 0; ii < width; ii++) {
+ for (int32_t ii = 0; ii < width; ii++) {
set(m_currentLocation++, black);
}
}
@@ -50,10 +50,10 @@ CFX_ByteArray& CBC_BarcodeRow::getRow() {
return m_row;
}
-CFX_ByteArray& CBC_BarcodeRow::getScaledRow(FX_INT32 scale)
+CFX_ByteArray& CBC_BarcodeRow::getScaledRow(int32_t scale)
{
m_output.SetSize(m_row.GetSize() * scale);
- for (FX_INT32 i = 0; i < m_output.GetSize(); i++) {
+ for (int32_t i = 0; i < m_output.GetSize(); i++) {
m_output[i] = (m_row[i / scale]);
}
return m_output;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h index c5520f6440..0fd1003477 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h @@ -9,16 +9,16 @@ class CBC_BarcodeRow
{
public:
- CBC_BarcodeRow(FX_INT32 width);
+ CBC_BarcodeRow(int32_t width);
virtual ~CBC_BarcodeRow();
- void set(FX_INT32 x, FX_BYTE value);
- void set(FX_INT32 x, FX_BOOL black);
- void addBar(FX_BOOL black, FX_INT32 width);
+ void set(int32_t x, uint8_t value);
+ void set(int32_t x, FX_BOOL black);
+ void addBar(FX_BOOL black, int32_t width);
CFX_ByteArray& getRow();
- CFX_ByteArray& getScaledRow(FX_INT32 scale);
+ CFX_ByteArray& getScaledRow(int32_t scale);
private:
CFX_ByteArray m_row;
CFX_ByteArray m_output;
- FX_INT32 m_currentLocation;
+ int32_t m_currentLocation;
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp index 446ef58a48..90fbea9897 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp @@ -29,10 +29,10 @@ CBC_BarcodeValue::CBC_BarcodeValue() CBC_BarcodeValue::~CBC_BarcodeValue()
{
}
-void CBC_BarcodeValue::setValue(FX_INT32 value)
+void CBC_BarcodeValue::setValue(int32_t value)
{
- FX_INT32 confidence = 0;
- for (FX_INT32 i = 0; i < m_keys.GetSize(); i++) {
+ int32_t confidence = 0;
+ for (int32_t i = 0; i < m_keys.GetSize(); i++) {
if (m_keys.GetAt(i) == value) {
confidence = m_values.GetAt(i);
m_values.SetAt(i, confidence + 1);
@@ -45,9 +45,9 @@ void CBC_BarcodeValue::setValue(FX_INT32 value) }
CFX_Int32Array* CBC_BarcodeValue::getValue()
{
- FX_INT32 maxConfidence = -1;
+ int32_t maxConfidence = -1;
CFX_Int32Array* result = FX_NEW CFX_Int32Array;
- for (FX_INT32 i = 0; i < m_keys.GetSize(); i++) {
+ for (int32_t i = 0; i < m_keys.GetSize(); i++) {
if (m_values.GetAt(i) > maxConfidence) {
maxConfidence = m_values.GetAt(i);
result->RemoveAll();
@@ -58,9 +58,9 @@ CFX_Int32Array* CBC_BarcodeValue::getValue() }
return result;
}
-FX_INT32 CBC_BarcodeValue::getConfidence(FX_INT32 value)
+int32_t CBC_BarcodeValue::getConfidence(int32_t value)
{
- for (FX_INT32 i = 0; i < m_keys.GetSize(); i++)
+ for (int32_t i = 0; i < m_keys.GetSize(); i++)
if (m_keys.GetAt(i) == value) {
return m_values.GetAt(i);
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h index 6922d410f0..7729e04a14 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h @@ -11,9 +11,9 @@ class CBC_BarcodeValue public:
CBC_BarcodeValue();
virtual ~CBC_BarcodeValue();
- void setValue(FX_INT32 value);
+ void setValue(int32_t value);
CFX_Int32Array* getValue();
- FX_INT32 getConfidence(FX_INT32 value);
+ int32_t getConfidence(int32_t value);
private:
CFX_Int32Array m_keys;
CFX_Int32Array m_values;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp index 55f4cb4510..fec4abcafa 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp @@ -24,7 +24,7 @@ #include "../BC_ResultPoint.h"
#include "../common/BC_CommonBitMatrix.h"
#include "BC_PDF417BoundingBox.h"
-CBC_BoundingBox::CBC_BoundingBox(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight, FX_INT32 &e)
+CBC_BoundingBox::CBC_BoundingBox(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight, int32_t &e)
{
if ((topLeft == NULL && topRight == NULL) ||
(bottomLeft == NULL && bottomRight == NULL) ||
@@ -53,7 +53,7 @@ CBC_BoundingBox::~CBC_BoundingBox() delete m_bottomRight;
}
}
-CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox, CBC_BoundingBox* rightBox, FX_INT32 &e)
+CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox, CBC_BoundingBox* rightBox, int32_t &e)
{
CBC_BoundingBox* boundingBox = NULL;
if (leftBox == NULL) {
@@ -68,7 +68,7 @@ CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox, CBC_BoundingBo BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return boundingBox;
}
-CBC_BoundingBox* CBC_BoundingBox::addMissingRows(FX_INT32 missingStartRows, FX_INT32 missingEndRows, FX_BOOL isLeft, FX_INT32 &e)
+CBC_BoundingBox* CBC_BoundingBox::addMissingRows(int32_t missingStartRows, int32_t missingEndRows, FX_BOOL isLeft, int32_t &e)
{
CBC_ResultPoint* newTopLeft = m_topLeft;
CBC_ResultPoint* newBottomLeft = m_bottomLeft;
@@ -78,7 +78,7 @@ CBC_BoundingBox* CBC_BoundingBox::addMissingRows(FX_INT32 missingStartRows, FX_I CBC_ResultPoint* newBottom = NULL;
if (missingStartRows > 0) {
CBC_ResultPoint* top = isLeft ? m_topLeft : m_topRight;
- FX_INT32 newMinY = (FX_INT32) top->GetY() - missingStartRows;
+ int32_t newMinY = (int32_t) top->GetY() - missingStartRows;
if (newMinY < 0) {
newMinY = 0;
}
@@ -91,7 +91,7 @@ CBC_BoundingBox* CBC_BoundingBox::addMissingRows(FX_INT32 missingStartRows, FX_I }
if (missingEndRows > 0) {
CBC_ResultPoint* bottom = isLeft ? m_bottomLeft : m_bottomRight;
- FX_INT32 newMaxY = (FX_INT32) bottom->GetY() + missingEndRows;
+ int32_t newMaxY = (int32_t) bottom->GetY() + missingEndRows;
if (newMaxY >= m_image->GetHeight()) {
newMaxY = m_image->GetHeight() - 1;
}
@@ -125,19 +125,19 @@ void CBC_BoundingBox::setBottomRight(CBC_ResultPoint bottomRight) m_bottomRight = FX_NEW CBC_ResultPoint(bottomRight.GetX(), bottomRight.GetY());
calculateMinMaxValues();
}
-FX_INT32 CBC_BoundingBox::getMinX()
+int32_t CBC_BoundingBox::getMinX()
{
return m_minX;
}
-FX_INT32 CBC_BoundingBox::getMaxX()
+int32_t CBC_BoundingBox::getMaxX()
{
return m_maxX;
}
-FX_INT32 CBC_BoundingBox::getMinY()
+int32_t CBC_BoundingBox::getMinY()
{
return m_minY;
}
-FX_INT32 CBC_BoundingBox::getMaxY()
+int32_t CBC_BoundingBox::getMaxY()
{
return m_maxY;
}
@@ -187,8 +187,8 @@ void CBC_BoundingBox::calculateMinMaxValues() m_topRight = FX_NEW CBC_ResultPoint((FX_FLOAT)m_image->GetWidth() - 1, (FX_FLOAT)m_topLeft->GetY());
m_bottomRight = FX_NEW CBC_ResultPoint((FX_FLOAT)m_image->GetWidth() - 1, (FX_FLOAT)m_bottomLeft->GetY());
}
- m_minX = (FX_INT32) (m_topLeft->GetX() < m_bottomLeft->GetX() ? m_topLeft->GetX() : m_bottomLeft->GetX());
- m_maxX = (FX_INT32) (m_topRight->GetX() > m_bottomRight->GetX() ? m_topRight->GetX() : m_bottomRight->GetX());
- m_minY = (FX_INT32) (m_topLeft->GetY() < m_topRight->GetY() ? m_topLeft->GetY() : m_topRight->GetY());
- m_maxY = (FX_INT32) (m_bottomLeft->GetY() > m_bottomRight->GetY() ? m_bottomLeft->GetY() : m_bottomRight->GetY());
+ m_minX = (int32_t) (m_topLeft->GetX() < m_bottomLeft->GetX() ? m_topLeft->GetX() : m_bottomLeft->GetX());
+ m_maxX = (int32_t) (m_topRight->GetX() > m_bottomRight->GetX() ? m_topRight->GetX() : m_bottomRight->GetX());
+ m_minY = (int32_t) (m_topLeft->GetY() < m_topRight->GetY() ? m_topLeft->GetY() : m_topRight->GetY());
+ m_maxY = (int32_t) (m_bottomLeft->GetY() > m_bottomRight->GetY() ? m_bottomLeft->GetY() : m_bottomRight->GetY());
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h index 26bd1881c3..97d8406fd4 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h @@ -11,17 +11,17 @@ class CBC_ResultPoint; class CBC_BoundingBox
{
public:
- CBC_BoundingBox(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight, FX_INT32 &e);
+ CBC_BoundingBox(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight, int32_t &e);
CBC_BoundingBox(CBC_BoundingBox* boundingBox);
virtual ~CBC_BoundingBox();
- static CBC_BoundingBox* merge(CBC_BoundingBox* leftBox, CBC_BoundingBox* rightBox, FX_INT32 &e);
- CBC_BoundingBox* addMissingRows(FX_INT32 missingStartRows, FX_INT32 missingEndRows, FX_BOOL isLeft, FX_INT32 &e);
+ static CBC_BoundingBox* merge(CBC_BoundingBox* leftBox, CBC_BoundingBox* rightBox, int32_t &e);
+ CBC_BoundingBox* addMissingRows(int32_t missingStartRows, int32_t missingEndRows, FX_BOOL isLeft, int32_t &e);
void setTopRight(CBC_ResultPoint topRight);
void setBottomRight(CBC_ResultPoint bottomRight);
- FX_INT32 getMinX();
- FX_INT32 getMaxX();
- FX_INT32 getMinY();
- FX_INT32 getMaxY();
+ int32_t getMinX();
+ int32_t getMaxX();
+ int32_t getMinY();
+ int32_t getMaxY();
CBC_ResultPoint* getTopLeft();
CBC_ResultPoint* getTopRight();
CBC_ResultPoint* getBottomLeft();
@@ -32,10 +32,10 @@ private: CBC_ResultPoint* m_bottomLeft;
CBC_ResultPoint* m_topRight;
CBC_ResultPoint* m_bottomRight;
- FX_INT32 m_minX;
- FX_INT32 m_maxX;
- FX_INT32 m_minY;
- FX_INT32 m_maxY;
+ int32_t m_minX;
+ int32_t m_maxX;
+ int32_t m_minY;
+ int32_t m_maxY;
void init(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight);
void calculateMinMaxValues();
};
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp index 9ac65ab7bc..8449a7ed06 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp @@ -22,8 +22,8 @@ #include "../barcode.h"
#include "BC_PDF417Codeword.h"
-FX_INT32 CBC_Codeword::BARCODE_ROW_UNKNOWN = -1;
-CBC_Codeword::CBC_Codeword(FX_INT32 startX, FX_INT32 endX, FX_INT32 bucket, FX_INT32 cvalue)
+int32_t CBC_Codeword::BARCODE_ROW_UNKNOWN = -1;
+CBC_Codeword::CBC_Codeword(int32_t startX, int32_t endX, int32_t bucket, int32_t cvalue)
{
m_startX = startX;
m_endX = endX;
@@ -38,7 +38,7 @@ FX_BOOL CBC_Codeword::hasValidRowNumber() {
return isValidRowNumber(m_rowNumber);
}
-FX_BOOL CBC_Codeword::isValidRowNumber(FX_INT32 rowNumber)
+FX_BOOL CBC_Codeword::isValidRowNumber(int32_t rowNumber)
{
return m_rowNumber != BARCODE_ROW_UNKNOWN && m_bucket == (m_rowNumber % 3) * 3;
}
@@ -46,31 +46,31 @@ void CBC_Codeword::setRowNumberAsRowIndicatorColumn() {
m_rowNumber = (m_value / 30) * 3 + m_bucket / 3;
}
-FX_INT32 CBC_Codeword::getWidth()
+int32_t CBC_Codeword::getWidth()
{
return m_endX - m_startX;
}
-FX_INT32 CBC_Codeword::getStartX()
+int32_t CBC_Codeword::getStartX()
{
return m_startX;
}
-FX_INT32 CBC_Codeword::getEndX()
+int32_t CBC_Codeword::getEndX()
{
return m_endX;
}
-FX_INT32 CBC_Codeword::getBucket()
+int32_t CBC_Codeword::getBucket()
{
return m_bucket;
}
-FX_INT32 CBC_Codeword::getValue()
+int32_t CBC_Codeword::getValue()
{
return m_value;
}
-FX_INT32 CBC_Codeword::getRowNumber()
+int32_t CBC_Codeword::getRowNumber()
{
return m_rowNumber;
}
-void CBC_Codeword::setRowNumber(FX_INT32 rowNumber)
+void CBC_Codeword::setRowNumber(int32_t rowNumber)
{
m_rowNumber = rowNumber;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h index ea0524cbf8..ef5e0aefc7 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h @@ -9,25 +9,25 @@ class CBC_Codeword
{
public:
- CBC_Codeword(FX_INT32 startX, FX_INT32 endX, FX_INT32 bucket, FX_INT32 value);
+ CBC_Codeword(int32_t startX, int32_t endX, int32_t bucket, int32_t value);
virtual ~CBC_Codeword();
FX_BOOL hasValidRowNumber() ;
- FX_BOOL isValidRowNumber(FX_INT32 rowNumber);
+ FX_BOOL isValidRowNumber(int32_t rowNumber);
void setRowNumberAsRowIndicatorColumn();
- FX_INT32 getWidth();
- FX_INT32 getStartX();
- FX_INT32 getEndX();
- FX_INT32 getBucket();
- FX_INT32 getValue();
- FX_INT32 getRowNumber();
- void setRowNumber(FX_INT32 rowNumber);
+ int32_t getWidth();
+ int32_t getStartX();
+ int32_t getEndX();
+ int32_t getBucket();
+ int32_t getValue();
+ int32_t getRowNumber();
+ void setRowNumber(int32_t rowNumber);
CFX_ByteString toString();
private:
- static FX_INT32 BARCODE_ROW_UNKNOWN;
- FX_INT32 m_startX;
- FX_INT32 m_endX;
- FX_INT32 m_bucket;
- FX_INT32 m_value;
- FX_INT32 m_rowNumber;
+ static int32_t BARCODE_ROW_UNKNOWN;
+ int32_t m_startX;
+ int32_t m_endX;
+ int32_t m_bucket;
+ int32_t m_value;
+ int32_t m_rowNumber;
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp index bf16bc25e0..822a47a4d4 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp @@ -34,10 +34,10 @@ CBC_PDF417CodewordDecoder::~CBC_PDF417CodewordDecoder() }
void CBC_PDF417CodewordDecoder::Initialize()
{
- for (FX_INT32 i = 0; i < SYMBOL_TABLE_Length; i++) {
- FX_INT32 currentSymbol = CBC_PDF417Common::SYMBOL_TABLE[i];
- FX_INT32 currentBit = currentSymbol & 0x1;
- for (FX_INT32 j = 0; j < CBC_PDF417Common::BARS_IN_MODULE; j++) {
+ for (int32_t i = 0; i < SYMBOL_TABLE_Length; i++) {
+ int32_t currentSymbol = CBC_PDF417Common::SYMBOL_TABLE[i];
+ int32_t currentBit = currentSymbol & 0x1;
+ for (int32_t j = 0; j < CBC_PDF417Common::BARS_IN_MODULE; j++) {
FX_FLOAT size = 0.0f;
while ((currentSymbol & 0x1) == currentBit) {
size += 1.0f;
@@ -51,10 +51,10 @@ void CBC_PDF417CodewordDecoder::Initialize() void CBC_PDF417CodewordDecoder::Finalize()
{
}
-FX_INT32 CBC_PDF417CodewordDecoder::getDecodedValue(CFX_Int32Array& moduleBitCount)
+int32_t CBC_PDF417CodewordDecoder::getDecodedValue(CFX_Int32Array& moduleBitCount)
{
CFX_Int32Array* array = sampleBitCounts(moduleBitCount);
- FX_INT32 decodedValue = getDecodedCodewordValue(*array);
+ int32_t decodedValue = getDecodedCodewordValue(*array);
delete array;
if (decodedValue != -1) {
return decodedValue;
@@ -66,9 +66,9 @@ CFX_Int32Array* CBC_PDF417CodewordDecoder::sampleBitCounts(CFX_Int32Array& modul FX_FLOAT bitCountSum = (FX_FLOAT)CBC_PDF417Common::getBitCountSum(moduleBitCount);
CFX_Int32Array* bitCount = FX_NEW CFX_Int32Array();
bitCount->SetSize(CBC_PDF417Common::BARS_IN_MODULE);
- FX_INT32 bitCountIndex = 0;
- FX_INT32 sumPreviousBits = 0;
- for (FX_INT32 i = 0; i < CBC_PDF417Common::MODULES_IN_CODEWORD; i++) {
+ int32_t bitCountIndex = 0;
+ int32_t sumPreviousBits = 0;
+ for (int32_t i = 0; i < CBC_PDF417Common::MODULES_IN_CODEWORD; i++) {
FX_FLOAT sampleIndex = bitCountSum / (2 * CBC_PDF417Common::MODULES_IN_CODEWORD) + (i * bitCountSum) / CBC_PDF417Common::MODULES_IN_CODEWORD;
if (sumPreviousBits + moduleBitCount.GetAt(bitCountIndex) <= sampleIndex) {
sumPreviousBits += moduleBitCount.GetAt(bitCountIndex);
@@ -78,34 +78,34 @@ CFX_Int32Array* CBC_PDF417CodewordDecoder::sampleBitCounts(CFX_Int32Array& modul }
return bitCount;
}
-FX_INT32 CBC_PDF417CodewordDecoder::getDecodedCodewordValue(CFX_Int32Array& moduleBitCount)
+int32_t CBC_PDF417CodewordDecoder::getDecodedCodewordValue(CFX_Int32Array& moduleBitCount)
{
- FX_INT32 decodedValue = getBitValue(moduleBitCount);
+ int32_t decodedValue = getBitValue(moduleBitCount);
return CBC_PDF417Common::getCodeword(decodedValue) == -1 ? -1 : decodedValue;
}
-FX_INT32 CBC_PDF417CodewordDecoder::getBitValue(CFX_Int32Array& moduleBitCount)
+int32_t CBC_PDF417CodewordDecoder::getBitValue(CFX_Int32Array& moduleBitCount)
{
- FX_INT64 result = 0;
- for (FX_INT32 i = 0; i < moduleBitCount.GetSize(); i++) {
- for (FX_INT32 bit = 0; bit < moduleBitCount.GetAt(i); bit++) {
+ int64_t result = 0;
+ for (int32_t i = 0; i < moduleBitCount.GetSize(); i++) {
+ for (int32_t bit = 0; bit < moduleBitCount.GetAt(i); bit++) {
result = (result << 1) | (i % 2 == 0 ? 1 : 0);
}
}
- return (FX_INT32) result;
+ return (int32_t) result;
}
-FX_INT32 CBC_PDF417CodewordDecoder::getClosestDecodedValue(CFX_Int32Array& moduleBitCount)
+int32_t CBC_PDF417CodewordDecoder::getClosestDecodedValue(CFX_Int32Array& moduleBitCount)
{
- FX_INT32 bitCountSum = CBC_PDF417Common::getBitCountSum(moduleBitCount);
+ int32_t bitCountSum = CBC_PDF417Common::getBitCountSum(moduleBitCount);
CFX_FloatArray bitCountRatios;
bitCountRatios.SetSize(CBC_PDF417Common::BARS_IN_MODULE);
- for (FX_INT32 i = 0; i < bitCountRatios.GetSize(); i++) {
+ for (int32_t i = 0; i < bitCountRatios.GetSize(); i++) {
bitCountRatios[i] = moduleBitCount.GetAt(i) / (FX_FLOAT) bitCountSum;
}
FX_FLOAT bestMatchError = (FX_FLOAT)Float_MAX_VALUE;
- FX_INT32 bestMatch = -1;
- for (FX_INT32 j = 0; j < SYMBOL_TABLE_Length; j++) {
+ int32_t bestMatch = -1;
+ for (int32_t j = 0; j < SYMBOL_TABLE_Length; j++) {
FX_FLOAT error = 0.0f;
- for (FX_INT32 k = 0; k < CBC_PDF417Common::BARS_IN_MODULE; k++) {
+ for (int32_t k = 0; k < CBC_PDF417Common::BARS_IN_MODULE; k++) {
FX_FLOAT diff = RATIOS_TABLE[j][k] - bitCountRatios[k];
error += diff * diff;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h index f76d16d015..424d31b2ce 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h @@ -16,12 +16,12 @@ public: virtual ~CBC_PDF417CodewordDecoder();
static void Initialize();
static void Finalize();
- static FX_INT32 getDecodedValue(CFX_Int32Array& moduleBitCount);
+ static int32_t getDecodedValue(CFX_Int32Array& moduleBitCount);
private:
static FX_FLOAT RATIOS_TABLE[][8];
static CFX_Int32Array* sampleBitCounts(CFX_Int32Array& moduleBitCount);
- static FX_INT32 getDecodedCodewordValue(CFX_Int32Array& moduleBitCount);
- static FX_INT32 getBitValue(CFX_Int32Array& moduleBitCount);
- static FX_INT32 getClosestDecodedValue(CFX_Int32Array& moduleBitCount);
+ static int32_t getDecodedCodewordValue(CFX_Int32Array& moduleBitCount);
+ static int32_t getBitValue(CFX_Int32Array& moduleBitCount);
+ static int32_t getClosestDecodedValue(CFX_Int32Array& moduleBitCount);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp index 1f192e63a7..758fed61fe 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp @@ -22,16 +22,16 @@ #include "../barcode.h"
#include "BC_PDF417Common.h"
-FX_INT32 CBC_PDF417Common::NUMBER_OF_CODEWORDS = 929;
-FX_INT32 CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE = NUMBER_OF_CODEWORDS - 1;
-FX_INT32 CBC_PDF417Common::MIN_ROWS_IN_BARCODE = 3;
-FX_INT32 CBC_PDF417Common::MAX_ROWS_IN_BARCODE = 90;
-FX_INT32 CBC_PDF417Common::MAX_CODEWORDS_IN_ROW = 32;
-FX_INT32 CBC_PDF417Common::MODULES_IN_CODEWORD = 17;
-FX_INT32 CBC_PDF417Common::MODULES_IN_STOP_PATTERN = 18;
-FX_INT32 CBC_PDF417Common::BARS_IN_MODULE = 8;
+int32_t CBC_PDF417Common::NUMBER_OF_CODEWORDS = 929;
+int32_t CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE = NUMBER_OF_CODEWORDS - 1;
+int32_t CBC_PDF417Common::MIN_ROWS_IN_BARCODE = 3;
+int32_t CBC_PDF417Common::MAX_ROWS_IN_BARCODE = 90;
+int32_t CBC_PDF417Common::MAX_CODEWORDS_IN_ROW = 32;
+int32_t CBC_PDF417Common::MODULES_IN_CODEWORD = 17;
+int32_t CBC_PDF417Common::MODULES_IN_STOP_PATTERN = 18;
+int32_t CBC_PDF417Common::BARS_IN_MODULE = 8;
CFX_Int32Array* CBC_PDF417Common::EMPTY_INT_ARRAY = NULL;
-FX_INT32 CBC_PDF417Common::SYMBOL_TABLE[] = {
+int32_t CBC_PDF417Common::SYMBOL_TABLE[] = {
0x1025e, 0x1027a, 0x1029e, 0x102bc, 0x102f2, 0x102f4, 0x1032e, 0x1034e, 0x1035c, 0x10396, 0x103a6, 0x103ac,
0x10422, 0x10428, 0x10436, 0x10442, 0x10444, 0x10448, 0x10450, 0x1045e, 0x10466, 0x1046c, 0x1047a, 0x10482,
0x1049e, 0x104a0, 0x104bc, 0x104c6, 0x104d8, 0x104ee, 0x104f2, 0x104f4, 0x10504, 0x10508, 0x10510, 0x1051e,
@@ -266,7 +266,7 @@ FX_INT32 CBC_PDF417Common::SYMBOL_TABLE[] = { 0x1fb3a, 0x1fb46, 0x1fb4c, 0x1fb58, 0x1fb6e, 0x1fb72, 0x1fb74, 0x1fb8a, 0x1fb92, 0x1fb94, 0x1fba2, 0x1fba4,
0x1fba8, 0x1fbb6, 0x1fbda
};
-FX_INT32 CBC_PDF417Common::CODEWORD_TABLE[] = {
+int32_t CBC_PDF417Common::CODEWORD_TABLE[] = {
2627, 1819, 2622, 2621, 1813, 1812, 2729, 2724, 2723, 2779, 2774, 2773, 902, 896, 908, 868, 865, 861, 859, 2511,
873, 871, 1780, 835, 2493, 825, 2491, 842, 837, 844, 1764, 1762, 811, 810, 809, 2483, 807, 2482, 806, 2480, 815,
814, 813, 812, 2484, 817, 816, 1745, 1744, 1742, 1746, 2655, 2637, 2635, 2626, 2625, 2623, 2628, 1820, 2752,
@@ -414,30 +414,30 @@ CBC_PDF417Common::CBC_PDF417Common() CBC_PDF417Common::~CBC_PDF417Common()
{
}
-FX_INT32 CBC_PDF417Common::getBitCountSum(CFX_Int32Array& moduleBitCount)
+int32_t CBC_PDF417Common::getBitCountSum(CFX_Int32Array& moduleBitCount)
{
- FX_INT32 bitCountSum = 0;
- for (FX_INT32 i = 0; i < moduleBitCount.GetSize(); i++) {
- FX_INT32 count = moduleBitCount.GetAt(i);
+ int32_t bitCountSum = 0;
+ for (int32_t i = 0; i < moduleBitCount.GetSize(); i++) {
+ int32_t count = moduleBitCount.GetAt(i);
bitCountSum += count;
}
return bitCountSum;
}
-FX_INT32 CBC_PDF417Common::getCodeword(FX_DWORD symbol)
+int32_t CBC_PDF417Common::getCodeword(FX_DWORD symbol)
{
FX_DWORD sym = symbol & 0x3FFFF;
- FX_INT32 i = findCodewordIndex(sym);
+ int32_t i = findCodewordIndex(sym);
if (i == -1) {
return -1;
}
return (CODEWORD_TABLE[i] - 1) % NUMBER_OF_CODEWORDS;
}
-FX_INT32 CBC_PDF417Common::findCodewordIndex(FX_DWORD symbol)
+int32_t CBC_PDF417Common::findCodewordIndex(FX_DWORD symbol)
{
- FX_INT32 first = 0;
- FX_INT32 upto = sizeof(SYMBOL_TABLE) / sizeof(SYMBOL_TABLE[0]);
+ int32_t first = 0;
+ int32_t upto = sizeof(SYMBOL_TABLE) / sizeof(SYMBOL_TABLE[0]);
while (first < upto) {
- FX_INT32 mid = ((FX_DWORD)(first + upto)) >> 1;
+ int32_t mid = ((FX_DWORD)(first + upto)) >> 1;
if (symbol < (FX_DWORD)SYMBOL_TABLE[mid]) {
upto = mid;
} else if (symbol > (FX_DWORD)SYMBOL_TABLE[mid]) {
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Common.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Common.h index 2d6258951e..a97d84b07a 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Common.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Common.h @@ -11,20 +11,20 @@ class CBC_PDF417Common public:
CBC_PDF417Common();
virtual ~CBC_PDF417Common();
- static FX_INT32 getBitCountSum(CFX_Int32Array& moduleBitCount);
- static FX_INT32 getCodeword(FX_DWORD symbol);
- static FX_INT32 NUMBER_OF_CODEWORDS;
- static FX_INT32 MAX_CODEWORDS_IN_BARCODE;
- static FX_INT32 MIN_ROWS_IN_BARCODE;
- static FX_INT32 MAX_ROWS_IN_BARCODE;
- static FX_INT32 MAX_CODEWORDS_IN_ROW;
- static FX_INT32 MODULES_IN_CODEWORD;
- static FX_INT32 MODULES_IN_STOP_PATTERN;
- static FX_INT32 BARS_IN_MODULE;
- static FX_INT32 SYMBOL_TABLE[];
- static FX_INT32 CODEWORD_TABLE[];
+ static int32_t getBitCountSum(CFX_Int32Array& moduleBitCount);
+ static int32_t getCodeword(FX_DWORD symbol);
+ static int32_t NUMBER_OF_CODEWORDS;
+ static int32_t MAX_CODEWORDS_IN_BARCODE;
+ static int32_t MIN_ROWS_IN_BARCODE;
+ static int32_t MAX_ROWS_IN_BARCODE;
+ static int32_t MAX_CODEWORDS_IN_ROW;
+ static int32_t MODULES_IN_CODEWORD;
+ static int32_t MODULES_IN_STOP_PATTERN;
+ static int32_t BARS_IN_MODULE;
+ static int32_t SYMBOL_TABLE[];
+ static int32_t CODEWORD_TABLE[];
private:
static CFX_Int32Array* EMPTY_INT_ARRAY;
- static FX_INT32 findCodewordIndex(FX_DWORD symbol);
+ static int32_t findCodewordIndex(FX_DWORD symbol);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp index ae26057c3e..281c78a8eb 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp @@ -36,15 +36,15 @@ #define MACRO_PDF417_TERMINATOR 922
#define MODE_SHIFT_TO_BYTE_COMPACTION_MODE 913
-FX_INT32 CBC_DecodedBitStreamPaser::MAX_NUMERIC_CODEWORDS = 15;
-FX_INT32 CBC_DecodedBitStreamPaser::NUMBER_OF_SEQUENCE_CODEWORDS = 2;
-FX_INT32 CBC_DecodedBitStreamPaser::PL = 25;
-FX_INT32 CBC_DecodedBitStreamPaser::LL = 27;
-FX_INT32 CBC_DecodedBitStreamPaser::AS = 27;
-FX_INT32 CBC_DecodedBitStreamPaser::ML = 28;
-FX_INT32 CBC_DecodedBitStreamPaser::AL = 28;
-FX_INT32 CBC_DecodedBitStreamPaser::PS = 29;
-FX_INT32 CBC_DecodedBitStreamPaser::PAL = 29;
+int32_t CBC_DecodedBitStreamPaser::MAX_NUMERIC_CODEWORDS = 15;
+int32_t CBC_DecodedBitStreamPaser::NUMBER_OF_SEQUENCE_CODEWORDS = 2;
+int32_t CBC_DecodedBitStreamPaser::PL = 25;
+int32_t CBC_DecodedBitStreamPaser::LL = 27;
+int32_t CBC_DecodedBitStreamPaser::AS = 27;
+int32_t CBC_DecodedBitStreamPaser::ML = 28;
+int32_t CBC_DecodedBitStreamPaser::AL = 28;
+int32_t CBC_DecodedBitStreamPaser::PS = 29;
+int32_t CBC_DecodedBitStreamPaser::PAL = 29;
FX_CHAR CBC_DecodedBitStreamPaser::PUNCT_CHARS[29] = {
';', '<', '>', '@', '[', '\\', '}', '_', '`', '~', '!',
'\r', '\t', ',', ':', '\n', '-', '.', '$', '/', '"', '|', '*',
@@ -67,11 +67,11 @@ CBC_DecodedBitStreamPaser::CBC_DecodedBitStreamPaser() CBC_DecodedBitStreamPaser::~CBC_DecodedBitStreamPaser()
{
}
-CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(CFX_Int32Array &codewords, CFX_ByteString ecLevel, FX_INT32 &e)
+CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(CFX_Int32Array &codewords, CFX_ByteString ecLevel, int32_t &e)
{
CFX_ByteString result;
- FX_INT32 codeIndex = 1;
- FX_INT32 code = codewords.GetAt(codeIndex);
+ int32_t codeIndex = 1;
+ int32_t code = codewords.GetAt(codeIndex);
codeIndex++;
CBC_PDF417ResultMetadata* resultMetadata = FX_NEW CBC_PDF417ResultMetadata;
while (codeIndex < codewords[0]) {
@@ -128,7 +128,7 @@ CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(CFX_Int32Array &codew tempCd->setOther(resultMetadata);
return tempCd;
}
-FX_INT32 CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, FX_INT32 codeIndex, CBC_PDF417ResultMetadata* resultMetadata, FX_INT32 &e)
+int32_t CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, int32_t codeIndex, CBC_PDF417ResultMetadata* resultMetadata, int32_t &e)
{
if (codeIndex + NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {
e = BCExceptionFormatInstance;
@@ -136,7 +136,7 @@ FX_INT32 CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, }
CFX_Int32Array segmentIndexArray;
segmentIndexArray.SetSize(NUMBER_OF_SEQUENCE_CODEWORDS);
- for (FX_INT32 i = 0; i < NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {
+ for (int32_t i = 0; i < NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {
segmentIndexArray.SetAt(i, codewords[codeIndex]);
}
CFX_ByteString str = decodeBase900toBase10(segmentIndexArray, NUMBER_OF_SEQUENCE_CODEWORDS, e);
@@ -149,10 +149,10 @@ FX_INT32 CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, codeIndex++;
CFX_Int32Array additionalOptionCodeWords;
additionalOptionCodeWords.SetSize(codewords[0] - codeIndex);
- FX_INT32 additionalOptionCodeWordsIndex = 0;
+ int32_t additionalOptionCodeWordsIndex = 0;
FX_BOOL end = FALSE;
while ((codeIndex < codewords[0]) && !end) {
- FX_INT32 code = codewords[codeIndex++];
+ int32_t code = codewords[codeIndex++];
if (code < TEXT_COMPACTION_MODE_LATCH) {
additionalOptionCodeWords[additionalOptionCodeWordsIndex++] = code;
} else {
@@ -178,16 +178,16 @@ FX_INT32 CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, }
return codeIndex;
}
-FX_INT32 CBC_DecodedBitStreamPaser::textCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result)
+int32_t CBC_DecodedBitStreamPaser::textCompaction(CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result)
{
CFX_Int32Array textCompactionData;
textCompactionData.SetSize((codewords[0] - codeIndex) << 1);
CFX_Int32Array byteCompactionData;
byteCompactionData.SetSize((codewords[0] - codeIndex) << 1);
- FX_INT32 index = 0;
+ int32_t index = 0;
FX_BOOL end = FALSE;
while ((codeIndex < codewords[0]) && !end) {
- FX_INT32 code = codewords[codeIndex++];
+ int32_t code = codewords[codeIndex++];
if (code < TEXT_COMPACTION_MODE_LATCH) {
textCompactionData[index] = code / 30;
textCompactionData[index + 1] = code % 30;
@@ -233,13 +233,13 @@ FX_INT32 CBC_DecodedBitStreamPaser::textCompaction(CFX_Int32Array &codewords, FX decodeTextCompaction(textCompactionData, byteCompactionData, index, result);
return codeIndex;
}
-void CBC_DecodedBitStreamPaser::decodeTextCompaction(CFX_Int32Array &textCompactionData, CFX_Int32Array &byteCompactionData, FX_INT32 length, CFX_ByteString &result)
+void CBC_DecodedBitStreamPaser::decodeTextCompaction(CFX_Int32Array &textCompactionData, CFX_Int32Array &byteCompactionData, int32_t length, CFX_ByteString &result)
{
Mode subMode = ALPHA;
Mode priorToShiftMode = ALPHA;
- FX_INT32 i = 0;
+ int32_t i = 0;
while (i < length) {
- FX_INT32 subModeCh = textCompactionData[i];
+ int32_t subModeCh = textCompactionData[i];
FX_CHAR ch = 0;
switch (subMode) {
case ALPHA:
@@ -351,16 +351,16 @@ void CBC_DecodedBitStreamPaser::decodeTextCompaction(CFX_Int32Array &textCompact i++;
}
}
-FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result)
+int32_t CBC_DecodedBitStreamPaser::byteCompaction(int32_t mode, CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result)
{
if (mode == BYTE_COMPACTION_MODE_LATCH) {
- FX_INT32 count = 0;
- FX_INT64 value = 0;
+ int32_t count = 0;
+ int64_t value = 0;
FX_WORD* decodedData = FX_Alloc(FX_WORD, 6 * sizeof(FX_WORD));
CFX_Int32Array byteCompactedCodewords;
byteCompactedCodewords.SetSize(6);
FX_BOOL end = FALSE;
- FX_INT32 nextCode = codewords[codeIndex++];
+ int32_t nextCode = codewords[codeIndex++];
while ((codeIndex < codewords[0]) && !end) {
byteCompactedCodewords[count++] = nextCode;
value = 900 * value + nextCode;
@@ -376,7 +376,7 @@ FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array end = TRUE;
} else {
if ((count % 5 == 0) && (count > 0)) {
- FX_INT32 j = 0;
+ int32_t j = 0;
for (; j < 6; ++j) {
decodedData[5 - j] = (FX_WORD) (value % 256);
value >>= 8;
@@ -392,15 +392,15 @@ FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array if (codeIndex == codewords[0] && nextCode < TEXT_COMPACTION_MODE_LATCH) {
byteCompactedCodewords[count++] = nextCode;
}
- for (FX_INT32 i = 0; i < count; i++) {
+ for (int32_t i = 0; i < count; i++) {
result += (FX_CHAR)(FX_WORD) byteCompactedCodewords[i];
}
} else if (mode == BYTE_COMPACTION_MODE_LATCH_6) {
- FX_INT32 count = 0;
- FX_INT64 value = 0;
+ int32_t count = 0;
+ int64_t value = 0;
FX_BOOL end = FALSE;
while (codeIndex < codewords[0] && !end) {
- FX_INT32 code = codewords[codeIndex++];
+ int32_t code = codewords[codeIndex++];
if (code < TEXT_COMPACTION_MODE_LATCH) {
count++;
value = 900 * value + code;
@@ -418,7 +418,7 @@ FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array }
if ((count % 5 == 0) && (count > 0)) {
FX_WORD* decodedData = FX_Alloc(FX_WORD, 6 * sizeof(FX_WORD));
- FX_INT32 j = 0;
+ int32_t j = 0;
for (; j < 6; ++j) {
decodedData[5 - j] = (FX_WORD) (value & 0xFF);
value >>= 8;
@@ -433,14 +433,14 @@ FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array }
return codeIndex;
}
-FX_INT32 CBC_DecodedBitStreamPaser::numericCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result, FX_INT32 &e)
+int32_t CBC_DecodedBitStreamPaser::numericCompaction(CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result, int32_t &e)
{
- FX_INT32 count = 0;
+ int32_t count = 0;
FX_BOOL end = FALSE;
CFX_Int32Array numericCodewords;
numericCodewords.SetSize(MAX_NUMERIC_CODEWORDS);
while (codeIndex < codewords[0] && !end) {
- FX_INT32 code = codewords[codeIndex++];
+ int32_t code = codewords[codeIndex++];
if (codeIndex == codewords[0]) {
end = TRUE;
}
@@ -469,11 +469,11 @@ FX_INT32 CBC_DecodedBitStreamPaser::numericCompaction(CFX_Int32Array &codewords, }
return codeIndex;
}
-CFX_ByteString CBC_DecodedBitStreamPaser::decodeBase900toBase10(CFX_Int32Array &codewords, FX_INT32 count, FX_INT32 &e)
+CFX_ByteString CBC_DecodedBitStreamPaser::decodeBase900toBase10(CFX_Int32Array &codewords, int32_t count, int32_t &e)
{
BigInteger result = 0;
BigInteger nineHundred(900);
- for (FX_INT32 i = 0; i < count; i++) {
+ for (int32_t i = 0; i < count; i++) {
result = result * nineHundred + BigInteger(codewords[i]);
}
CFX_ByteString resultString(bigIntegerToString(result).c_str());
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h b/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h index 4c97bc3f24..20831b4ad8 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h @@ -15,7 +15,7 @@ public: virtual ~CBC_DecodedBitStreamPaser();
static void Initialize();
static void Finalize();
- static CBC_CommonDecoderResult* decode(CFX_Int32Array &codewords, CFX_ByteString ecLevel, FX_INT32 &e);
+ static CBC_CommonDecoderResult* decode(CFX_Int32Array &codewords, CFX_ByteString ecLevel, int32_t &e);
private:
enum Mode {
@@ -26,22 +26,22 @@ private: ALPHA_SHIFT,
PUNCT_SHIFT
};
- static FX_INT32 MAX_NUMERIC_CODEWORDS;
- static FX_INT32 PL;
- static FX_INT32 LL;
- static FX_INT32 AS;
- static FX_INT32 ML;
- static FX_INT32 AL;
- static FX_INT32 PS;
- static FX_INT32 PAL;
+ static int32_t MAX_NUMERIC_CODEWORDS;
+ static int32_t PL;
+ static int32_t LL;
+ static int32_t AS;
+ static int32_t ML;
+ static int32_t AL;
+ static int32_t PS;
+ static int32_t PAL;
static FX_CHAR PUNCT_CHARS[29];
static FX_CHAR MIXED_CHARS[30];
- static FX_INT32 NUMBER_OF_SEQUENCE_CODEWORDS;
- static FX_INT32 decodeMacroBlock(CFX_Int32Array &codewords, FX_INT32 codeIndex, CBC_PDF417ResultMetadata* resultMetadata, FX_INT32 &e);
- static FX_INT32 textCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result);
- static void decodeTextCompaction(CFX_Int32Array &textCompactionData, CFX_Int32Array &byteCompactionData, FX_INT32 length, CFX_ByteString &result);
- static FX_INT32 byteCompaction(FX_INT32 mode, CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result);
- static FX_INT32 numericCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result, FX_INT32 &e);
- static CFX_ByteString decodeBase900toBase10(CFX_Int32Array &codewords, FX_INT32 count, FX_INT32 &e);
+ static int32_t NUMBER_OF_SEQUENCE_CODEWORDS;
+ static int32_t decodeMacroBlock(CFX_Int32Array &codewords, int32_t codeIndex, CBC_PDF417ResultMetadata* resultMetadata, int32_t &e);
+ static int32_t textCompaction(CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result);
+ static void decodeTextCompaction(CFX_Int32Array &textCompactionData, CFX_Int32Array &byteCompactionData, int32_t length, CFX_ByteString &result);
+ static int32_t byteCompaction(int32_t mode, CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result);
+ static int32_t numericCompaction(CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result, int32_t &e);
+ static CFX_ByteString decodeBase900toBase10(CFX_Int32Array &codewords, int32_t count, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp index af316f7660..c4966942c6 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp @@ -28,14 +28,14 @@ #include "BC_PDF417Common.h"
#include "BC_PDF417DetectionResultRowIndicatorColumn.h"
#include "BC_PDF417DetectionResult.h"
-FX_INT32 CBC_DetectionResult::ADJUST_ROW_NUMBER_SKIP = 2;
+int32_t CBC_DetectionResult::ADJUST_ROW_NUMBER_SKIP = 2;
CBC_DetectionResult::CBC_DetectionResult(CBC_BarcodeMetadata* barcodeMetadata, CBC_BoundingBox* boundingBox)
{
m_barcodeMetadata = barcodeMetadata;
m_barcodeColumnCount = barcodeMetadata->getColumnCount();
m_boundingBox = boundingBox;
m_detectionResultColumns.SetSize(m_barcodeColumnCount + 2);
- for (FX_INT32 i = 0; i < m_barcodeColumnCount + 2; i++) {
+ for (int32_t i = 0; i < m_barcodeColumnCount + 2; i++) {
m_detectionResultColumns[i] = NULL;
}
}
@@ -49,8 +49,8 @@ CFX_PtrArray& CBC_DetectionResult::getDetectionResultColumns() {
adjustIndicatorColumnRowNumbers((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(0));
adjustIndicatorColumnRowNumbers((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(m_barcodeColumnCount + 1));
- FX_INT32 unadjustedCodewordCount = CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE;
- FX_INT32 previousUnadjustedCount;
+ int32_t unadjustedCodewordCount = CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE;
+ int32_t previousUnadjustedCount;
do {
previousUnadjustedCount = unadjustedCodewordCount;
unadjustedCodewordCount = adjustRowNumbers();
@@ -65,11 +65,11 @@ CBC_BoundingBox* CBC_DetectionResult::getBoundingBox() {
return m_boundingBox;
}
-void CBC_DetectionResult::setDetectionResultColumn(FX_INT32 barcodeColumn, CBC_DetectionResultColumn* detectionResultColumn)
+void CBC_DetectionResult::setDetectionResultColumn(int32_t barcodeColumn, CBC_DetectionResultColumn* detectionResultColumn)
{
m_detectionResultColumns[barcodeColumn] = detectionResultColumn;
}
-CBC_DetectionResultColumn* CBC_DetectionResult::getDetectionResultColumn(FX_INT32 barcodeColumn)
+CBC_DetectionResultColumn* CBC_DetectionResult::getDetectionResultColumn(int32_t barcodeColumn)
{
return (CBC_DetectionResultColumn*)m_detectionResultColumns[barcodeColumn];
}
@@ -80,9 +80,9 @@ CFX_ByteString CBC_DetectionResult::toString() rowIndicatorColumn = (CBC_DetectionResultColumn*)m_detectionResultColumns[m_barcodeColumnCount + 1];
}
CFX_ByteString result;
- for (FX_INT32 codewordsRow = 0; codewordsRow < rowIndicatorColumn->getCodewords()->GetSize(); codewordsRow++) {
+ for (int32_t codewordsRow = 0; codewordsRow < rowIndicatorColumn->getCodewords()->GetSize(); codewordsRow++) {
result += (FX_CHAR) codewordsRow;
- for (FX_INT32 barcodeColumn = 0; barcodeColumn < m_barcodeColumnCount + 2; barcodeColumn++) {
+ for (int32_t barcodeColumn = 0; barcodeColumn < m_barcodeColumnCount + 2; barcodeColumn++) {
if (m_detectionResultColumns[barcodeColumn] == NULL) {
result += " | ";
continue;
@@ -104,15 +104,15 @@ void CBC_DetectionResult::adjustIndicatorColumnRowNumbers(CBC_DetectionResultCol ((CBC_DetectionResultRowIndicatorColumn*)detectionResultColumn)->adjustCompleteIndicatorColumnRowNumbers(*m_barcodeMetadata);
}
}
-FX_INT32 CBC_DetectionResult::adjustRowNumbers()
+int32_t CBC_DetectionResult::adjustRowNumbers()
{
- FX_INT32 unadjustedCount = adjustRowNumbersByRow();
+ int32_t unadjustedCount = adjustRowNumbersByRow();
if (unadjustedCount == 0) {
return 0;
}
- for (FX_INT32 barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1; barcodeColumn++) {
+ for (int32_t barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1; barcodeColumn++) {
CFX_PtrArray* codewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns[barcodeColumn])->getCodewords();
- for (FX_INT32 codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) {
+ for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) {
if (codewords->GetAt(codewordsRow) == NULL) {
continue;
}
@@ -123,24 +123,24 @@ FX_INT32 CBC_DetectionResult::adjustRowNumbers() }
return unadjustedCount;
}
-FX_INT32 CBC_DetectionResult::adjustRowNumbersByRow()
+int32_t CBC_DetectionResult::adjustRowNumbersByRow()
{
adjustRowNumbersFromBothRI();
- FX_INT32 unadjustedCount = adjustRowNumbersFromLRI();
+ int32_t unadjustedCount = adjustRowNumbersFromLRI();
return unadjustedCount + adjustRowNumbersFromRRI();
}
-FX_INT32 CBC_DetectionResult::adjustRowNumbersFromBothRI()
+int32_t CBC_DetectionResult::adjustRowNumbersFromBothRI()
{
if (m_detectionResultColumns[0] == NULL || m_detectionResultColumns[m_barcodeColumnCount + 1] == NULL) {
return 0;
}
CFX_PtrArray* LRIcodewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns[0])->getCodewords();
CFX_PtrArray* RRIcodewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns[m_barcodeColumnCount + 1])->getCodewords();
- for (FX_INT32 codewordsRow = 0; codewordsRow < LRIcodewords->GetSize(); codewordsRow++) {
+ for (int32_t codewordsRow = 0; codewordsRow < LRIcodewords->GetSize(); codewordsRow++) {
if (LRIcodewords->GetAt(codewordsRow) != NULL &&
RRIcodewords->GetAt(codewordsRow) != NULL &&
((CBC_Codeword*)LRIcodewords->GetAt(codewordsRow))->getRowNumber() == ((CBC_Codeword*)RRIcodewords->GetAt(codewordsRow))->getRowNumber()) {
- for (FX_INT32 barcodeColumn = 1; barcodeColumn <= m_barcodeColumnCount; barcodeColumn++) {
+ for (int32_t barcodeColumn = 1; barcodeColumn <= m_barcodeColumnCount; barcodeColumn++) {
CBC_Codeword* codeword = (CBC_Codeword*)((CBC_DetectionResultColumn*)m_detectionResultColumns[barcodeColumn])->getCodewords()->GetAt(codewordsRow);
if (codeword == NULL) {
continue;
@@ -154,20 +154,20 @@ FX_INT32 CBC_DetectionResult::adjustRowNumbersFromBothRI() }
return 0;
}
-FX_INT32 CBC_DetectionResult::adjustRowNumbersFromRRI()
+int32_t CBC_DetectionResult::adjustRowNumbersFromRRI()
{
if (m_detectionResultColumns[m_barcodeColumnCount + 1] == NULL) {
return 0;
}
- FX_INT32 unadjustedCount = 0;
+ int32_t unadjustedCount = 0;
CFX_PtrArray* codewords = ((CBC_DetectionResultColumn*) m_detectionResultColumns.GetAt(m_barcodeColumnCount + 1))->getCodewords();
- for (FX_INT32 codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) {
+ for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) {
if (codewords->GetAt(codewordsRow) == NULL) {
continue;
}
- FX_INT32 rowIndicatorRowNumber = ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber();
- FX_INT32 invalidRowCounts = 0;
- for (FX_INT32 barcodeColumn = m_barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) {
+ int32_t rowIndicatorRowNumber = ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber();
+ int32_t invalidRowCounts = 0;
+ for (int32_t barcodeColumn = m_barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) {
CBC_Codeword* codeword = (CBC_Codeword*)((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(barcodeColumn))->getCodewords()->GetAt(codewordsRow);
if (codeword != NULL) {
invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
@@ -179,20 +179,20 @@ FX_INT32 CBC_DetectionResult::adjustRowNumbersFromRRI() }
return unadjustedCount;
}
-FX_INT32 CBC_DetectionResult::adjustRowNumbersFromLRI()
+int32_t CBC_DetectionResult::adjustRowNumbersFromLRI()
{
if (m_detectionResultColumns[0] == NULL) {
return 0;
}
- FX_INT32 unadjustedCount = 0;
+ int32_t unadjustedCount = 0;
CFX_PtrArray* codewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(0))->getCodewords();
- for (FX_INT32 codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) {
+ for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) {
if (codewords->GetAt(codewordsRow) == NULL) {
continue;
}
- FX_INT32 rowIndicatorRowNumber = ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber();
- FX_INT32 invalidRowCounts = 0;
- for (FX_INT32 barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) {
+ int32_t rowIndicatorRowNumber = ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber();
+ int32_t invalidRowCounts = 0;
+ for (int32_t barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) {
CBC_Codeword* codeword = (CBC_Codeword*)((CBC_DetectionResultColumn*)m_detectionResultColumns[barcodeColumn])->getCodewords()->GetAt(codewordsRow);
if (codeword != NULL) {
invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
@@ -204,7 +204,7 @@ FX_INT32 CBC_DetectionResult::adjustRowNumbersFromLRI() }
return unadjustedCount;
}
-FX_INT32 CBC_DetectionResult::adjustRowNumberIfValid(FX_INT32 rowIndicatorRowNumber, FX_INT32 invalidRowCounts, CBC_Codeword* codeword)
+int32_t CBC_DetectionResult::adjustRowNumberIfValid(int32_t rowIndicatorRowNumber, int32_t invalidRowCounts, CBC_Codeword* codeword)
{
if (codeword == NULL) {
return invalidRowCounts;
@@ -219,7 +219,7 @@ FX_INT32 CBC_DetectionResult::adjustRowNumberIfValid(FX_INT32 rowIndicatorRowNum }
return invalidRowCounts;
}
-void CBC_DetectionResult::adjustRowNumbers(FX_INT32 barcodeColumn, FX_INT32 codewordsRow, CFX_PtrArray* codewords)
+void CBC_DetectionResult::adjustRowNumbers(int32_t barcodeColumn, int32_t codewordsRow, CFX_PtrArray* codewords)
{
CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordsRow);
CFX_PtrArray* previousColumnCodewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(barcodeColumn - 1))->getCodewords();
@@ -251,7 +251,7 @@ void CBC_DetectionResult::adjustRowNumbers(FX_INT32 barcodeColumn, FX_INT32 code otherCodewords[12] = previousColumnCodewords->GetAt(codewordsRow + 2);
otherCodewords[13] = nextColumnCodewords->GetAt(codewordsRow + 2);
}
- for (FX_INT32 i = 0; i < otherCodewords.GetSize(); i++) {
+ for (int32_t i = 0; i < otherCodewords.GetSize(); i++) {
CBC_Codeword* otherCodeword = (CBC_Codeword*)otherCodewords.GetAt(i);
if (adjustRowNumber(codeword, otherCodeword)) {
return;
@@ -269,15 +269,15 @@ FX_BOOL CBC_DetectionResult::adjustRowNumber(CBC_Codeword* codeword, CBC_Codewor }
return FALSE;
}
-FX_INT32 CBC_DetectionResult::getBarcodeColumnCount()
+int32_t CBC_DetectionResult::getBarcodeColumnCount()
{
return m_barcodeColumnCount;
}
-FX_INT32 CBC_DetectionResult::getBarcodeRowCount()
+int32_t CBC_DetectionResult::getBarcodeRowCount()
{
return m_barcodeMetadata->getRowCount();
}
-FX_INT32 CBC_DetectionResult::getBarcodeECLevel()
+int32_t CBC_DetectionResult::getBarcodeECLevel()
{
return m_barcodeMetadata->getErrorCorrectionLevel();
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.h b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.h index 55a5a8f134..34da90082c 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.h @@ -18,28 +18,28 @@ public: CFX_PtrArray& getDetectionResultColumns();
void setBoundingBox(CBC_BoundingBox* boundingBox);
CBC_BoundingBox* getBoundingBox();
- void setDetectionResultColumn(FX_INT32 barcodeColumn, CBC_DetectionResultColumn* detectionResultColumn);
- CBC_DetectionResultColumn* getDetectionResultColumn(FX_INT32 barcodeColumn);
+ void setDetectionResultColumn(int32_t barcodeColumn, CBC_DetectionResultColumn* detectionResultColumn);
+ CBC_DetectionResultColumn* getDetectionResultColumn(int32_t barcodeColumn);
CFX_ByteString toString();
- FX_INT32 getBarcodeColumnCount();
- FX_INT32 getBarcodeRowCount();
- FX_INT32 getBarcodeECLevel();
+ int32_t getBarcodeColumnCount();
+ int32_t getBarcodeRowCount();
+ int32_t getBarcodeECLevel();
private:
- static FX_INT32 ADJUST_ROW_NUMBER_SKIP;
+ static int32_t ADJUST_ROW_NUMBER_SKIP;
CBC_BarcodeMetadata* m_barcodeMetadata;
CFX_PtrArray m_detectionResultColumns;
CBC_BoundingBox* m_boundingBox;
- FX_INT32 m_barcodeColumnCount;
+ int32_t m_barcodeColumnCount;
private:
void adjustIndicatorColumnRowNumbers(CBC_DetectionResultColumn* detectionResultColumn);
- FX_INT32 adjustRowNumbers();
- FX_INT32 adjustRowNumbersByRow();
- FX_INT32 adjustRowNumbersFromBothRI();
- FX_INT32 adjustRowNumbersFromRRI();
- FX_INT32 adjustRowNumbersFromLRI();
- static FX_INT32 adjustRowNumberIfValid(FX_INT32 rowIndicatorRowNumber, FX_INT32 invalidRowCounts, CBC_Codeword* codeword);
- void adjustRowNumbers(FX_INT32 barcodeColumn, FX_INT32 codewordsRow, CFX_PtrArray* codewords);
+ int32_t adjustRowNumbers();
+ int32_t adjustRowNumbersByRow();
+ int32_t adjustRowNumbersFromBothRI();
+ int32_t adjustRowNumbersFromRRI();
+ int32_t adjustRowNumbersFromLRI();
+ static int32_t adjustRowNumberIfValid(int32_t rowIndicatorRowNumber, int32_t invalidRowCounts, CBC_Codeword* codeword);
+ void adjustRowNumbers(int32_t barcodeColumn, int32_t codewordsRow, CFX_PtrArray* codewords);
static FX_BOOL adjustRowNumber(CBC_Codeword* codeword, CBC_Codeword* otherCodeword);
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp index 6d949b7640..f4da542130 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp @@ -24,7 +24,7 @@ #include "BC_PDF417Codeword.h"
#include "BC_PDF417BoundingBox.h"
#include "BC_PDF417DetectionResultColumn.h"
-FX_INT32 CBC_DetectionResultColumn::MAX_NEARBY_DISTANCE = 5;
+int32_t CBC_DetectionResultColumn::MAX_NEARBY_DISTANCE = 5;
CBC_DetectionResultColumn::CBC_DetectionResultColumn(CBC_BoundingBox* boundingBox)
{
m_boundingBox = boundingBox;
@@ -33,20 +33,20 @@ CBC_DetectionResultColumn::CBC_DetectionResultColumn(CBC_BoundingBox* boundingBo }
CBC_DetectionResultColumn::~CBC_DetectionResultColumn()
{
- for (FX_INT32 i = 0; i < m_codewords->GetSize(); i++) {
+ for (int32_t i = 0; i < m_codewords->GetSize(); i++) {
delete (CBC_Codeword*)m_codewords->GetAt(i);
}
m_codewords->RemoveAll();
delete m_codewords;
}
-CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(FX_INT32 imageRow)
+CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow)
{
CBC_Codeword* codeword = getCodeword(imageRow);
if (codeword != NULL) {
return codeword;
}
- for (FX_INT32 i = 1; i < MAX_NEARBY_DISTANCE; i++) {
- FX_INT32 nearImageRow = imageRowToCodewordIndex(imageRow) - i;
+ for (int32_t i = 1; i < MAX_NEARBY_DISTANCE; i++) {
+ int32_t nearImageRow = imageRowToCodewordIndex(imageRow) - i;
if (nearImageRow >= 0) {
codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow);
if (codeword != NULL) {
@@ -63,19 +63,19 @@ CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(FX_INT32 imageRow) }
return NULL;
}
-FX_INT32 CBC_DetectionResultColumn::imageRowToCodewordIndex(FX_INT32 imageRow)
+int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow)
{
return imageRow - m_boundingBox->getMinY();
}
-FX_INT32 CBC_DetectionResultColumn::codewordIndexToImageRow(FX_INT32 codewordIndex)
+int32_t CBC_DetectionResultColumn::codewordIndexToImageRow(int32_t codewordIndex)
{
return m_boundingBox->getMinY() + codewordIndex;
}
-void CBC_DetectionResultColumn::setCodeword(FX_INT32 imageRow, CBC_Codeword* codeword)
+void CBC_DetectionResultColumn::setCodeword(int32_t imageRow, CBC_Codeword* codeword)
{
m_codewords->SetAt(imageRowToCodewordIndex(imageRow), codeword);
}
-CBC_Codeword* CBC_DetectionResultColumn::getCodeword(FX_INT32 imageRow)
+CBC_Codeword* CBC_DetectionResultColumn::getCodeword(int32_t imageRow)
{
return (CBC_Codeword*)m_codewords->GetAt(imageRowToCodewordIndex(imageRow));
}
@@ -90,8 +90,8 @@ CFX_PtrArray* CBC_DetectionResultColumn::getCodewords() CFX_ByteString CBC_DetectionResultColumn::toString()
{
CFX_ByteString result;
- FX_INT32 row = 0;
- for (FX_INT32 i = 0; i < m_codewords->GetSize(); i++) {
+ int32_t row = 0;
+ for (int32_t i = 0; i < m_codewords->GetSize(); i++) {
CBC_Codeword* codeword = (CBC_Codeword*)m_codewords->GetAt(i);
if (codeword == NULL) {
result += (FX_CHAR) row;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.h b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.h index 202272d2e9..9940998282 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.h @@ -13,11 +13,11 @@ class CBC_DetectionResultColumn public:
CBC_DetectionResultColumn(CBC_BoundingBox* boundingBox);
virtual ~CBC_DetectionResultColumn();
- CBC_Codeword* getCodewordNearby(FX_INT32 imageRow);
- FX_INT32 imageRowToCodewordIndex(FX_INT32 imageRow);
- FX_INT32 codewordIndexToImageRow(FX_INT32 codewordIndex);
- void setCodeword(FX_INT32 imageRow, CBC_Codeword* codeword);
- CBC_Codeword* getCodeword(FX_INT32 imageRow);
+ CBC_Codeword* getCodewordNearby(int32_t imageRow);
+ int32_t imageRowToCodewordIndex(int32_t imageRow);
+ int32_t codewordIndexToImageRow(int32_t codewordIndex);
+ void setCodeword(int32_t imageRow, CBC_Codeword* codeword);
+ CBC_Codeword* getCodeword(int32_t imageRow);
CBC_BoundingBox* getBoundingBox();
CFX_PtrArray* getCodewords();
CFX_ByteString toString();
@@ -25,6 +25,6 @@ public: CBC_BoundingBox* m_boundingBox;
CFX_PtrArray* m_codewords;
private:
- static FX_INT32 MAX_NEARBY_DISTANCE;
+ static int32_t MAX_NEARBY_DISTANCE;
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp index 89e46a74cd..12622c3dff 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp @@ -39,14 +39,14 @@ CBC_DetectionResultRowIndicatorColumn::~CBC_DetectionResultRowIndicatorColumn() }
void CBC_DetectionResultRowIndicatorColumn::setRowNumbers()
{
- for (FX_INT32 i = 0; i < m_codewords->GetSize(); i++) {
+ for (int32_t i = 0; i < m_codewords->GetSize(); i++) {
CBC_Codeword * codeword = (CBC_Codeword*)m_codewords->GetAt(i);
if (codeword != NULL) {
codeword->setRowNumberAsRowIndicatorColumn();
}
}
}
-FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata)
+int32_t CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata)
{
CFX_PtrArray* codewords = getCodewords();
setRowNumbers();
@@ -54,18 +54,18 @@ FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRow CBC_BoundingBox* boundingBox = getBoundingBox();
CBC_ResultPoint* top = m_isLeft ? boundingBox->getTopLeft() : boundingBox->getTopRight();
CBC_ResultPoint* bottom = m_isLeft ? boundingBox->getBottomLeft() : boundingBox->getBottomRight();
- FX_INT32 firstRow = imageRowToCodewordIndex((FX_INT32) top->GetY());
- FX_INT32 lastRow = imageRowToCodewordIndex((FX_INT32) bottom->GetY());
+ int32_t firstRow = imageRowToCodewordIndex((int32_t) top->GetY());
+ int32_t lastRow = imageRowToCodewordIndex((int32_t) bottom->GetY());
FX_FLOAT averageRowHeight = (lastRow - firstRow) / (FX_FLOAT) barcodeMetadata.getRowCount();
- FX_INT32 barcodeRow = -1;
- FX_INT32 maxRowHeight = 1;
- FX_INT32 currentRowHeight = 0;
- for (FX_INT32 codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) {
+ int32_t barcodeRow = -1;
+ int32_t maxRowHeight = 1;
+ int32_t currentRowHeight = 0;
+ for (int32_t codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) {
if (codewords->GetAt(codewordsRow) == NULL) {
continue;
}
CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordsRow);
- FX_INT32 rowDifference = codeword->getRowNumber() - barcodeRow;
+ int32_t rowDifference = codeword->getRowNumber() - barcodeRow;
if (rowDifference == 0) {
currentRowHeight++;
} else if (rowDifference == 1) {
@@ -79,14 +79,14 @@ FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRow } else if (rowDifference > codewordsRow) {
codewords->SetAt(codewordsRow, NULL);
} else {
- FX_INT32 checkedRows;
+ int32_t checkedRows;
if (maxRowHeight > 2) {
checkedRows = (maxRowHeight - 2) * rowDifference;
} else {
checkedRows = rowDifference;
}
FX_BOOL closePreviousCodewordFound = checkedRows >= codewordsRow;
- for (FX_INT32 i = 1; i <= checkedRows && !closePreviousCodewordFound; i++) {
+ for (int32_t i = 1; i <= checkedRows && !closePreviousCodewordFound; i++) {
closePreviousCodewordFound = codewords->GetAt(codewordsRow - i) != NULL;
}
if (closePreviousCodewordFound) {
@@ -97,9 +97,9 @@ FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRow }
}
}
- return (FX_INT32) (averageRowHeight + 0.5);
+ return (int32_t) (averageRowHeight + 0.5);
}
-CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(FX_INT32 &e)
+CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(int32_t &e)
{
CBC_BarcodeMetadata* barcodeMetadata = getBarcodeMetadata();
if (barcodeMetadata == NULL) {
@@ -109,7 +109,7 @@ CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(FX_INT32 &e adjustIncompleteIndicatorColumnRowNumbers(*barcodeMetadata);
CFX_Int32Array* result = FX_NEW CFX_Int32Array;
result->SetSize(barcodeMetadata->getRowCount());
- for (FX_INT32 i = 0; i < getCodewords()->GetSize(); i++) {
+ for (int32_t i = 0; i < getCodewords()->GetSize(); i++) {
CBC_Codeword* codeword = (CBC_Codeword*)getCodewords()->GetAt(i);
if (codeword != NULL) {
result->SetAt(codeword->getRowNumber(), result->GetAt(codeword->getRowNumber()) + 1);
@@ -117,25 +117,25 @@ CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(FX_INT32 &e }
return result;
}
-FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustIncompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata)
+int32_t CBC_DetectionResultRowIndicatorColumn::adjustIncompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata)
{
CBC_BoundingBox* boundingBox = getBoundingBox();
CBC_ResultPoint* top = m_isLeft ? boundingBox->getTopLeft() : boundingBox->getTopRight();
CBC_ResultPoint* bottom = m_isLeft ? boundingBox->getBottomLeft() : boundingBox->getBottomRight();
- FX_INT32 firstRow = imageRowToCodewordIndex((FX_INT32) top->GetY());
- FX_INT32 lastRow = imageRowToCodewordIndex((FX_INT32) bottom->GetY());
+ int32_t firstRow = imageRowToCodewordIndex((int32_t) top->GetY());
+ int32_t lastRow = imageRowToCodewordIndex((int32_t) bottom->GetY());
FX_FLOAT averageRowHeight = (lastRow - firstRow) / (FX_FLOAT) barcodeMetadata.getRowCount();
CFX_PtrArray* codewords = getCodewords();
- FX_INT32 barcodeRow = -1;
- FX_INT32 maxRowHeight = 1;
- FX_INT32 currentRowHeight = 0;
- for (FX_INT32 codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) {
+ int32_t barcodeRow = -1;
+ int32_t maxRowHeight = 1;
+ int32_t currentRowHeight = 0;
+ for (int32_t codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) {
if (codewords->GetAt(codewordsRow) == NULL) {
continue;
}
CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordsRow);
codeword->setRowNumberAsRowIndicatorColumn();
- FX_INT32 rowDifference = codeword->getRowNumber() - barcodeRow;
+ int32_t rowDifference = codeword->getRowNumber() - barcodeRow;
if (rowDifference == 0) {
currentRowHeight++;
} else if (rowDifference == 1) {
@@ -149,7 +149,7 @@ FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustIncompleteIndicatorColumnR currentRowHeight = 1;
}
}
- return (FX_INT32) (averageRowHeight + 0.5);
+ return (int32_t) (averageRowHeight + 0.5);
}
CBC_BarcodeMetadata* CBC_DetectionResultRowIndicatorColumn::getBarcodeMetadata()
{
@@ -158,14 +158,14 @@ CBC_BarcodeMetadata* CBC_DetectionResultRowIndicatorColumn::getBarcodeMetadata() CBC_BarcodeValue barcodeRowCountUpperPart;
CBC_BarcodeValue barcodeRowCountLowerPart;
CBC_BarcodeValue barcodeECLevel;
- for (FX_INT32 i = 0; i < codewords->GetSize(); i++) {
+ for (int32_t i = 0; i < codewords->GetSize(); i++) {
CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(i);
if (codeword == NULL) {
continue;
}
codeword->setRowNumberAsRowIndicatorColumn();
- FX_INT32 rowIndicatorValue = codeword->getValue() % 30;
- FX_INT32 codewordRowNumber = codeword->getRowNumber();
+ int32_t rowIndicatorValue = codeword->getValue() % 30;
+ int32_t codewordRowNumber = codeword->getRowNumber();
if (!m_isLeft) {
codewordRowNumber += 2;
}
@@ -205,13 +205,13 @@ CFX_ByteString CBC_DetectionResultRowIndicatorColumn::toString() }
void CBC_DetectionResultRowIndicatorColumn::removeIncorrectCodewords(CFX_PtrArray* codewords, CBC_BarcodeMetadata barcodeMetadata)
{
- for (FX_INT32 codewordRow = 0; codewordRow < codewords->GetSize(); codewordRow++) {
+ for (int32_t codewordRow = 0; codewordRow < codewords->GetSize(); codewordRow++) {
CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordRow);
if (codeword == NULL) {
continue;
}
- FX_INT32 rowIndicatorValue = codeword->getValue() % 30;
- FX_INT32 codewordRowNumber = codeword->getRowNumber();
+ int32_t rowIndicatorValue = codeword->getValue() % 30;
+ int32_t codewordRowNumber = codeword->getRowNumber();
if (codewordRowNumber > barcodeMetadata.getRowCount()) {
codewords->SetAt(codewordRow, NULL);
continue;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.h b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.h index fbdd0f0ec4..f8092311c5 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.h @@ -15,9 +15,9 @@ public: CBC_DetectionResultRowIndicatorColumn(CBC_BoundingBox* boundingBox, FX_BOOL isLeft);
virtual ~CBC_DetectionResultRowIndicatorColumn();
void setRowNumbers();
- FX_INT32 adjustCompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata);
- CFX_Int32Array* getRowHeights(FX_INT32 &e);
- FX_INT32 adjustIncompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata);
+ int32_t adjustCompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata);
+ CFX_Int32Array* getRowHeights(int32_t &e);
+ int32_t adjustIncompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata);
CBC_BarcodeMetadata* getBarcodeMetadata();
FX_BOOL isLeft();
CFX_ByteString toString();
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp index 8d1a86ec92..726e0ec94f 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp @@ -28,26 +28,26 @@ #include "BC_PDF417DetectorResult.h"
#include "BC_PDF417Detector.h"
#define INTERGER_MAX 2147483647
-FX_INT32 CBC_Detector::INDEXES_START_PATTERN[] = {0, 4, 1, 5};
-FX_INT32 CBC_Detector::INDEXES_STOP_PATTERN[] = {6, 2, 7, 3};
-FX_INT32 CBC_Detector::INTEGER_MATH_SHIFT = 8;
-FX_INT32 CBC_Detector::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << INTEGER_MATH_SHIFT;
-FX_INT32 CBC_Detector::MAX_AVG_VARIANCE = (FX_INT32) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
-FX_INT32 CBC_Detector::MAX_INDIVIDUAL_VARIANCE = (FX_INT32) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f);
-FX_INT32 CBC_Detector::START_PATTERN[] = {8, 1, 1, 1, 1, 1, 1, 3};
-FX_INT32 CBC_Detector::STOP_PATTERN[] = {7, 1, 1, 3, 1, 1, 1, 2, 1};
-FX_INT32 CBC_Detector::MAX_PIXEL_DRIFT = 3;
-FX_INT32 CBC_Detector::MAX_PATTERN_DRIFT = 5;
-FX_INT32 CBC_Detector::SKIPPED_ROW_COUNT_MAX = 25;
-FX_INT32 CBC_Detector::ROW_STEP = 5;
-FX_INT32 CBC_Detector::BARCODE_MIN_HEIGHT = 10;
+int32_t CBC_Detector::INDEXES_START_PATTERN[] = {0, 4, 1, 5};
+int32_t CBC_Detector::INDEXES_STOP_PATTERN[] = {6, 2, 7, 3};
+int32_t CBC_Detector::INTEGER_MATH_SHIFT = 8;
+int32_t CBC_Detector::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << INTEGER_MATH_SHIFT;
+int32_t CBC_Detector::MAX_AVG_VARIANCE = (int32_t) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f);
+int32_t CBC_Detector::MAX_INDIVIDUAL_VARIANCE = (int32_t) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f);
+int32_t CBC_Detector::START_PATTERN[] = {8, 1, 1, 1, 1, 1, 1, 3};
+int32_t CBC_Detector::STOP_PATTERN[] = {7, 1, 1, 3, 1, 1, 1, 2, 1};
+int32_t CBC_Detector::MAX_PIXEL_DRIFT = 3;
+int32_t CBC_Detector::MAX_PATTERN_DRIFT = 5;
+int32_t CBC_Detector::SKIPPED_ROW_COUNT_MAX = 25;
+int32_t CBC_Detector::ROW_STEP = 5;
+int32_t CBC_Detector::BARCODE_MIN_HEIGHT = 10;
CBC_Detector::CBC_Detector()
{
}
CBC_Detector::~CBC_Detector()
{
}
-CBC_PDF417DetectorResult* CBC_Detector::detect(CBC_BinaryBitmap* image, FX_INT32 hints, FX_BOOL multiple, FX_INT32 &e)
+CBC_PDF417DetectorResult* CBC_Detector::detect(CBC_BinaryBitmap* image, int32_t hints, FX_BOOL multiple, int32_t &e)
{
CBC_CommonBitMatrix* bitMatrix = image->GetBlackMatrix(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -65,12 +65,12 @@ CBC_PDF417DetectorResult* CBC_Detector::detect(CBC_BinaryBitmap* image, FX_INT32 }
void CBC_Detector::rotate180(CBC_CommonBitMatrix* bitMatrix)
{
- FX_INT32 width = bitMatrix->GetWidth();
- FX_INT32 height = bitMatrix->GetHeight();
+ int32_t width = bitMatrix->GetWidth();
+ int32_t height = bitMatrix->GetHeight();
CBC_CommonBitArray* firstRowBitArray = FX_NEW CBC_CommonBitArray(width);
CBC_CommonBitArray* secondRowBitArray = FX_NEW CBC_CommonBitArray(width);
CBC_CommonBitArray* tmpBitArray = FX_NEW CBC_CommonBitArray(width);
- for (FX_INT32 y = 0; y < (height + 1) >> 1; y++) {
+ for (int32_t y = 0; y < (height + 1) >> 1; y++) {
CBC_CommonBitArray* temp = bitMatrix->GetRow(height - 1 - y, secondRowBitArray);
CBC_CommonBitArray* tempfirstRow = firstRowBitArray;
firstRowBitArray = bitMatrix->GetRow(y, tempfirstRow);
@@ -91,8 +91,8 @@ CBC_CommonBitArray* CBC_Detector::mirror(CBC_CommonBitArray* input, CBC_CommonBi {
CBC_CommonBitArray* array = FX_NEW CBC_CommonBitArray(result->GetSize());
array->Clear();
- FX_INT32 size = input->GetSize();
- for (FX_INT32 i = 0; i < size; i++) {
+ int32_t size = input->GetSize();
+ for (int32_t i = 0; i < size; i++) {
if (input->Get(i)) {
array->Set(size - 1 - i);
}
@@ -102,8 +102,8 @@ CBC_CommonBitArray* CBC_Detector::mirror(CBC_CommonBitArray* input, CBC_CommonBi CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple, CBC_CommonBitMatrix* bitMatrix)
{
CFX_PtrArray* barcodeCoordinates = FX_NEW CFX_PtrArray;
- FX_INT32 row = 0;
- FX_INT32 column = 0;
+ int32_t row = 0;
+ int32_t column = 0;
FX_BOOL foundBarcodeInRow = FALSE;
while (row < bitMatrix->GetHeight()) {
CFX_PtrArray* vertices = findVertices(bitMatrix, row, column);
@@ -116,7 +116,7 @@ CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple, CBC_CommonBitMatrix* bitMat }
foundBarcodeInRow = FALSE;
column = 0;
- for (FX_INT32 i = 0; i < barcodeCoordinates->GetSize(); i++) {
+ for (int32_t i = 0; i < barcodeCoordinates->GetSize(); i++) {
CFX_PtrArray* barcodeCoordinate = (CFX_PtrArray*)barcodeCoordinates->GetAt(i);
if (barcodeCoordinate->GetAt(1) != NULL) {
row = row > ((CBC_ResultPoint*)barcodeCoordinate->GetAt(1))->GetY();
@@ -137,19 +137,19 @@ CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple, CBC_CommonBitMatrix* bitMat break;
}
if (vertices->GetAt(2) != NULL) {
- column = (FX_INT32) ((CBC_ResultPoint*)vertices->GetAt(2))->GetX();
- row = (FX_INT32) ((CBC_ResultPoint*)vertices->GetAt(2))->GetY();
+ column = (int32_t) ((CBC_ResultPoint*)vertices->GetAt(2))->GetX();
+ row = (int32_t) ((CBC_ResultPoint*)vertices->GetAt(2))->GetY();
} else {
- column = (FX_INT32) ((CBC_ResultPoint*)vertices->GetAt(4))->GetX();
- row = (FX_INT32) ((CBC_ResultPoint*)vertices->GetAt(4))->GetY();
+ column = (int32_t) ((CBC_ResultPoint*)vertices->GetAt(4))->GetX();
+ row = (int32_t) ((CBC_ResultPoint*)vertices->GetAt(4))->GetY();
}
}
return barcodeCoordinates;
}
-CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix, FX_INT32 startRow, FX_INT32 startColumn)
+CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix, int32_t startRow, int32_t startColumn)
{
- FX_INT32 height = matrix->GetHeight();
- FX_INT32 width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ int32_t width = matrix->GetWidth();
CFX_PtrArray* result = FX_NEW CFX_PtrArray;
result->SetSize(8);
CFX_PtrArray* startptr = findRowsWithPattern(matrix, height, width, startRow, startColumn, START_PATTERN, sizeof(START_PATTERN) / sizeof(START_PATTERN[0]));
@@ -157,8 +157,8 @@ CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix, FX_INT32 s startptr->RemoveAll();
delete startptr;
if (result->GetAt(4) != NULL) {
- startColumn = (FX_INT32) ((CBC_ResultPoint*)result->GetAt(4))->GetX();
- startRow = (FX_INT32) ((CBC_ResultPoint*)result->GetAt(4))->GetY();
+ startColumn = (int32_t) ((CBC_ResultPoint*)result->GetAt(4))->GetX();
+ startRow = (int32_t) ((CBC_ResultPoint*)result->GetAt(4))->GetY();
}
CFX_PtrArray* stopptr = findRowsWithPattern(matrix, height, width, startRow, startColumn, STOP_PATTERN, sizeof(STOP_PATTERN) / sizeof(STOP_PATTERN[0]));
copyToResult(result, stopptr, INDEXES_STOP_PATTERN, sizeof(INDEXES_STOP_PATTERN) / sizeof(INDEXES_STOP_PATTERN[0]));
@@ -166,13 +166,13 @@ CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix, FX_INT32 s delete stopptr;
return result;
}
-void CBC_Detector::copyToResult(CFX_PtrArray *result, CFX_PtrArray* tmpResult, FX_INT32* destinationIndexes, FX_INT32 destinationLength)
+void CBC_Detector::copyToResult(CFX_PtrArray *result, CFX_PtrArray* tmpResult, int32_t* destinationIndexes, int32_t destinationLength)
{
- for (FX_INT32 i = 0; i < destinationLength; i++) {
+ for (int32_t i = 0; i < destinationLength; i++) {
result->SetAt(destinationIndexes[i], tmpResult->GetAt(i));
}
}
-CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix, FX_INT32 height, FX_INT32 width, FX_INT32 startRow, FX_INT32 startColumn, FX_INT32* pattern, FX_INT32 patternLength)
+CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix, int32_t height, int32_t width, int32_t startRow, int32_t startColumn, int32_t* pattern, int32_t patternLength)
{
CFX_PtrArray* result = FX_NEW CFX_PtrArray;
result->SetSize(4);
@@ -199,12 +199,12 @@ CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix, FX_ break;
}
}
- FX_INT32 stopRow = startRow + 1;
+ int32_t stopRow = startRow + 1;
if (found) {
- FX_INT32 skippedRowCount = 0;
+ int32_t skippedRowCount = 0;
CFX_Int32Array previousRowLoc;
- previousRowLoc.Add((FX_INT32)((CBC_ResultPoint*)result->GetAt(0))->GetX());
- previousRowLoc.Add((FX_INT32)((CBC_ResultPoint*)result->GetAt(1))->GetX());
+ previousRowLoc.Add((int32_t)((CBC_ResultPoint*)result->GetAt(0))->GetX());
+ previousRowLoc.Add((int32_t)((CBC_ResultPoint*)result->GetAt(1))->GetX());
for (; stopRow < height; stopRow++) {
CFX_Int32Array* loc = findGuardPattern(matrix, previousRowLoc[0], stopRow, width, FALSE, pattern, patternLength, counters);
if (loc != NULL &&
@@ -227,26 +227,26 @@ CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix, FX_ result->SetAt(3, FX_NEW CBC_ResultPoint((FX_FLOAT)previousRowLoc.GetAt(1), (FX_FLOAT)stopRow));
}
if (stopRow - startRow < BARCODE_MIN_HEIGHT) {
- for (FX_INT32 i = 0; i < result->GetSize(); i++) {
+ for (int32_t i = 0; i < result->GetSize(); i++) {
result->SetAt(i, NULL);
}
}
return result;
}
-CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, FX_INT32 column, FX_INT32 row, FX_INT32 width, FX_BOOL whiteFirst, FX_INT32* pattern, FX_INT32 patternLength, CFX_Int32Array &counters)
+CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, int32_t column, int32_t row, int32_t width, FX_BOOL whiteFirst, int32_t* pattern, int32_t patternLength, CFX_Int32Array &counters)
{
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
counters.SetAt(i, 0);
}
FX_BOOL isWhite = whiteFirst;
- FX_INT32 patternStart = column;
- FX_INT32 pixelDrift = 0;
+ int32_t patternStart = column;
+ int32_t pixelDrift = 0;
CFX_Int32Array* intarray = FX_NEW CFX_Int32Array;
while (matrix->Get(patternStart, row) && patternStart > 0 && pixelDrift++ < MAX_PIXEL_DRIFT) {
patternStart--;
}
- FX_INT32 x = patternStart;
- FX_INT32 counterPosition = 0;
+ int32_t x = patternStart;
+ int32_t counterPosition = 0;
for (; x < width; x++) {
FX_BOOL pixel = matrix->Get(x, row);
if (pixel ^ isWhite) {
@@ -259,7 +259,7 @@ CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, FX_I return intarray;
}
patternStart += counters[0] + counters[1];
- for (FX_INT32 l = 2, k = 0; l < patternLength; l++, k++) {
+ for (int32_t l = 2, k = 0; l < patternLength; l++, k++) {
counters.SetAt(k, counters.GetAt(l));
}
counters.SetAt(patternLength - 2, 0);
@@ -282,25 +282,25 @@ CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, FX_I delete intarray;
return NULL;
}
-FX_INT32 CBC_Detector::patternMatchVariance(CFX_Int32Array &counters, FX_INT32* pattern, FX_INT32 maxIndividualVariance)
+int32_t CBC_Detector::patternMatchVariance(CFX_Int32Array &counters, int32_t* pattern, int32_t maxIndividualVariance)
{
- FX_INT32 numCounters = counters.GetSize();
- FX_INT32 total = 0;
- FX_INT32 patternLength = 0;
- for (FX_INT32 i = 0; i < numCounters; i++) {
+ int32_t numCounters = counters.GetSize();
+ int32_t total = 0;
+ int32_t patternLength = 0;
+ for (int32_t i = 0; i < numCounters; i++) {
total += counters[i];
patternLength += pattern[i];
}
if (total < patternLength) {
return INTERGER_MAX;
}
- FX_INT32 unitBarWidth = (total << INTEGER_MATH_SHIFT) / patternLength;
+ int32_t unitBarWidth = (total << INTEGER_MATH_SHIFT) / patternLength;
maxIndividualVariance = (maxIndividualVariance * unitBarWidth) >> INTEGER_MATH_SHIFT;
- FX_INT32 totalVariance = 0;
- for (FX_INT32 x = 0; x < numCounters; x++) {
- FX_INT32 counter = counters[x] << INTEGER_MATH_SHIFT;
- FX_INT32 scaledPattern = pattern[x] * unitBarWidth;
- FX_INT32 variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
+ int32_t totalVariance = 0;
+ for (int32_t x = 0; x < numCounters; x++) {
+ int32_t counter = counters[x] << INTEGER_MATH_SHIFT;
+ int32_t scaledPattern = pattern[x] * unitBarWidth;
+ int32_t variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
if (variance > maxIndividualVariance) {
return INTERGER_MAX;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h index c160779122..93d5ff82a2 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h @@ -15,28 +15,28 @@ class CBC_Detector public:
CBC_Detector();
virtual ~CBC_Detector();
- static CBC_PDF417DetectorResult* detect(CBC_BinaryBitmap* image, FX_INT32 hints, FX_BOOL multiple, FX_INT32 &e);
+ static CBC_PDF417DetectorResult* detect(CBC_BinaryBitmap* image, int32_t hints, FX_BOOL multiple, int32_t &e);
static void rotate180(CBC_CommonBitMatrix* bitMatrix);
static CBC_CommonBitArray* mirror(CBC_CommonBitArray* input, CBC_CommonBitArray* result);
private:
- static FX_INT32 INDEXES_START_PATTERN[];
- static FX_INT32 INDEXES_STOP_PATTERN[];
- static FX_INT32 INTEGER_MATH_SHIFT;
- static FX_INT32 PATTERN_MATCH_RESULT_SCALE_FACTOR;
- static FX_INT32 MAX_AVG_VARIANCE;
- static FX_INT32 MAX_INDIVIDUAL_VARIANCE;
- static FX_INT32 START_PATTERN[];
- static FX_INT32 STOP_PATTERN[];
- static FX_INT32 MAX_PIXEL_DRIFT;
- static FX_INT32 MAX_PATTERN_DRIFT;
- static FX_INT32 SKIPPED_ROW_COUNT_MAX;
- static FX_INT32 ROW_STEP;
- static FX_INT32 BARCODE_MIN_HEIGHT;
+ static int32_t INDEXES_START_PATTERN[];
+ static int32_t INDEXES_STOP_PATTERN[];
+ static int32_t INTEGER_MATH_SHIFT;
+ static int32_t PATTERN_MATCH_RESULT_SCALE_FACTOR;
+ static int32_t MAX_AVG_VARIANCE;
+ static int32_t MAX_INDIVIDUAL_VARIANCE;
+ static int32_t START_PATTERN[];
+ static int32_t STOP_PATTERN[];
+ static int32_t MAX_PIXEL_DRIFT;
+ static int32_t MAX_PATTERN_DRIFT;
+ static int32_t SKIPPED_ROW_COUNT_MAX;
+ static int32_t ROW_STEP;
+ static int32_t BARCODE_MIN_HEIGHT;
static CFX_PtrArray* detect(FX_BOOL multiple, CBC_CommonBitMatrix* bitMatrix);
- static CFX_PtrArray* findVertices(CBC_CommonBitMatrix* matrix, FX_INT32 startRow, FX_INT32 startColumn);
- static void copyToResult(CFX_PtrArray* result, CFX_PtrArray* tmpResult, FX_INT32* destinationIndexes, FX_INT32 destinationLength);
- static CFX_PtrArray* findRowsWithPattern(CBC_CommonBitMatrix* matrix, FX_INT32 height, FX_INT32 width, FX_INT32 startRow, FX_INT32 startColumn, FX_INT32* pattern, FX_INT32 patternLength);
- static CFX_Int32Array* findGuardPattern(CBC_CommonBitMatrix* matrix, FX_INT32 column, FX_INT32 row, FX_INT32 width, FX_BOOL whiteFirst, FX_INT32* pattern, FX_INT32 patternLength, CFX_Int32Array &counters);
- static FX_INT32 patternMatchVariance(CFX_Int32Array &counters, FX_INT32* pattern, FX_INT32 maxIndividualVariance);
+ static CFX_PtrArray* findVertices(CBC_CommonBitMatrix* matrix, int32_t startRow, int32_t startColumn);
+ static void copyToResult(CFX_PtrArray* result, CFX_PtrArray* tmpResult, int32_t* destinationIndexes, int32_t destinationLength);
+ static CFX_PtrArray* findRowsWithPattern(CBC_CommonBitMatrix* matrix, int32_t height, int32_t width, int32_t startRow, int32_t startColumn, int32_t* pattern, int32_t patternLength);
+ static CFX_Int32Array* findGuardPattern(CBC_CommonBitMatrix* matrix, int32_t column, int32_t row, int32_t width, FX_BOOL whiteFirst, int32_t* pattern, int32_t patternLength, CFX_Int32Array &counters);
+ static int32_t patternMatchVariance(CFX_Int32Array &counters, int32_t* pattern, int32_t maxIndividualVariance);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectorResult.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectorResult.cpp index e082290011..7f65e04294 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectorResult.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectorResult.cpp @@ -31,9 +31,9 @@ CBC_PDF417DetectorResult::CBC_PDF417DetectorResult(CBC_CommonBitMatrix* bits, CF }
CBC_PDF417DetectorResult::~CBC_PDF417DetectorResult()
{
- for (FX_INT32 i = 0; i < m_points->GetSize(); i++) {
+ for (int32_t i = 0; i < m_points->GetSize(); i++) {
CFX_PtrArray* temp = (CFX_PtrArray*)m_points->GetAt(i);
- for (FX_INT32 j = 0; j < temp->GetSize(); j++) {
+ for (int32_t j = 0; j < temp->GetSize(); j++) {
delete (CBC_ResultPoint*)temp->GetAt(j);
}
temp->RemoveAll();
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp index 76d2e7bf88..189ed0831b 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp @@ -23,7 +23,7 @@ #include "../barcode.h"
#include "BC_PDF417Dimensions.h"
-CBC_Dimensions::CBC_Dimensions(FX_INT32 minCols, FX_INT32 maxCols, FX_INT32 minRows, FX_INT32 maxRows)
+CBC_Dimensions::CBC_Dimensions(int32_t minCols, int32_t maxCols, int32_t minRows, int32_t maxRows)
{
m_minCols = minCols;
m_maxCols = maxCols;
@@ -33,19 +33,19 @@ CBC_Dimensions::CBC_Dimensions(FX_INT32 minCols, FX_INT32 maxCols, FX_INT32 minR CBC_Dimensions::~CBC_Dimensions()
{
}
-FX_INT32 CBC_Dimensions::getMinCols()
+int32_t CBC_Dimensions::getMinCols()
{
return m_minCols;
}
-FX_INT32 CBC_Dimensions::getMaxCols()
+int32_t CBC_Dimensions::getMaxCols()
{
return m_maxCols;
}
-FX_INT32 CBC_Dimensions::getMinRows()
+int32_t CBC_Dimensions::getMinRows()
{
return m_minRows;
}
-FX_INT32 CBC_Dimensions::getMaxRows()
+int32_t CBC_Dimensions::getMaxRows()
{
return m_maxRows;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h index b8e9763081..b75b998fe7 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h @@ -9,16 +9,16 @@ class CBC_Dimensions
{
public:
- CBC_Dimensions(FX_INT32 minCols, FX_INT32 maxCols, FX_INT32 minRows, FX_INT32 maxRows);
+ CBC_Dimensions(int32_t minCols, int32_t maxCols, int32_t minRows, int32_t maxRows);
virtual ~CBC_Dimensions();
- FX_INT32 getMinCols();
- FX_INT32 getMaxCols();
- FX_INT32 getMinRows();
- FX_INT32 getMaxRows();
+ int32_t getMinCols();
+ int32_t getMaxCols();
+ int32_t getMinRows();
+ int32_t getMaxRows();
private:
- FX_INT32 m_minCols;
- FX_INT32 m_maxCols;
- FX_INT32 m_minRows;
- FX_INT32 m_maxRows;
+ int32_t m_minCols;
+ int32_t m_maxCols;
+ int32_t m_minRows;
+ int32_t m_maxRows;
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp index 23207ef959..d80a7f86ac 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp @@ -26,7 +26,7 @@ #include "BC_PDF417ECModulusGF.h"
#include "BC_PDF417ECErrorCorrection.h"
CBC_PDF417ECModulusGF* CBC_PDF417ECErrorCorrection::m_field = NULL;
-void CBC_PDF417ECErrorCorrection::Initialize(FX_INT32 &e)
+void CBC_PDF417ECErrorCorrection::Initialize(int32_t &e)
{
m_field = FX_NEW CBC_PDF417ECModulusGF(CBC_PDF417Common::NUMBER_OF_CODEWORDS, 3, e);
}
@@ -40,15 +40,15 @@ CBC_PDF417ECErrorCorrection::CBC_PDF417ECErrorCorrection() CBC_PDF417ECErrorCorrection::~CBC_PDF417ECErrorCorrection()
{
}
-FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32 numECCodewords, CFX_Int32Array &erasures, FX_INT32 &e)
+int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, int32_t numECCodewords, CFX_Int32Array &erasures, int32_t &e)
{
CBC_PDF417ECModulusPoly poly(m_field, received, e);
BC_EXCEPTION_CHECK_ReturnValue(e, -1);
CFX_Int32Array S;
S.SetSize(numECCodewords);
FX_BOOL error = FALSE;
- for (FX_INT32 l = numECCodewords; l > 0; l--) {
- FX_INT32 eval = poly.evaluateAt(m_field->exp(l));
+ for (int32_t l = numECCodewords; l > 0; l--) {
+ int32_t eval = poly.evaluateAt(m_field->exp(l));
S[numECCodewords - l] = eval;
if (eval != 0) {
error = TRUE;
@@ -72,7 +72,7 @@ FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32 CBC_PDF417ECModulusPoly* omega = (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(1);
CFX_Int32Array* errorLocations = findErrorLocations(sigma, e);
if (e != BCExceptionNO) {
- for (FX_INT32 i = 0; i < sigmaOmega->GetSize(); i++) {
+ for (int32_t i = 0; i < sigmaOmega->GetSize(); i++) {
delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i);
}
sigmaOmega->RemoveAll();
@@ -82,22 +82,22 @@ FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32 CFX_Int32Array* errorMagnitudes = findErrorMagnitudes(omega, sigma, *errorLocations, e);
if (e != BCExceptionNO) {
delete errorLocations;
- for (FX_INT32 i = 0; i < sigmaOmega->GetSize(); i++) {
+ for (int32_t i = 0; i < sigmaOmega->GetSize(); i++) {
delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i);
}
sigmaOmega->RemoveAll();
delete sigmaOmega;
return -1;
}
- for (FX_INT32 i = 0; i < errorLocations->GetSize(); i++) {
- FX_INT32 log = m_field->log(errorLocations->GetAt(i), e);;
+ for (int32_t i = 0; i < errorLocations->GetSize(); i++) {
+ int32_t log = m_field->log(errorLocations->GetAt(i), e);;
BC_EXCEPTION_CHECK_ReturnValue(e, -1);
- FX_INT32 position = received.GetSize() - 1 - log;
+ int32_t position = received.GetSize() - 1 - log;
if (position < 0) {
e = BCExceptionChecksumException;
delete errorLocations;
delete errorMagnitudes;
- for (FX_INT32 j = 0; j < sigmaOmega->GetSize(); j++) {
+ for (int32_t j = 0; j < sigmaOmega->GetSize(); j++) {
delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(j);
}
sigmaOmega->RemoveAll();
@@ -106,17 +106,17 @@ FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32 }
received[position] = m_field->subtract(received[position], errorMagnitudes->GetAt(i));
}
- FX_INT32 result = errorLocations->GetSize();
+ int32_t result = errorLocations->GetSize();
delete errorLocations;
delete errorMagnitudes;
- for (FX_INT32 k = 0; k < sigmaOmega->GetSize(); k++) {
+ for (int32_t k = 0; k < sigmaOmega->GetSize(); k++) {
delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(k);
}
sigmaOmega->RemoveAll();
delete sigmaOmega;
return result;
}
-CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a, CBC_PDF417ECModulusPoly* b, FX_INT32 R, FX_INT32 &e)
+CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a, CBC_PDF417ECModulusPoly* b, int32_t R, int32_t &e)
{
if (a->getDegree() < b->getDegree()) {
CBC_PDF417ECModulusPoly* temp = a;
@@ -130,10 +130,10 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod CBC_PDF417ECModulusPoly* qtemp = NULL;
CBC_PDF417ECModulusPoly* rtemp = NULL;
CBC_PDF417ECModulusPoly* ttemp = NULL;
- FX_INT32 i = 0;
- FX_INT32 j = 0;
- FX_INT32 m = 0;
- FX_INT32 n = 0;
+ int32_t i = 0;
+ int32_t j = 0;
+ int32_t m = 0;
+ int32_t n = 0;
while (r->getDegree() >= R / 2) {
CBC_PDF417ECModulusPoly* rLastLast = rLast;
CBC_PDF417ECModulusPoly* tLastLast = tLast;
@@ -156,8 +156,8 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod }
r = rLastLast;
CBC_PDF417ECModulusPoly* q = m_field->getZero();
- FX_INT32 denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree());
- FX_INT32 dltInverse = m_field->inverse(denominatorLeadingTerm, e);
+ int32_t denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree());
+ int32_t dltInverse = m_field->inverse(denominatorLeadingTerm, e);
if (e != BCExceptionNO) {
if (qtemp) {
delete qtemp;
@@ -171,8 +171,8 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod return NULL;
}
while (r->getDegree() >= rLast->getDegree() && !r->isZero()) {
- FX_INT32 degreeDiff = r->getDegree() - rLast->getDegree();
- FX_INT32 scale = m_field->multiply(r->getCoefficient(r->getDegree()), dltInverse);
+ int32_t degreeDiff = r->getDegree() - rLast->getDegree();
+ int32_t scale = m_field->multiply(r->getCoefficient(r->getDegree()), dltInverse);
CBC_PDF417ECModulusPoly* buildmonomial = m_field->buildMonomial(degreeDiff, scale, e);
if (e != BCExceptionNO) {
if (qtemp) {
@@ -273,8 +273,8 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod ttemp = t;
j++;
}
- FX_INT32 aa = t->getCoefficient(1);
- FX_INT32 sigmaTildeAtZero = t->getCoefficient(0);
+ int32_t aa = t->getCoefficient(1);
+ int32_t sigmaTildeAtZero = t->getCoefficient(0);
if (sigmaTildeAtZero == 0) {
e = BCExceptionChecksumException;
if (rtemp) {
@@ -285,7 +285,7 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod }
return NULL;
}
- FX_INT32 inverse = m_field->inverse(sigmaTildeAtZero, e);
+ int32_t inverse = m_field->inverse(sigmaTildeAtZero, e);
if (e != BCExceptionNO) {
if (rtemp) {
delete rtemp;
@@ -315,13 +315,13 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod modulusPoly->Add(omega);
return modulusPoly;
}
-CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(CBC_PDF417ECModulusPoly* errorLocator, FX_INT32 &e)
+CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(CBC_PDF417ECModulusPoly* errorLocator, int32_t &e)
{
- FX_INT32 numErrors = errorLocator->getDegree();
+ int32_t numErrors = errorLocator->getDegree();
CFX_Int32Array* result = FX_NEW CFX_Int32Array;
result->SetSize(numErrors);
- FX_INT32 ee = 0;
- for (FX_INT32 i = 1; i < m_field->getSize() && ee < numErrors; i++) {
+ int32_t ee = 0;
+ for (int32_t i = 1; i < m_field->getSize() && ee < numErrors; i++) {
if (errorLocator->evaluateAt(i) == 0) {
result->SetAt(ee, m_field->inverse(i, e));
if (e != BCExceptionNO) {
@@ -338,27 +338,27 @@ CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(CBC_PDF417ECModu }
return result;
}
-CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(CBC_PDF417ECModulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array &errorLocations, FX_INT32 &e)
+CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(CBC_PDF417ECModulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array &errorLocations, int32_t &e)
{
- FX_INT32 errorLocatorDegree = errorLocator->getDegree();
+ int32_t errorLocatorDegree = errorLocator->getDegree();
CFX_Int32Array formalDerivativeCoefficients;
formalDerivativeCoefficients.SetSize(errorLocatorDegree);
- for (FX_INT32 l = 1; l <= errorLocatorDegree; l++) {
+ for (int32_t l = 1; l <= errorLocatorDegree; l++) {
formalDerivativeCoefficients[errorLocatorDegree - l] = m_field->multiply(l, errorLocator->getCoefficient(l));
}
CBC_PDF417ECModulusPoly formalDerivative(m_field, formalDerivativeCoefficients, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 s = errorLocations.GetSize();
+ int32_t s = errorLocations.GetSize();
CFX_Int32Array* result = FX_NEW CFX_Int32Array;
result->SetSize(s);
- for (FX_INT32 i = 0; i < s; i++) {
- FX_INT32 xiInverse = m_field->inverse(errorLocations[i], e);
+ for (int32_t i = 0; i < s; i++) {
+ int32_t xiInverse = m_field->inverse(errorLocations[i], e);
if (e != BCExceptionNO) {
delete result;
return NULL;
}
- FX_INT32 numerator = m_field->subtract(0, errorEvaluator->evaluateAt(xiInverse));
- FX_INT32 denominator = m_field->inverse(formalDerivative.evaluateAt(xiInverse), e);
+ int32_t numerator = m_field->subtract(0, errorEvaluator->evaluateAt(xiInverse));
+ int32_t denominator = m_field->inverse(formalDerivative.evaluateAt(xiInverse), e);
if (e != BCExceptionNO) {
delete result;
return NULL;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h index 0fca2e6c39..c8a2058298 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h @@ -13,13 +13,13 @@ class CBC_PDF417ECErrorCorrection public:
CBC_PDF417ECErrorCorrection();
virtual ~CBC_PDF417ECErrorCorrection();
- static void Initialize(FX_INT32 &e);
+ static void Initialize(int32_t &e);
static void Finalize();
- static FX_INT32 decode(CFX_Int32Array &received, FX_INT32 numECCodewords, CFX_Int32Array &erasures, FX_INT32 &e);
+ static int32_t decode(CFX_Int32Array &received, int32_t numECCodewords, CFX_Int32Array &erasures, int32_t &e);
private:
static CBC_PDF417ECModulusGF* m_field;
- static CFX_PtrArray* runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a, CBC_PDF417ECModulusPoly* b, FX_INT32 R, FX_INT32 &e);
- static CFX_Int32Array* findErrorLocations(CBC_PDF417ECModulusPoly* errorLocator, FX_INT32 &e);
- static CFX_Int32Array* findErrorMagnitudes(CBC_PDF417ECModulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array &errorLocations, FX_INT32 &e);
+ static CFX_PtrArray* runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a, CBC_PDF417ECModulusPoly* b, int32_t R, int32_t &e);
+ static CFX_Int32Array* findErrorLocations(CBC_PDF417ECModulusPoly* errorLocator, int32_t &e);
+ static CFX_Int32Array* findErrorMagnitudes(CBC_PDF417ECModulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array &errorLocations, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp index 7619854bcb..1b41474bb3 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp @@ -25,7 +25,7 @@ #include "BC_PDF417ECModulusPoly.h"
#include "BC_PDF417ECModulusGF.h"
CBC_PDF417ECModulusGF* CBC_PDF417ECModulusGF::PDF417_GF = NULL;
-void CBC_PDF417ECModulusGF::Initialize(FX_INT32 &e)
+void CBC_PDF417ECModulusGF::Initialize(int32_t &e)
{
PDF417_GF = FX_NEW CBC_PDF417ECModulusGF(CBC_PDF417Common::NUMBER_OF_CODEWORDS, 3, e);
}
@@ -33,17 +33,17 @@ void CBC_PDF417ECModulusGF::Finalize() {
delete PDF417_GF;
}
-CBC_PDF417ECModulusGF::CBC_PDF417ECModulusGF(FX_INT32 modulus, FX_INT32 generator, FX_INT32 &e)
+CBC_PDF417ECModulusGF::CBC_PDF417ECModulusGF(int32_t modulus, int32_t generator, int32_t &e)
{
m_modulus = modulus;
m_expTable.SetSize(modulus);
m_logTable.SetSize(modulus);
- FX_INT32 x = 1;
- for (FX_INT32 i = 0; i < modulus; i++) {
+ int32_t x = 1;
+ for (int32_t i = 0; i < modulus; i++) {
m_expTable[i] = x;
x = (x * generator) % modulus;
}
- for (FX_INT32 j = 0; j < modulus - 1; j++) {
+ for (int32_t j = 0; j < modulus - 1; j++) {
m_logTable[m_expTable[j]] = j;
}
CFX_Int32Array zero;
@@ -66,7 +66,7 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::getOne() {
return m_one;
}
-CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::buildMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e)
+CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::buildMonomial(int32_t degree, int32_t coefficient, int32_t &e)
{
if (degree < 0) {
e = BCExceptionIllegalArgument;
@@ -85,19 +85,19 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::buildMonomial(FX_INT32 degree, F BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
-FX_INT32 CBC_PDF417ECModulusGF::add(FX_INT32 a, FX_INT32 b)
+int32_t CBC_PDF417ECModulusGF::add(int32_t a, int32_t b)
{
return (a + b) % m_modulus;
}
-FX_INT32 CBC_PDF417ECModulusGF::subtract(FX_INT32 a, FX_INT32 b)
+int32_t CBC_PDF417ECModulusGF::subtract(int32_t a, int32_t b)
{
return (m_modulus + a - b) % m_modulus;
}
-FX_INT32 CBC_PDF417ECModulusGF::exp(FX_INT32 a)
+int32_t CBC_PDF417ECModulusGF::exp(int32_t a)
{
return m_expTable[a];
}
-FX_INT32 CBC_PDF417ECModulusGF::log(FX_INT32 a, FX_INT32 &e)
+int32_t CBC_PDF417ECModulusGF::log(int32_t a, int32_t &e)
{
if (a == 0) {
e = BCExceptionIllegalArgument;
@@ -105,7 +105,7 @@ FX_INT32 CBC_PDF417ECModulusGF::log(FX_INT32 a, FX_INT32 &e) }
return m_logTable[a];
}
-FX_INT32 CBC_PDF417ECModulusGF::inverse(FX_INT32 a, FX_INT32 &e)
+int32_t CBC_PDF417ECModulusGF::inverse(int32_t a, int32_t &e)
{
if (a == 0) {
e = BCExceptionIllegalArgument;
@@ -113,14 +113,14 @@ FX_INT32 CBC_PDF417ECModulusGF::inverse(FX_INT32 a, FX_INT32 &e) }
return m_expTable[m_modulus - m_logTable[a] - 1];
}
-FX_INT32 CBC_PDF417ECModulusGF::multiply(FX_INT32 a, FX_INT32 b)
+int32_t CBC_PDF417ECModulusGF::multiply(int32_t a, int32_t b)
{
if (a == 0 || b == 0) {
return 0;
}
return m_expTable[(m_logTable[a] + m_logTable[b]) % (m_modulus - 1)];
}
-FX_INT32 CBC_PDF417ECModulusGF::getSize()
+int32_t CBC_PDF417ECModulusGF::getSize()
{
return m_modulus;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h index fbb79e3586..ee19117242 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h @@ -11,26 +11,26 @@ class CBC_PDF417Common; class CBC_PDF417ECModulusGF
{
public:
- CBC_PDF417ECModulusGF(FX_INT32 modulus, FX_INT32 generator, FX_INT32 &e);
+ CBC_PDF417ECModulusGF(int32_t modulus, int32_t generator, int32_t &e);
virtual ~CBC_PDF417ECModulusGF();
- static void Initialize(FX_INT32 &e);
+ static void Initialize(int32_t &e);
static void Finalize();
CBC_PDF417ECModulusPoly* getZero();
CBC_PDF417ECModulusPoly* getOne();
- CBC_PDF417ECModulusPoly* buildMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e);
- FX_INT32 add(FX_INT32 a, FX_INT32 b);
- FX_INT32 subtract(FX_INT32 a, FX_INT32 b);
- FX_INT32 exp(FX_INT32 a);
- FX_INT32 log(FX_INT32 a, FX_INT32 &e);
- FX_INT32 inverse(FX_INT32 a, FX_INT32 &e);
- FX_INT32 multiply(FX_INT32 a, FX_INT32 b);
- FX_INT32 getSize();
+ CBC_PDF417ECModulusPoly* buildMonomial(int32_t degree, int32_t coefficient, int32_t &e);
+ int32_t add(int32_t a, int32_t b);
+ int32_t subtract(int32_t a, int32_t b);
+ int32_t exp(int32_t a);
+ int32_t log(int32_t a, int32_t &e);
+ int32_t inverse(int32_t a, int32_t &e);
+ int32_t multiply(int32_t a, int32_t b);
+ int32_t getSize();
static CBC_PDF417ECModulusGF* PDF417_GF;
private:
CFX_Int32Array m_expTable;
CFX_Int32Array m_logTable;
CBC_PDF417ECModulusPoly* m_zero;
CBC_PDF417ECModulusPoly* m_one;
- FX_INT32 m_modulus;
+ int32_t m_modulus;
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp index 39d3fd8056..686b2badca 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp @@ -24,15 +24,15 @@ #include "BC_PDF417Common.h"
#include "BC_PDF417ECModulusGF.h"
#include "BC_PDF417ECModulusPoly.h"
-CBC_PDF417ECModulusPoly::CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, CFX_Int32Array &coefficients, FX_INT32 &e)
+CBC_PDF417ECModulusPoly::CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, CFX_Int32Array &coefficients, int32_t &e)
{
if (coefficients.GetSize() == 0) {
e = BCExceptionIllegalArgument;
}
m_field = field;
- FX_INT32 coefficientsLength = coefficients.GetSize();
+ int32_t coefficientsLength = coefficients.GetSize();
if (coefficientsLength > 1 && coefficients[0] == 0) {
- FX_INT32 firstNonZero = 1;
+ int32_t firstNonZero = 1;
while (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0) {
firstNonZero++;
}
@@ -40,8 +40,8 @@ CBC_PDF417ECModulusPoly::CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, C m_coefficients = field->getZero()->m_coefficients;
} else {
m_coefficients.SetSize(coefficientsLength - firstNonZero);
- FX_INT32 l = 0;
- for (FX_INT32 i = firstNonZero; i < firstNonZero + m_coefficients.GetSize(); i++) {
+ int32_t l = 0;
+ for (int32_t i = firstNonZero; i < firstNonZero + m_coefficients.GetSize(); i++) {
m_coefficients.SetAt(l, coefficients.GetAt(i));
l++;
}
@@ -61,7 +61,7 @@ CBC_PDF417ECModulusGF* CBC_PDF417ECModulusPoly::getField() {
return m_field;
}
-FX_INT32 CBC_PDF417ECModulusPoly::getDegree()
+int32_t CBC_PDF417ECModulusPoly::getDegree()
{
return m_coefficients.GetSize() - 1;
}
@@ -69,31 +69,31 @@ FX_BOOL CBC_PDF417ECModulusPoly::isZero() {
return m_coefficients[0] == 0;
}
-FX_INT32 CBC_PDF417ECModulusPoly::getCoefficient(FX_INT32 degree)
+int32_t CBC_PDF417ECModulusPoly::getCoefficient(int32_t degree)
{
return m_coefficients[m_coefficients.GetSize() - 1 - degree];
}
-FX_INT32 CBC_PDF417ECModulusPoly::evaluateAt(FX_INT32 a)
+int32_t CBC_PDF417ECModulusPoly::evaluateAt(int32_t a)
{
if (a == 0) {
return getCoefficient(0);
}
- FX_INT32 size = m_coefficients.GetSize();
+ int32_t size = m_coefficients.GetSize();
if (a == 1) {
- FX_INT32 result = 0;
- for (FX_INT32 l = 0; l < m_coefficients.GetSize(); l++) {
- FX_INT32 coefficient = m_coefficients.GetAt(l);
+ int32_t result = 0;
+ for (int32_t l = 0; l < m_coefficients.GetSize(); l++) {
+ int32_t coefficient = m_coefficients.GetAt(l);
result = m_field->add(result, coefficient);
}
return result;
}
- FX_INT32 result = m_coefficients[0];
- for (FX_INT32 i = 1; i < size; i++) {
+ int32_t result = m_coefficients[0];
+ for (int32_t i = 1; i < size; i++) {
result = m_field->add(m_field->multiply(a, result), m_coefficients[i]);
}
return result;
}
-CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add(CBC_PDF417ECModulusPoly* other, FX_INT32 &e)
+CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add(CBC_PDF417ECModulusPoly* other, int32_t &e)
{
CBC_PDF417ECModulusPoly* modulusPoly = NULL;
if (isZero()) {
@@ -118,18 +118,18 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add(CBC_PDF417ECModulusPoly* o }
CFX_Int32Array sumDiff;
sumDiff.SetSize(largerCoefficients.GetSize());
- FX_INT32 lengthDiff = largerCoefficients.GetSize() - smallerCoefficients.GetSize();
- for (FX_INT32 l = 0; l < lengthDiff; l++) {
+ int32_t lengthDiff = largerCoefficients.GetSize() - smallerCoefficients.GetSize();
+ for (int32_t l = 0; l < lengthDiff; l++) {
sumDiff.SetAt(l, largerCoefficients.GetAt(l));
}
- for (FX_INT32 i = lengthDiff; i < largerCoefficients.GetSize(); i++) {
+ for (int32_t i = lengthDiff; i < largerCoefficients.GetSize(); i++) {
sumDiff[i] = m_field->add(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
}
modulusPoly = FX_NEW CBC_PDF417ECModulusPoly(m_field, sumDiff, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
-CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::subtract(CBC_PDF417ECModulusPoly* other, FX_INT32 &e)
+CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::subtract(CBC_PDF417ECModulusPoly* other, int32_t &e)
{
CBC_PDF417ECModulusPoly* modulusPoly = NULL;
if (other->isZero()) {
@@ -144,7 +144,7 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::subtract(CBC_PDF417ECModulusPo BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
-CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(CBC_PDF417ECModulusPoly* other, FX_INT32 &e)
+CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(CBC_PDF417ECModulusPoly* other, int32_t &e)
{
CBC_PDF417ECModulusPoly* modulusPoly = NULL;
if (isZero() || other->isZero()) {
@@ -154,15 +154,15 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(CBC_PDF417ECModulusPo }
CFX_Int32Array aCoefficients;
aCoefficients.Copy(m_coefficients);
- FX_INT32 aLength = aCoefficients.GetSize();
+ int32_t aLength = aCoefficients.GetSize();
CFX_Int32Array bCoefficients;
bCoefficients.Copy(other->m_coefficients);
- FX_INT32 bLength = bCoefficients.GetSize();
+ int32_t bLength = bCoefficients.GetSize();
CFX_Int32Array product;
product.SetSize(aLength + bLength - 1);
- for (FX_INT32 i = 0; i < aLength; i++) {
- FX_INT32 aCoeff = aCoefficients[i];
- for (FX_INT32 j = 0; j < bLength; j++) {
+ for (int32_t i = 0; i < aLength; i++) {
+ int32_t aCoeff = aCoefficients[i];
+ for (int32_t j = 0; j < bLength; j++) {
product[i + j] = m_field->add(product[i + j], m_field->multiply(aCoeff, bCoefficients[j]));
}
}
@@ -170,19 +170,19 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(CBC_PDF417ECModulusPo BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
-CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::negative(FX_INT32 &e)
+CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::negative(int32_t &e)
{
- FX_INT32 size = m_coefficients.GetSize();
+ int32_t size = m_coefficients.GetSize();
CFX_Int32Array negativeCoefficients;
negativeCoefficients.SetSize(size);
- for (FX_INT32 i = 0; i < size; i++) {
+ for (int32_t i = 0; i < size; i++) {
negativeCoefficients[i] = m_field->subtract(0, m_coefficients[i]);
}
CBC_PDF417ECModulusPoly* modulusPoly = FX_NEW CBC_PDF417ECModulusPoly(m_field, negativeCoefficients, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
-CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(FX_INT32 scalar, FX_INT32 &e)
+CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(int32_t scalar, int32_t &e)
{
CBC_PDF417ECModulusPoly* modulusPoly = NULL;
if (scalar == 0) {
@@ -195,17 +195,17 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(FX_INT32 scalar, FX_I BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
- FX_INT32 size = m_coefficients.GetSize();
+ int32_t size = m_coefficients.GetSize();
CFX_Int32Array product;
product.SetSize(size);
- for (FX_INT32 i = 0; i < size; i++) {
+ for (int32_t i = 0; i < size; i++) {
product[i] = m_field->multiply(m_coefficients[i], scalar);
}
modulusPoly = FX_NEW CBC_PDF417ECModulusPoly(m_field, product, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
-CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiplyByMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e)
+CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiplyByMonomial(int32_t degree, int32_t coefficient, int32_t &e)
{
if (degree < 0) {
e = BCExceptionIllegalArgument;
@@ -217,17 +217,17 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiplyByMonomial(FX_INT32 de BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
- FX_INT32 size = m_coefficients.GetSize();
+ int32_t size = m_coefficients.GetSize();
CFX_Int32Array product;
product.SetSize(size + degree);
- for (FX_INT32 i = 0; i < size; i++) {
+ for (int32_t i = 0; i < size; i++) {
product[i] = m_field->multiply(m_coefficients[i], coefficient);
}
modulusPoly = FX_NEW CBC_PDF417ECModulusPoly(m_field, product, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return modulusPoly;
}
-CFX_PtrArray* CBC_PDF417ECModulusPoly::divide(CBC_PDF417ECModulusPoly* other, FX_INT32 &e)
+CFX_PtrArray* CBC_PDF417ECModulusPoly::divide(CBC_PDF417ECModulusPoly* other, int32_t &e)
{
if (other->isZero()) {
e = BCExceptionDivideByZero;
@@ -240,16 +240,16 @@ CFX_PtrArray* CBC_PDF417ECModulusPoly::divide(CBC_PDF417ECModulusPoly* other, FX delete quotient;
return NULL;
}
- FX_INT32 denominatorLeadingTerm = other->getCoefficient(other->getDegree());
- FX_INT32 inverseDenominatorLeadingTerm = m_field->inverse(denominatorLeadingTerm, e);
+ int32_t denominatorLeadingTerm = other->getCoefficient(other->getDegree());
+ int32_t inverseDenominatorLeadingTerm = m_field->inverse(denominatorLeadingTerm, e);
if (e != BCExceptionNO) {
delete quotient;
delete remainder;
return NULL;
}
while (remainder->getDegree() >= other->getDegree() && !remainder->isZero()) {
- FX_INT32 degreeDifference = remainder->getDegree() - other->getDegree();
- FX_INT32 scale = m_field->multiply(remainder->getCoefficient(remainder->getDegree()), inverseDenominatorLeadingTerm);
+ int32_t degreeDifference = remainder->getDegree() - other->getDegree();
+ int32_t scale = m_field->multiply(remainder->getCoefficient(remainder->getDegree()), inverseDenominatorLeadingTerm);
CBC_PDF417ECModulusPoly* term = other->multiplyByMonomial(degreeDifference, scale, e);
if (e != BCExceptionNO) {
delete quotient;
@@ -288,8 +288,8 @@ CFX_PtrArray* CBC_PDF417ECModulusPoly::divide(CBC_PDF417ECModulusPoly* other, FX CFX_ByteString CBC_PDF417ECModulusPoly::toString()
{
CFX_ByteString result;
- for (FX_INT32 degree = getDegree(); degree >= 0; degree--) {
- FX_INT32 coefficient = getCoefficient(degree);
+ for (int32_t degree = getDegree(); degree >= 0; degree--) {
+ int32_t coefficient = getCoefficient(degree);
if (coefficient != 0) {
if (coefficient < 0) {
result += " - ";
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h index 172cc76cc8..72c8d3eb35 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h @@ -10,21 +10,21 @@ class CBC_PDF417ECModulusGF; class CBC_PDF417ECModulusPoly
{
public:
- CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, CFX_Int32Array &coefficients, FX_INT32 &e);
+ CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, CFX_Int32Array &coefficients, int32_t &e);
virtual ~CBC_PDF417ECModulusPoly();
CFX_Int32Array& getCoefficients();
CBC_PDF417ECModulusGF* getField();
- FX_INT32 getDegree();
+ int32_t getDegree();
FX_BOOL isZero();
- FX_INT32 getCoefficient(FX_INT32 degree);
- FX_INT32 evaluateAt(FX_INT32 a);
- CBC_PDF417ECModulusPoly* add(CBC_PDF417ECModulusPoly* other, FX_INT32 &e);
- CBC_PDF417ECModulusPoly* subtract(CBC_PDF417ECModulusPoly* other, FX_INT32 &e);
- CBC_PDF417ECModulusPoly* multiply(CBC_PDF417ECModulusPoly* other, FX_INT32 &e);
- CBC_PDF417ECModulusPoly* negative(FX_INT32 &e);
- CBC_PDF417ECModulusPoly* multiply(FX_INT32 scalar, FX_INT32 &e);
- CBC_PDF417ECModulusPoly* multiplyByMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e);
- CFX_PtrArray* divide(CBC_PDF417ECModulusPoly* other, FX_INT32 &e);
+ int32_t getCoefficient(int32_t degree);
+ int32_t evaluateAt(int32_t a);
+ CBC_PDF417ECModulusPoly* add(CBC_PDF417ECModulusPoly* other, int32_t &e);
+ CBC_PDF417ECModulusPoly* subtract(CBC_PDF417ECModulusPoly* other, int32_t &e);
+ CBC_PDF417ECModulusPoly* multiply(CBC_PDF417ECModulusPoly* other, int32_t &e);
+ CBC_PDF417ECModulusPoly* negative(int32_t &e);
+ CBC_PDF417ECModulusPoly* multiply(int32_t scalar, int32_t &e);
+ CBC_PDF417ECModulusPoly* multiplyByMonomial(int32_t degree, int32_t coefficient, int32_t &e);
+ CFX_PtrArray* divide(CBC_PDF417ECModulusPoly* other, int32_t &e);
CFX_ByteString toString();
private:
CBC_PDF417ECModulusGF* m_field;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp index cd1ea88046..9dd6f67575 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp @@ -22,7 +22,7 @@ #include "../barcode.h"
#include "BC_PDF417ErrorCorrection.h"
-FX_INT32 CBC_PDF417ErrorCorrection::EC_COEFFICIENTS[][2500] = {
+int32_t CBC_PDF417ErrorCorrection::EC_COEFFICIENTS[][2500] = {
{27, 917},
{522, 568, 723, 809},
{237, 308, 436, 284, 646, 653, 428, 379},
@@ -132,7 +132,7 @@ CBC_PDF417ErrorCorrection::CBC_PDF417ErrorCorrection() CBC_PDF417ErrorCorrection::~CBC_PDF417ErrorCorrection()
{
}
-FX_INT32 CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(FX_INT32 errorCorrectionLevel, FX_INT32 &e)
+int32_t CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel, int32_t &e)
{
if (errorCorrectionLevel < 0 || errorCorrectionLevel > 8) {
e = BCExceptionErrorCorrectionLevelMustBeBetween0And8;
@@ -140,7 +140,7 @@ FX_INT32 CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(FX_INT32 err }
return 1 << (errorCorrectionLevel + 1);
}
-FX_INT32 CBC_PDF417ErrorCorrection::getRecommendedMinimumErrorCorrectionLevel(FX_INT32 n, FX_INT32 &e)
+int32_t CBC_PDF417ErrorCorrection::getRecommendedMinimumErrorCorrectionLevel(int32_t n, int32_t &e)
{
if (n <= 0) {
e = BCExceptionIllegalArgumentnMustBeAbove0;
@@ -161,18 +161,18 @@ FX_INT32 CBC_PDF417ErrorCorrection::getRecommendedMinimumErrorCorrectionLevel(FX e = BCExceptionNoRecommendationPossible;
return -1;
}
-CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(CFX_WideString dataCodewords, FX_INT32 errorCorrectionLevel, FX_INT32 &e)
+CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(CFX_WideString dataCodewords, int32_t errorCorrectionLevel, int32_t &e)
{
- FX_INT32 k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e);
+ int32_t k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR)' ');
FX_WCHAR* ech = FX_Alloc(FX_WCHAR, k * sizeof(FX_WCHAR));
FXSYS_memset32(ech, 0, k * sizeof(FX_WCHAR));
- FX_INT32 sld = dataCodewords.GetLength();
- for (FX_INT32 i = 0; i < sld; i++) {
- FX_INT32 t1 = (dataCodewords.GetAt(i) + ech[k - 1]) % 929;
- FX_INT32 t2;
- FX_INT32 t3;
- for (FX_INT32 j = k - 1; j >= 1; j--) {
+ int32_t sld = dataCodewords.GetLength();
+ for (int32_t i = 0; i < sld; i++) {
+ int32_t t1 = (dataCodewords.GetAt(i) + ech[k - 1]) % 929;
+ int32_t t2;
+ int32_t t3;
+ for (int32_t j = k - 1; j >= 1; j--) {
t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929;
t3 = 929 - t2;
ech[j] = (FX_WCHAR) ((ech[j - 1] + t3) % 929);
@@ -182,7 +182,7 @@ CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(CFX_WideString ech[0] = (FX_WCHAR) (t3 % 929);
}
CFX_WideString sb;
- for (FX_INT32 j = k - 1; j >= 0; j--) {
+ for (int32_t j = k - 1; j >= 0; j--) {
if (ech[j] != 0) {
ech[j] = (FX_WCHAR) (929 - ech[j]);
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h index 9af8b72f17..4e5dee0bb8 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h @@ -11,10 +11,10 @@ class CBC_PDF417ErrorCorrection public:
CBC_PDF417ErrorCorrection();
virtual ~CBC_PDF417ErrorCorrection();
- static FX_INT32 getErrorCorrectionCodewordCount(FX_INT32 errorCorrectionLevel, FX_INT32 &e);
- static FX_INT32 getRecommendedMinimumErrorCorrectionLevel(FX_INT32 n, FX_INT32 &e);
- static CFX_WideString generateErrorCorrection(CFX_WideString dataCodewords, FX_INT32 errorCorrectionLevel, FX_INT32 &e);
+ static int32_t getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel, int32_t &e);
+ static int32_t getRecommendedMinimumErrorCorrectionLevel(int32_t n, int32_t &e);
+ static CFX_WideString generateErrorCorrection(CFX_WideString dataCodewords, int32_t errorCorrectionLevel, int32_t &e);
private:
- static FX_INT32 EC_COEFFICIENTS[][2500];
+ static int32_t EC_COEFFICIENTS[][2500];
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index 54bd0b6c6a..85c01d60b0 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -28,23 +28,23 @@ #define SUBMODE_ALPHA 0
#define SUBMODE_LOWER 1
#define SUBMODE_MIXED 2
-FX_INT32 CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0;
-FX_INT32 CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1;
-FX_INT32 CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2;
-FX_INT32 CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3;
-FX_INT32 CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900;
-FX_INT32 CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901;
-FX_INT32 CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902;
-FX_INT32 CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913;
-FX_INT32 CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924;
-FX_BYTE CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, 13, 9, 44, 58,
+int32_t CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0;
+int32_t CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1;
+int32_t CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2;
+int32_t CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3;
+int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900;
+int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901;
+int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902;
+int32_t CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913;
+int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924;
+uint8_t CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, 13, 9, 44, 58,
35, 45, 46, 36, 47, 43, 37, 42, 61, 94, 0, 32, 0, 0, 0
};
-FX_BYTE CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = {59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, 13, 9, 44, 58,
+uint8_t CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = {59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, 13, 9, 44, 58,
10, 45, 46, 36, 47, 34, 124, 42, 40, 41, 63, 123, 125, 39, 0
};
-FX_INT32 CBC_PDF417HighLevelEncoder::MIXED[128] = {0};
-FX_INT32 CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0};
+int32_t CBC_PDF417HighLevelEncoder::MIXED[128] = {0};
+int32_t CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0};
void CBC_PDF417HighLevelEncoder::Initialize()
{
Inverse();
@@ -52,13 +52,13 @@ void CBC_PDF417HighLevelEncoder::Initialize() void CBC_PDF417HighLevelEncoder::Finalize()
{
}
-CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMsg, Compaction compaction, FX_INT32 &e)
+CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMsg, Compaction compaction, int32_t &e)
{
CFX_ByteString bytes;
CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes);
CFX_WideString msg;
- FX_INT32 len = bytes.GetLength();
- for (FX_INT32 i = 0; i < len; i++) {
+ int32_t len = bytes.GetLength();
+ for (int32_t i = 0; i < len; i++) {
FX_WCHAR ch = (FX_WCHAR)(bytes.GetAt(i) & 0xff);
if (ch == '?' && bytes.GetAt(i) != '?') {
e = BCExceptionCharactersOutsideISO88591Encoding;
@@ -67,13 +67,13 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs msg += ch;
}
CFX_ByteArray byteArr;
- for (FX_INT32 k = 0; k < bytes.GetLength(); k++) {
+ for (int32_t k = 0; k < bytes.GetLength(); k++) {
byteArr.Add(bytes.GetAt(k));
}
CFX_WideString sb;
len = msg.GetLength();
- FX_INT32 p = 0;
- FX_INT32 textSubMode = SUBMODE_ALPHA;
+ int32_t p = 0;
+ int32_t textSubMode = SUBMODE_ALPHA;
if (compaction == TEXT) {
encodeText(msg, p, len, sb, textSubMode);
} else if (compaction == BYTES) {
@@ -82,9 +82,9 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs sb += (FX_WCHAR) LATCH_TO_NUMERIC;
encodeNumeric(msg, p, len, sb);
} else {
- FX_INT32 encodingMode = LATCH_TO_TEXT;
+ int32_t encodingMode = LATCH_TO_TEXT;
while (p < len) {
- FX_INT32 n = determineConsecutiveDigitCount(msg, p);
+ int32_t n = determineConsecutiveDigitCount(msg, p);
if (n >= 13) {
sb += (FX_WCHAR) LATCH_TO_NUMERIC;
encodingMode = NUMERIC_COMPACTION;
@@ -92,7 +92,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs encodeNumeric(msg, p, n, sb);
p += n;
} else {
- FX_INT32 t = determineConsecutiveTextCount(msg, p);
+ int32_t t = determineConsecutiveTextCount(msg, p);
if (t >= 5 || n == len) {
if (encodingMode != TEXT_COMPACTION) {
sb += (FX_WCHAR) LATCH_TO_TEXT;
@@ -102,7 +102,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs textSubMode = encodeText(msg, p, t, sb, textSubMode);
p += t;
} else {
- FX_INT32 b = determineConsecutiveBinaryCount(msg, &byteArr, p, e);
+ int32_t b = determineConsecutiveBinaryCount(msg, &byteArr, p, e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR)' ');
if (b == 0) {
b = 1;
@@ -123,13 +123,13 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs }
void CBC_PDF417HighLevelEncoder::Inverse()
{
- FX_BYTE i = 0;
- FX_INT32 l = 0;
+ uint8_t i = 0;
+ int32_t l = 0;
for (l = 0; l < sizeof(MIXED) / sizeof(MIXED[0]); l++) {
MIXED[l] = -1;
}
for (i = 0; i < sizeof(TEXT_MIXED_RAW) / sizeof(TEXT_MIXED_RAW[0]); i++) {
- FX_BYTE b = TEXT_MIXED_RAW[i];
+ uint8_t b = TEXT_MIXED_RAW[i];
if (b > 0) {
MIXED[b] = i;
}
@@ -138,17 +138,17 @@ void CBC_PDF417HighLevelEncoder::Inverse() PUNCTUATION[l] = -1;
}
for (i = 0; i < sizeof(TEXT_PUNCTUATION_RAW) / sizeof(TEXT_PUNCTUATION_RAW[0]); i++) {
- FX_BYTE b = TEXT_PUNCTUATION_RAW[i];
+ uint8_t b = TEXT_PUNCTUATION_RAW[i];
if (b > 0) {
PUNCTUATION[b] = i;
}
}
}
-FX_INT32 CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb, FX_INT32 initialSubmode)
+int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString &sb, int32_t initialSubmode)
{
CFX_WideString tmp;
- FX_INT32 submode = initialSubmode;
- FX_INT32 idx = 0;
+ int32_t submode = initialSubmode;
+ int32_t idx = 0;
while (TRUE) {
FX_WCHAR ch = msg.GetAt(startpos + idx);
switch (submode) {
@@ -201,7 +201,7 @@ FX_INT32 CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, FX_INT32 sta case SUBMODE_MIXED:
if (isMixed(ch)) {
FX_WCHAR a = MIXED[ch];
- FX_INT32 b = (FX_INT32)a;
+ int32_t b = (int32_t)a;
tmp += MIXED[ch];
} else {
if (isAlphaUpper(ch)) {
@@ -241,8 +241,8 @@ FX_INT32 CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, FX_INT32 sta }
}
FX_WCHAR h = 0;
- FX_INT32 len = tmp.GetLength();
- for (FX_INT32 i = 0; i < len; i++) {
+ int32_t len = tmp.GetLength();
+ for (int32_t i = 0; i < len; i++) {
FX_BOOL odd = (i % 2) != 0;
if (odd) {
h = (FX_WCHAR) ((h * 30) + tmp.GetAt(i));
@@ -256,18 +256,18 @@ FX_INT32 CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, FX_INT32 sta }
return submode;
}
-void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes, FX_INT32 startpos, FX_INT32 count, FX_INT32 startmode, CFX_WideString &sb)
+void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes, int32_t startpos, int32_t count, int32_t startmode, CFX_WideString &sb)
{
if (count == 1 && startmode == TEXT_COMPACTION) {
sb += (FX_WCHAR) SHIFT_TO_BYTE;
}
- FX_INT32 idx = startpos;
- FX_INT32 i = 0;
+ int32_t idx = startpos;
+ int32_t i = 0;
if (count >= 6) {
sb += (FX_WCHAR) LATCH_TO_BYTE;
FX_WCHAR chars[5];
while ((startpos + count - idx) >= 6) {
- FX_INT64 t = 0;
+ int64_t t = 0;
for (i = 0; i < 6; i++) {
t <<= 8;
t += bytes->GetAt(idx + i) & 0xff;
@@ -286,25 +286,25 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes, FX_INT32 sta sb += (FX_WCHAR) LATCH_TO_BYTE_PADDED;
}
for (i = idx; i < startpos + count; i++) {
- FX_INT32 ch = bytes->GetAt(i) & 0xff;
+ int32_t ch = bytes->GetAt(i) & 0xff;
sb += (FX_WCHAR) ch;
}
}
-void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb)
+void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString &sb)
{
- FX_INT32 idx = 0;
+ int32_t idx = 0;
BigInteger num900 = 900;
while (idx < count) {
CFX_WideString tmp;
- FX_INT32 len = 44 < count - idx ? 44 : count - idx;
+ int32_t len = 44 < count - idx ? 44 : count - idx;
CFX_ByteString part = ((FX_WCHAR)'1' + msg.Mid(startpos + idx, len)).UTF8Encode();
BigInteger bigint = stringToBigInteger(part.c_str());
do {
- FX_INT32 c = (bigint % num900).toInt();
+ int32_t c = (bigint % num900).toInt();
tmp += (FX_WCHAR)(c);
bigint = bigint / num900;
} while (!bigint.isZero());
- for (FX_INT32 i = tmp.GetLength() - 1; i >= 0; i--) {
+ for (int32_t i = tmp.GetLength() - 1; i >= 0; i--) {
sb += tmp.GetAt(i);
}
idx += len;
@@ -334,11 +334,11 @@ FX_BOOL CBC_PDF417HighLevelEncoder::isText(FX_WCHAR ch) {
return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126);
}
-FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, FX_INT32 startpos)
+int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos)
{
- FX_INT32 count = 0;
- FX_INT32 len = msg.GetLength();
- FX_INT32 idx = startpos;
+ int32_t count = 0;
+ int32_t len = msg.GetLength();
+ int32_t idx = startpos;
if (idx < len) {
FX_WCHAR ch = msg.GetAt(idx);
while (isDigit(ch) && idx < len) {
@@ -351,13 +351,13 @@ FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideStri }
return count;
}
-FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(CFX_WideString msg, FX_INT32 startpos)
+int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(CFX_WideString msg, int32_t startpos)
{
- FX_INT32 len = msg.GetLength();
- FX_INT32 idx = startpos;
+ int32_t len = msg.GetLength();
+ int32_t idx = startpos;
while (idx < len) {
FX_WCHAR ch = msg.GetAt(idx);
- FX_INT32 numericCount = 0;
+ int32_t numericCount = 0;
while (numericCount < 13 && isDigit(ch) && idx < len) {
numericCount++;
idx++;
@@ -379,16 +379,16 @@ FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(CFX_WideStrin }
return idx - startpos;
}
-FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(CFX_WideString msg, CFX_ByteArray* bytes, FX_INT32 startpos, FX_INT32 &e)
+int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(CFX_WideString msg, CFX_ByteArray* bytes, int32_t startpos, int32_t &e)
{
- FX_INT32 len = msg.GetLength();
- FX_INT32 idx = startpos;
+ int32_t len = msg.GetLength();
+ int32_t idx = startpos;
while (idx < len) {
FX_WCHAR ch = msg.GetAt(idx);
- FX_INT32 numericCount = 0;
+ int32_t numericCount = 0;
while (numericCount < 13 && isDigit(ch)) {
numericCount++;
- FX_INT32 i = idx + numericCount;
+ int32_t i = idx + numericCount;
if (i >= len) {
break;
}
@@ -397,10 +397,10 @@ FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(CFX_WideStr if (numericCount >= 13) {
return idx - startpos;
}
- FX_INT32 textCount = 0;
+ int32_t textCount = 0;
while (textCount < 5 && isText(ch)) {
textCount++;
- FX_INT32 i = idx + textCount;
+ int32_t i = idx + textCount;
if (i >= len) {
break;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h index 7c8801cb21..177507c4f5 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h @@ -12,36 +12,36 @@ class CBC_PDF417HighLevelEncoder
{
public:
- static CFX_WideString encodeHighLevel(CFX_WideString msg, Compaction compaction, FX_INT32 &e);
+ static CFX_WideString encodeHighLevel(CFX_WideString msg, Compaction compaction, int32_t &e);
static void Inverse();
static void Initialize();
static void Finalize();
private:
- static FX_INT32 TEXT_COMPACTION;
- static FX_INT32 BYTE_COMPACTION;
- static FX_INT32 NUMERIC_COMPACTION;
- static FX_INT32 SUBMODE_PUNCTUATION;
- static FX_INT32 LATCH_TO_TEXT;
- static FX_INT32 LATCH_TO_BYTE_PADDED;
- static FX_INT32 LATCH_TO_NUMERIC;
- static FX_INT32 SHIFT_TO_BYTE;
- static FX_INT32 LATCH_TO_BYTE;
- static FX_BYTE TEXT_MIXED_RAW[];
- static FX_BYTE TEXT_PUNCTUATION_RAW[];
- static FX_INT32 MIXED[128];
- static FX_INT32 PUNCTUATION[128];
- static FX_INT32 encodeText(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb, FX_INT32 initialSubmode);
- static void encodeBinary(CFX_ByteArray* bytes, FX_INT32 startpos, FX_INT32 count, FX_INT32 startmode, CFX_WideString &sb);
- static void encodeNumeric(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb);
+ static int32_t TEXT_COMPACTION;
+ static int32_t BYTE_COMPACTION;
+ static int32_t NUMERIC_COMPACTION;
+ static int32_t SUBMODE_PUNCTUATION;
+ static int32_t LATCH_TO_TEXT;
+ static int32_t LATCH_TO_BYTE_PADDED;
+ static int32_t LATCH_TO_NUMERIC;
+ static int32_t SHIFT_TO_BYTE;
+ static int32_t LATCH_TO_BYTE;
+ static uint8_t TEXT_MIXED_RAW[];
+ static uint8_t TEXT_PUNCTUATION_RAW[];
+ static int32_t MIXED[128];
+ static int32_t PUNCTUATION[128];
+ static int32_t encodeText(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString &sb, int32_t initialSubmode);
+ static void encodeBinary(CFX_ByteArray* bytes, int32_t startpos, int32_t count, int32_t startmode, CFX_WideString &sb);
+ static void encodeNumeric(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString &sb);
static FX_BOOL isDigit(FX_WCHAR ch);
static FX_BOOL isAlphaUpper(FX_WCHAR ch);
static FX_BOOL isAlphaLower(FX_WCHAR ch);
static FX_BOOL isMixed(FX_WCHAR ch);
static FX_BOOL isPunctuation(FX_WCHAR ch);
static FX_BOOL isText(FX_WCHAR ch);
- static FX_INT32 determineConsecutiveDigitCount(CFX_WideString msg, FX_INT32 startpos);
- static FX_INT32 determineConsecutiveTextCount(CFX_WideString msg, FX_INT32 startpos);
- static FX_INT32 determineConsecutiveBinaryCount(CFX_WideString msg, CFX_ByteArray* bytes, FX_INT32 startpos, FX_INT32 &e);
+ static int32_t determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos);
+ static int32_t determineConsecutiveTextCount(CFX_WideString msg, int32_t startpos);
+ static int32_t determineConsecutiveBinaryCount(CFX_WideString msg, CFX_ByteArray* bytes, int32_t startpos, int32_t &e);
friend class PDF417HighLevelEncoder_EncodeNumeric_Test;
friend class PDF417HighLevelEncoder_EncodeBinary_Test;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp index ed751cc4ba..a880317ee0 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp @@ -57,16 +57,16 @@ CBC_PDF417Reader::CBC_PDF417Reader() CBC_PDF417Reader::~CBC_PDF417Reader()
{
}
-CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e)
+CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, int32_t &e)
{
return Decode(image, 0, e);
}
-CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, int32_t hints, int32_t &e)
{
CFX_ByteString results;
CBC_PDF417DetectorResult* detectorResult = CBC_Detector::detect(image, hints, multiple, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
- for (FX_INT32 i = 0; i < detectorResult->getPoints()->GetSize(); i++) {
+ for (int32_t i = 0; i < detectorResult->getPoints()->GetSize(); i++) {
CFX_PtrArray* points = (CFX_PtrArray*)detectorResult->getPoints()->GetAt(i);
CBC_CommonDecoderResult* ResultTemp = CBC_PDF417ScanningDecoder::decode(detectorResult->getBits(), (CBC_ResultPoint*)points->GetAt(4), (CBC_ResultPoint*)points->GetAt(5),
(CBC_ResultPoint*)points->GetAt(6), (CBC_ResultPoint*)points->GetAt(7), getMinCodewordWidth(*points), getMaxCodewordWidth(*points), e);
@@ -81,39 +81,39 @@ CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_BOOL multipl delete detectorResult;
return results;
}
-CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
CFX_ByteString bs = Decode(image, FALSE, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
return bs;
}
-FX_INT32 CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2)
+int32_t CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2)
{
if (p1 == NULL || p2 == NULL) {
return 0;
}
- return (FX_INT32) FXSYS_fabs(p1->GetX() - p2->GetX());
+ return (int32_t) FXSYS_fabs(p1->GetX() - p2->GetX());
}
-FX_INT32 CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2)
+int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2)
{
if (p1 == NULL || p2 == NULL) {
return Integer_MAX_VALUE;
}
- return (FX_INT32) FXSYS_fabs(p1->GetX() - p2->GetX());
+ return (int32_t) FXSYS_fabs(p1->GetX() - p2->GetX());
}
-FX_INT32 CBC_PDF417Reader::getMaxCodewordWidth(CFX_PtrArray& p)
+int32_t CBC_PDF417Reader::getMaxCodewordWidth(CFX_PtrArray& p)
{
- FX_INT32 a = getMaxWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- FX_INT32 b = getMaxWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- FX_INT32 c = getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a;
- FX_INT32 d = getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b;
+ int32_t a = getMaxWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t b = getMaxWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t c = getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a;
+ int32_t d = getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b;
return c < d ? c : d;
}
-FX_INT32 CBC_PDF417Reader::getMinCodewordWidth(CFX_PtrArray& p)
+int32_t CBC_PDF417Reader::getMinCodewordWidth(CFX_PtrArray& p)
{
- FX_INT32 a = getMinWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- FX_INT32 b = getMinWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- FX_INT32 c = getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a;
- FX_INT32 d = getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b;
+ int32_t a = getMinWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t b = getMinWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t c = getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a;
+ int32_t d = getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b;
return c < d ? c : d;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h index e6c0236cf7..031829d8e6 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h @@ -14,13 +14,13 @@ class CBC_PDF417Reader : public CBC_Reader public:
CBC_PDF417Reader();
virtual ~CBC_PDF417Reader();
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e);
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, FX_INT32 hints, FX_INT32 &e);
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, int32_t hints, int32_t &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e);
private:
- static FX_INT32 getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2);
- static FX_INT32 getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2);
- static FX_INT32 getMaxCodewordWidth(CFX_PtrArray& p);
- static FX_INT32 getMinCodewordWidth(CFX_PtrArray& p);
+ static int32_t getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2);
+ static int32_t getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2);
+ static int32_t getMaxCodewordWidth(CFX_PtrArray& p);
+ static int32_t getMinCodewordWidth(CFX_PtrArray& p);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp index 393ee2e75d..d99cefdb58 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp @@ -28,11 +28,11 @@ CBC_PDF417ResultMetadata::CBC_PDF417ResultMetadata() CBC_PDF417ResultMetadata::~CBC_PDF417ResultMetadata()
{
}
-FX_INT32 CBC_PDF417ResultMetadata::getSegmentIndex()
+int32_t CBC_PDF417ResultMetadata::getSegmentIndex()
{
return m_segmentIndex;
}
-void CBC_PDF417ResultMetadata::setSegmentIndex(FX_INT32 segmentIndex)
+void CBC_PDF417ResultMetadata::setSegmentIndex(int32_t segmentIndex)
{
m_segmentIndex = segmentIndex;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h index 7639c032ba..d635137e9d 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h @@ -11,8 +11,8 @@ class CBC_PDF417ResultMetadata public:
CBC_PDF417ResultMetadata();
virtual ~CBC_PDF417ResultMetadata();
- FX_INT32 getSegmentIndex();
- void setSegmentIndex(FX_INT32 segmentIndex);
+ int32_t getSegmentIndex();
+ void setSegmentIndex(int32_t segmentIndex);
CFX_ByteString getFileId();
void setFileId(CFX_ByteString fileId);
CFX_Int32Array& getOptionalData();
@@ -20,7 +20,7 @@ public: FX_BOOL isLastSegment();
void setLastSegment(FX_BOOL lastSegment);
private:
- FX_INT32 m_segmentIndex;
+ int32_t m_segmentIndex;
CFX_ByteString m_fileId;
CFX_Int32Array m_optionalData;
FX_BOOL m_lastSegment;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp index 2b127ceb07..de43e65144 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp @@ -40,9 +40,9 @@ #include "BC_PDF417ECErrorCorrection.h"
#include "BC_PDF417DecodedBitStreamParser.h"
#include "BC_PDF417ScanningDecoder.h"
-FX_INT32 CBC_PDF417ScanningDecoder::CODEWORD_SKEW_SIZE = 2;
-FX_INT32 CBC_PDF417ScanningDecoder::MAX_ERRORS = 3;
-FX_INT32 CBC_PDF417ScanningDecoder::MAX_EC_CODEWORDS = 512;
+int32_t CBC_PDF417ScanningDecoder::CODEWORD_SKEW_SIZE = 2;
+int32_t CBC_PDF417ScanningDecoder::MAX_ERRORS = 3;
+int32_t CBC_PDF417ScanningDecoder::MAX_EC_CODEWORDS = 512;
CBC_PDF417ECErrorCorrection* CBC_PDF417ScanningDecoder::errorCorrection = NULL;
CBC_PDF417ScanningDecoder::CBC_PDF417ScanningDecoder()
{
@@ -59,14 +59,14 @@ void CBC_PDF417ScanningDecoder::Finalize() delete errorCorrection;
}
CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(CBC_CommonBitMatrix* image, CBC_ResultPoint* imageTopLeft, CBC_ResultPoint* imageBottomLeft, CBC_ResultPoint* imageTopRight,
- CBC_ResultPoint* imageBottomRight, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth, FX_INT32 &e)
+ CBC_ResultPoint* imageBottomRight, int32_t minCodewordWidth, int32_t maxCodewordWidth, int32_t &e)
{
CBC_BoundingBox* boundingBox = FX_NEW CBC_BoundingBox(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn = NULL;
CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn = NULL;
CBC_DetectionResult* detectionResult = NULL;
- for (FX_INT32 i = 0; i < 2; i++) {
+ for (int32_t i = 0; i < 2; i++) {
if (imageTopLeft != NULL) {
leftRowIndicatorColumn = getRowIndicatorColumn(image, boundingBox, *imageTopLeft, TRUE, minCodewordWidth, maxCodewordWidth);
}
@@ -89,12 +89,12 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(CBC_CommonBitMatrix* break;
}
}
- FX_INT32 maxBarcodeColumn = detectionResult->getBarcodeColumnCount() + 1;
+ int32_t maxBarcodeColumn = detectionResult->getBarcodeColumnCount() + 1;
detectionResult->setDetectionResultColumn(0, leftRowIndicatorColumn);
detectionResult->setDetectionResultColumn(maxBarcodeColumn, rightRowIndicatorColumn);
FX_BOOL leftToRight = leftRowIndicatorColumn != NULL;
- for (FX_INT32 barcodeColumnCount = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) {
- FX_INT32 barcodeColumn = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount;
+ for (int32_t barcodeColumnCount = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) {
+ int32_t barcodeColumn = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount;
if (detectionResult->getDetectionResultColumn(barcodeColumn) != NULL) {
continue;
}
@@ -105,9 +105,9 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(CBC_CommonBitMatrix* detectionResultColumn = FX_NEW CBC_DetectionResultColumn(boundingBox);
}
detectionResult->setDetectionResultColumn(barcodeColumn, detectionResultColumn);
- FX_INT32 startColumn = -1;
- FX_INT32 previousStartColumn = startColumn;
- for (FX_INT32 imageRow = boundingBox->getMinY(); imageRow <= boundingBox->getMaxY(); imageRow++) {
+ int32_t startColumn = -1;
+ int32_t previousStartColumn = startColumn;
+ for (int32_t imageRow = boundingBox->getMinY(); imageRow <= boundingBox->getMaxY(); imageRow++) {
startColumn = getStartColumn(detectionResult, barcodeColumn, imageRow, leftToRight);
if (startColumn < 0 || startColumn > boundingBox->getMaxX()) {
if (previousStartColumn == -1) {
@@ -134,9 +134,9 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(CBC_CommonBitMatrix* CFX_ByteString CBC_PDF417ScanningDecoder::toString(CFX_PtrArray* barcodeMatrix)
{
CFX_ByteString result;
- for (FX_INT32 row = 0; row < barcodeMatrix->GetSize(); row++) {
+ for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) {
result += row;
- FX_INT32 l = 0;
+ int32_t l = 0;
for (; l < ((CFX_PtrArray*)barcodeMatrix->GetAt(row))->GetSize(); l++) {
CBC_BarcodeValue* barcodeValue = (CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(row))->GetAt(l);
if (barcodeValue->getValue()->GetSize() == 0) {
@@ -149,7 +149,7 @@ CFX_ByteString CBC_PDF417ScanningDecoder::toString(CFX_PtrArray* barcodeMatrix) }
return result;
}
-CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, FX_INT32 &e)
+CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, int32_t &e)
{
if (leftRowIndicatorColumn == NULL && rightRowIndicatorColumn == NULL) {
e = BCExceptionIllegalArgument;
@@ -178,45 +178,45 @@ CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(CBC_DetectionResultRowIndi CBC_DetectionResult* detectionresult = FX_NEW CBC_DetectionResult(barcodeMetadata, boundingBox);
return detectionresult;
}
-CBC_BoundingBox* CBC_PDF417ScanningDecoder::adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, FX_INT32 &e)
+CBC_BoundingBox* CBC_PDF417ScanningDecoder::adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, int32_t &e)
{
if (rowIndicatorColumn == NULL) {
return NULL;
}
CFX_Int32Array* rowHeights = rowIndicatorColumn->getRowHeights(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 maxRowHeight = getMax(*rowHeights);
- FX_INT32 missingStartRows = 0;
- for (FX_INT32 i = 0; i < rowHeights->GetSize(); i++) {
- FX_INT32 rowHeight = rowHeights->GetAt(i);
+ int32_t maxRowHeight = getMax(*rowHeights);
+ int32_t missingStartRows = 0;
+ for (int32_t i = 0; i < rowHeights->GetSize(); i++) {
+ int32_t rowHeight = rowHeights->GetAt(i);
missingStartRows += maxRowHeight - rowHeight;
if (rowHeight > 0) {
break;
}
}
CFX_PtrArray* codewords = rowIndicatorColumn->getCodewords();
- for (FX_INT32 row = 0; missingStartRows > 0 && codewords->GetAt(row) == NULL; row++) {
+ for (int32_t row = 0; missingStartRows > 0 && codewords->GetAt(row) == NULL; row++) {
missingStartRows--;
}
- FX_INT32 missingEndRows = 0;
- for (FX_INT32 row1 = rowHeights->GetSize() - 1; row1 >= 0; row1--) {
+ int32_t missingEndRows = 0;
+ for (int32_t row1 = rowHeights->GetSize() - 1; row1 >= 0; row1--) {
missingEndRows += maxRowHeight - rowHeights->GetAt(row1);
if (rowHeights->GetAt(row1) > 0) {
break;
}
}
- for (FX_INT32 row2 = codewords->GetSize() - 1; missingEndRows > 0 && codewords->GetAt(row2) == NULL; row2--) {
+ for (int32_t row2 = codewords->GetSize() - 1; missingEndRows > 0 && codewords->GetAt(row2) == NULL; row2--) {
missingEndRows--;
}
CBC_BoundingBox* boundingBox = rowIndicatorColumn->getBoundingBox()->addMissingRows(missingStartRows, missingEndRows, rowIndicatorColumn->isLeft(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return boundingBox;
}
-FX_INT32 CBC_PDF417ScanningDecoder::getMax(CFX_Int32Array& values)
+int32_t CBC_PDF417ScanningDecoder::getMax(CFX_Int32Array& values)
{
- FX_INT32 maxValue = -1;
- for (FX_INT32 i = 0; i < values.GetSize(); i++) {
- FX_INT32 value = values.GetAt(i);
+ int32_t maxValue = -1;
+ for (int32_t i = 0; i < values.GetSize(); i++) {
+ int32_t value = values.GetAt(i);
maxValue = maxValue > value ? maxValue : value;
}
return maxValue;
@@ -243,13 +243,13 @@ CBC_BarcodeMetadata* CBC_PDF417ScanningDecoder::getBarcodeMetadata(CBC_Detection return leftBarcodeMetadata;
}
CBC_DetectionResultRowIndicatorColumn* CBC_PDF417ScanningDecoder::getRowIndicatorColumn(CBC_CommonBitMatrix* image, CBC_BoundingBox* boundingBox, CBC_ResultPoint startPoint,
- FX_BOOL leftToRight, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth)
+ FX_BOOL leftToRight, int32_t minCodewordWidth, int32_t maxCodewordWidth)
{
CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn = FX_NEW CBC_DetectionResultRowIndicatorColumn(boundingBox, leftToRight);
- for (FX_INT32 i = 0; i < 2; i++) {
- FX_INT32 increment = i == 0 ? 1 : -1;
- FX_INT32 startColumn = (FX_INT32) startPoint.GetX();
- for (FX_INT32 imageRow = (FX_INT32) startPoint.GetY(); imageRow <= boundingBox->getMaxY() && imageRow >= boundingBox->getMinY(); imageRow += increment) {
+ for (int32_t i = 0; i < 2; i++) {
+ int32_t increment = i == 0 ? 1 : -1;
+ int32_t startColumn = (int32_t) startPoint.GetX();
+ for (int32_t imageRow = (int32_t) startPoint.GetY(); imageRow <= boundingBox->getMaxY() && imageRow >= boundingBox->getMinY(); imageRow += increment) {
CBC_Codeword* codeword = detectCodeword(image, 0, image->GetWidth(), leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth);
if (codeword != NULL) {
rowIndicatorColumn->setCodeword(imageRow, codeword);
@@ -263,10 +263,10 @@ CBC_DetectionResultRowIndicatorColumn* CBC_PDF417ScanningDecoder::getRowIndicato }
return rowIndicatorColumn;
}
-void CBC_PDF417ScanningDecoder::adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, FX_INT32 &e)
+void CBC_PDF417ScanningDecoder::adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, int32_t &e)
{
CFX_Int32Array* numberOfCodewords = ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(0))->GetAt(1))->getValue();
- FX_INT32 calculatedNumberOfCodewords = detectionResult->getBarcodeColumnCount() * detectionResult->getBarcodeRowCount() - getNumberOfECCodeWords(detectionResult->getBarcodeECLevel());
+ int32_t calculatedNumberOfCodewords = detectionResult->getBarcodeColumnCount() * detectionResult->getBarcodeRowCount() - getNumberOfECCodeWords(detectionResult->getBarcodeECLevel());
if (numberOfCodewords->GetSize() == 0) {
if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE) {
e = BCExceptiontNotFoundInstance;
@@ -279,14 +279,14 @@ void CBC_PDF417ScanningDecoder::adjustCodewordCount(CBC_DetectionResult* detecti }
delete numberOfCodewords;
}
-CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_DetectionResult* detectionResult, FX_INT32 &e)
+CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_DetectionResult* detectionResult, int32_t &e)
{
CFX_PtrArray* barcodeMatrix = createBarcodeMatrix(detectionResult);
adjustCodewordCount(detectionResult, barcodeMatrix, e);
if (e != BCExceptionNO) {
- for (FX_INT32 i = 0; i < barcodeMatrix->GetSize(); i++) {
+ for (int32_t i = 0; i < barcodeMatrix->GetSize(); i++) {
CFX_PtrArray* temp = (CFX_PtrArray*)barcodeMatrix->GetAt(i);
- for (FX_INT32 j = 0; j < temp->GetSize(); j++) {
+ for (int32_t j = 0; j < temp->GetSize(); j++) {
delete (CBC_BarcodeValue*)temp->GetAt(j);
}
temp->RemoveAll();
@@ -301,10 +301,10 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_Dete codewords.SetSize(detectionResult->getBarcodeRowCount() * detectionResult->getBarcodeColumnCount());
CFX_PtrArray ambiguousIndexValuesList;
CFX_Int32Array ambiguousIndexesList;
- for (FX_INT32 row = 0; row < detectionResult->getBarcodeRowCount(); row++) {
- for (FX_INT32 l = 0; l < detectionResult->getBarcodeColumnCount(); l++) {
+ for (int32_t row = 0; row < detectionResult->getBarcodeRowCount(); row++) {
+ for (int32_t l = 0; l < detectionResult->getBarcodeColumnCount(); l++) {
CFX_Int32Array* values = ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(row))->GetAt(l + 1))->getValue();
- FX_INT32 codewordIndex = row * detectionResult->getBarcodeColumnCount() + l;
+ int32_t codewordIndex = row * detectionResult->getBarcodeColumnCount() + l;
if (values->GetSize() == 0) {
erasures.Add(codewordIndex);
} else if (values->GetSize() == 1) {
@@ -317,12 +317,12 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_Dete }
CFX_PtrArray ambiguousIndexValues;
ambiguousIndexValues.SetSize(ambiguousIndexValuesList.GetSize());
- for (FX_INT32 i = 0; i < ambiguousIndexValues.GetSize(); i++) {
+ for (int32_t i = 0; i < ambiguousIndexValues.GetSize(); i++) {
ambiguousIndexValues.SetAt(i, ambiguousIndexValuesList.GetAt(i));
}
- for (FX_INT32 l = 0; l < barcodeMatrix->GetSize(); l++) {
+ for (int32_t l = 0; l < barcodeMatrix->GetSize(); l++) {
CFX_PtrArray* temp = (CFX_PtrArray*)barcodeMatrix->GetAt(l);
- for (FX_INT32 j = 0; j < temp->GetSize(); j++) {
+ for (int32_t j = 0; j < temp->GetSize(); j++) {
delete (CBC_BarcodeValue*)temp->GetAt(j);
}
temp->RemoveAll();
@@ -334,14 +334,14 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_Dete BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return decoderResult;
}
-CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(FX_INT32 ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes,
- CFX_PtrArray& ambiguousIndexValues, FX_INT32 &e)
+CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(int32_t ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes,
+ CFX_PtrArray& ambiguousIndexValues, int32_t &e)
{
CFX_Int32Array ambiguousIndexCount;
ambiguousIndexCount.SetSize(ambiguousIndexes.GetSize());
- FX_INT32 tries = 100;
+ int32_t tries = 100;
while (tries-- > 0) {
- for (FX_INT32 l = 0; l < ambiguousIndexCount.GetSize(); l++) {
+ for (int32_t l = 0; l < ambiguousIndexCount.GetSize(); l++) {
codewords[ambiguousIndexes[l]] = ((CFX_Int32Array*)ambiguousIndexValues.GetAt(l))->GetAt(ambiguousIndexCount[l]);
}
CBC_CommonDecoderResult* decoderResult = decodeCodewords(codewords, ecLevel, erasureArray, e);
@@ -355,7 +355,7 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResultFromAmbig e = BCExceptionChecksumInstance;
return NULL;
}
- for (FX_INT32 i = 0; i < ambiguousIndexCount.GetSize(); i++) {
+ for (int32_t i = 0; i < ambiguousIndexCount.GetSize(); i++) {
if (ambiguousIndexCount[i] < ((CFX_Int32Array*)(ambiguousIndexValues.GetAt(i)))->GetSize() - 1) {
ambiguousIndexCount[i]++;
break;
@@ -376,8 +376,8 @@ CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(CBC_DetectionResult CFX_PtrArray* barcodeMatrix = FX_NEW CFX_PtrArray;
barcodeMatrix->SetSize(detectionResult->getBarcodeRowCount());
CFX_PtrArray* temp = NULL;
- FX_INT32 colume = 0;
- for (FX_INT32 row = 0; row < barcodeMatrix->GetSize(); row++) {
+ int32_t colume = 0;
+ for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) {
temp = FX_NEW CFX_PtrArray;
temp->SetSize(detectionResult->getBarcodeColumnCount() + 2);
for (colume = 0; colume < detectionResult->getBarcodeColumnCount() + 2; colume++) {
@@ -386,14 +386,14 @@ CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(CBC_DetectionResult barcodeMatrix->SetAt(row, temp);
}
colume = -1;
- for (FX_INT32 i = 0; i < detectionResult->getDetectionResultColumns().GetSize(); i++) {
+ for (int32_t i = 0; i < detectionResult->getDetectionResultColumns().GetSize(); i++) {
CBC_DetectionResultColumn* detectionResultColumn = (CBC_DetectionResultColumn*) detectionResult->getDetectionResultColumns().GetAt(i);
colume++;
if (detectionResultColumn == NULL) {
continue;
}
CFX_PtrArray* temp = detectionResultColumn->getCodewords();
- for (FX_INT32 l = 0; l < temp->GetSize(); l++) {
+ for (int32_t l = 0; l < temp->GetSize(); l++) {
CBC_Codeword* codeword = (CBC_Codeword*) temp->GetAt(l);
if (codeword == NULL || codeword->getRowNumber() == -1) {
continue;
@@ -403,13 +403,13 @@ CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(CBC_DetectionResult }
return barcodeMatrix;
}
-FX_BOOL CBC_PDF417ScanningDecoder::isValidBarcodeColumn(CBC_DetectionResult* detectionResult, FX_INT32 barcodeColumn)
+FX_BOOL CBC_PDF417ScanningDecoder::isValidBarcodeColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn)
{
return barcodeColumn >= 0 && barcodeColumn <= detectionResult->getBarcodeColumnCount() + 1;
}
-FX_INT32 CBC_PDF417ScanningDecoder::getStartColumn(CBC_DetectionResult* detectionResult, FX_INT32 barcodeColumn, FX_INT32 imageRow, FX_BOOL leftToRight)
+int32_t CBC_PDF417ScanningDecoder::getStartColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn, int32_t imageRow, FX_BOOL leftToRight)
{
- FX_INT32 offset = leftToRight ? 1 : -1;
+ int32_t offset = leftToRight ? 1 : -1;
CBC_Codeword* codeword = NULL;
if (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
codeword = detectionResult->getDetectionResultColumn(barcodeColumn - offset)->getCodeword(imageRow);
@@ -427,10 +427,10 @@ FX_INT32 CBC_PDF417ScanningDecoder::getStartColumn(CBC_DetectionResult* detectio if (codeword != NULL) {
return leftToRight ? codeword->getEndX() : codeword->getStartX();
}
- FX_INT32 skippedColumns = 0;
+ int32_t skippedColumns = 0;
while (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
barcodeColumn -= offset;
- for (FX_INT32 i = 0; i < detectionResult->getDetectionResultColumn(barcodeColumn)->getCodewords()->GetSize(); i++) {
+ for (int32_t i = 0; i < detectionResult->getDetectionResultColumn(barcodeColumn)->getCodewords()->GetSize(); i++) {
CBC_Codeword* previousRowCodeword = (CBC_Codeword*) detectionResult->getDetectionResultColumn(barcodeColumn)->getCodewords()->GetAt(i);
if (previousRowCodeword != NULL) {
return (leftToRight ? previousRowCodeword->getEndX() : previousRowCodeword->getStartX()) +
@@ -441,42 +441,42 @@ FX_INT32 CBC_PDF417ScanningDecoder::getStartColumn(CBC_DetectionResult* detectio }
return leftToRight ? detectionResult->getBoundingBox()->getMinX() : detectionResult->getBoundingBox()->getMaxX();
}
-CBC_Codeword* CBC_PDF417ScanningDecoder::detectCodeword(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 startColumn,
- FX_INT32 imageRow, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth)
+CBC_Codeword* CBC_PDF417ScanningDecoder::detectCodeword(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn,
+ int32_t imageRow, int32_t minCodewordWidth, int32_t maxCodewordWidth)
{
startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
CFX_Int32Array* moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
if (moduleBitCount == NULL) {
return NULL;
}
- FX_INT32 endColumn;
- FX_INT32 codewordBitCount = CBC_PDF417Common::getBitCountSum(*moduleBitCount);
+ int32_t endColumn;
+ int32_t codewordBitCount = CBC_PDF417Common::getBitCountSum(*moduleBitCount);
if (leftToRight) {
endColumn = startColumn + codewordBitCount;
} else {
- for (FX_INT32 i = 0; i < moduleBitCount->GetSize() >> 1; i++) {
- FX_INT32 tmpCount = moduleBitCount->GetAt(i);
+ for (int32_t i = 0; i < moduleBitCount->GetSize() >> 1; i++) {
+ int32_t tmpCount = moduleBitCount->GetAt(i);
moduleBitCount->SetAt(i, moduleBitCount->GetAt(moduleBitCount->GetSize() - 1 - i));
moduleBitCount->SetAt(moduleBitCount->GetSize() - 1 - i, tmpCount);
}
endColumn = startColumn;
startColumn = endColumn - codewordBitCount;
}
- FX_INT32 decodedValue = CBC_PDF417CodewordDecoder::getDecodedValue(*moduleBitCount);
- FX_INT32 codeword = CBC_PDF417Common::getCodeword(decodedValue);
+ int32_t decodedValue = CBC_PDF417CodewordDecoder::getDecodedValue(*moduleBitCount);
+ int32_t codeword = CBC_PDF417Common::getCodeword(decodedValue);
delete moduleBitCount;
if (codeword == -1) {
return NULL;
}
return FX_NEW CBC_Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue), codeword);
}
-CFX_Int32Array* CBC_PDF417ScanningDecoder::getModuleBitCount(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 startColumn, FX_INT32 imageRow)
+CFX_Int32Array* CBC_PDF417ScanningDecoder::getModuleBitCount(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn, int32_t imageRow)
{
- FX_INT32 imageColumn = startColumn;
+ int32_t imageColumn = startColumn;
CFX_Int32Array* moduleBitCount = FX_NEW CFX_Int32Array;
moduleBitCount->SetSize(8);
- FX_INT32 moduleNumber = 0;
- FX_INT32 increment = leftToRight ? 1 : -1;
+ int32_t moduleNumber = 0;
+ int32_t increment = leftToRight ? 1 : -1;
FX_BOOL previousPixelValue = leftToRight;
while (((leftToRight && imageColumn < maxColumn) || (!leftToRight && imageColumn >= minColumn)) && moduleNumber < moduleBitCount->GetSize()) {
if (image->Get(imageColumn, imageRow) == previousPixelValue) {
@@ -493,15 +493,15 @@ CFX_Int32Array* CBC_PDF417ScanningDecoder::getModuleBitCount(CBC_CommonBitMatrix delete moduleBitCount;
return NULL;
}
-FX_INT32 CBC_PDF417ScanningDecoder::getNumberOfECCodeWords(FX_INT32 barcodeECLevel)
+int32_t CBC_PDF417ScanningDecoder::getNumberOfECCodeWords(int32_t barcodeECLevel)
{
return 2 << barcodeECLevel;
}
-FX_INT32 CBC_PDF417ScanningDecoder::adjustCodewordStartColumn(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 codewordStartColumn, FX_INT32 imageRow)
+int32_t CBC_PDF417ScanningDecoder::adjustCodewordStartColumn(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t codewordStartColumn, int32_t imageRow)
{
- FX_INT32 correctedStartColumn = codewordStartColumn;
- FX_INT32 increment = leftToRight ? -1 : 1;
- for (FX_INT32 i = 0; i < 2; i++) {
+ int32_t correctedStartColumn = codewordStartColumn;
+ int32_t increment = leftToRight ? -1 : 1;
+ for (int32_t i = 0; i < 2; i++) {
FX_BOOL l = image->Get(correctedStartColumn, imageRow);
while (((leftToRight && correctedStartColumn >= minColumn) || (!leftToRight && correctedStartColumn < maxColumn)) && leftToRight == image->Get(correctedStartColumn, imageRow)) {
if (abs(codewordStartColumn - correctedStartColumn) > CODEWORD_SKEW_SIZE) {
@@ -514,18 +514,18 @@ FX_INT32 CBC_PDF417ScanningDecoder::adjustCodewordStartColumn(CBC_CommonBitMatri }
return correctedStartColumn;
}
-FX_BOOL CBC_PDF417ScanningDecoder::checkCodewordSkew(FX_INT32 codewordSize, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth)
+FX_BOOL CBC_PDF417ScanningDecoder::checkCodewordSkew(int32_t codewordSize, int32_t minCodewordWidth, int32_t maxCodewordWidth)
{
return minCodewordWidth - CODEWORD_SKEW_SIZE <= codewordSize && codewordSize <= maxCodewordWidth + CODEWORD_SKEW_SIZE;
}
-CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decodeCodewords(CFX_Int32Array &codewords, FX_INT32 ecLevel, CFX_Int32Array &erasures, FX_INT32 &e)
+CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decodeCodewords(CFX_Int32Array &codewords, int32_t ecLevel, CFX_Int32Array &erasures, int32_t &e)
{
if (codewords.GetSize() == 0) {
e = BCExceptionFormatInstance;
return NULL;
}
- FX_INT32 numECCodewords = 1 << (ecLevel + 1);
- FX_INT32 correctedErrorsCount = correctErrors(codewords, erasures, numECCodewords, e);
+ int32_t numECCodewords = 1 << (ecLevel + 1);
+ int32_t correctedErrorsCount = correctErrors(codewords, erasures, numECCodewords, e);
BC_EXCEPTION_CHECK_ReturnValue(e , NULL);
verifyCodewordCount(codewords, numECCodewords, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -534,23 +534,23 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decodeCodewords(CFX_Int32Arr BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return decoderResult;
}
-FX_INT32 CBC_PDF417ScanningDecoder::correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, FX_INT32 numECCodewords, FX_INT32 &e)
+int32_t CBC_PDF417ScanningDecoder::correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, int32_t numECCodewords, int32_t &e)
{
if ((erasures.GetSize() != 0 && erasures.GetSize() > (numECCodewords / 2 + MAX_ERRORS)) || numECCodewords < 0 || numECCodewords > MAX_EC_CODEWORDS) {
e = BCExceptionChecksumInstance;
return -1;
}
- FX_INT32 result = CBC_PDF417ECErrorCorrection::decode(codewords, numECCodewords, erasures, e);
+ int32_t result = CBC_PDF417ECErrorCorrection::decode(codewords, numECCodewords, erasures, e);
BC_EXCEPTION_CHECK_ReturnValue(e, -1);
return result;
}
-void CBC_PDF417ScanningDecoder::verifyCodewordCount(CFX_Int32Array &codewords, FX_INT32 numECCodewords, FX_INT32 &e)
+void CBC_PDF417ScanningDecoder::verifyCodewordCount(CFX_Int32Array &codewords, int32_t numECCodewords, int32_t &e)
{
if (codewords.GetSize() < 4) {
e = BCExceptionFormatInstance;
return;
}
- FX_INT32 numberOfCodewords = codewords.GetAt(0);
+ int32_t numberOfCodewords = codewords.GetAt(0);
if (numberOfCodewords > codewords.GetSize()) {
e = BCExceptionFormatInstance;
return;
@@ -564,12 +564,12 @@ void CBC_PDF417ScanningDecoder::verifyCodewordCount(CFX_Int32Array &codewords, F }
}
}
-CFX_Int32Array* CBC_PDF417ScanningDecoder::getBitCountForCodeword(FX_INT32 codeword)
+CFX_Int32Array* CBC_PDF417ScanningDecoder::getBitCountForCodeword(int32_t codeword)
{
CFX_Int32Array* result = FX_NEW CFX_Int32Array;
result->SetSize(8);
- FX_INT32 previousValue = 0;
- FX_INT32 i = result->GetSize() - 1;
+ int32_t previousValue = 0;
+ int32_t i = result->GetSize() - 1;
while (TRUE) {
if ((codeword & 0x1) != previousValue) {
previousValue = codeword & 0x1;
@@ -583,14 +583,14 @@ CFX_Int32Array* CBC_PDF417ScanningDecoder::getBitCountForCodeword(FX_INT32 codew }
return result;
}
-FX_INT32 CBC_PDF417ScanningDecoder::getCodewordBucketNumber(FX_INT32 codeword)
+int32_t CBC_PDF417ScanningDecoder::getCodewordBucketNumber(int32_t codeword)
{
CFX_Int32Array* array = getBitCountForCodeword(codeword);
- FX_INT32 result = getCodewordBucketNumber(*array);
+ int32_t result = getCodewordBucketNumber(*array);
delete array;
return result;
}
-FX_INT32 CBC_PDF417ScanningDecoder::getCodewordBucketNumber(CFX_Int32Array& moduleBitCount)
+int32_t CBC_PDF417ScanningDecoder::getCodewordBucketNumber(CFX_Int32Array& moduleBitCount)
{
return (moduleBitCount.GetAt(0) - moduleBitCount.GetAt(2) + moduleBitCount.GetAt(4) - moduleBitCount.GetAt(6) + 9) % 9;
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h index 8cb5d2856c..1022288811 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h @@ -25,37 +25,37 @@ public: static void Initialize();
static void Finalize();
static CBC_CommonDecoderResult* decode(CBC_CommonBitMatrix* image, CBC_ResultPoint* imageTopLeft, CBC_ResultPoint* imageBottomLeft, CBC_ResultPoint* imageTopRight,
- CBC_ResultPoint* imageBottomRight, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth, FX_INT32 &e);
+ CBC_ResultPoint* imageBottomRight, int32_t minCodewordWidth, int32_t maxCodewordWidth, int32_t &e);
static CFX_ByteString toString(CFX_PtrArray* barcodeMatrix);
private:
- static FX_INT32 CODEWORD_SKEW_SIZE;
- static FX_INT32 MAX_ERRORS;
- static FX_INT32 MAX_EC_CODEWORDS;
+ static int32_t CODEWORD_SKEW_SIZE;
+ static int32_t MAX_ERRORS;
+ static int32_t MAX_EC_CODEWORDS;
static CBC_PDF417ECErrorCorrection* errorCorrection;
- static CBC_DetectionResult* merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, FX_INT32 &e);
- static CBC_BoundingBox* adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, FX_INT32 &e);
- static FX_INT32 getMax(CFX_Int32Array& values);
+ static CBC_DetectionResult* merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, int32_t &e);
+ static CBC_BoundingBox* adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, int32_t &e);
+ static int32_t getMax(CFX_Int32Array& values);
static CBC_BarcodeMetadata* getBarcodeMetadata(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn);
static CBC_DetectionResultRowIndicatorColumn* getRowIndicatorColumn(CBC_CommonBitMatrix* image, CBC_BoundingBox* boundingBox, CBC_ResultPoint startPoint,
- FX_BOOL leftToRight, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth);
- static void adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, FX_INT32 &e);
- static CBC_CommonDecoderResult* createDecoderResult(CBC_DetectionResult* detectionResult, FX_INT32 &e);
- static CBC_CommonDecoderResult* createDecoderResultFromAmbiguousValues(FX_INT32 ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes,
- CFX_PtrArray& ambiguousIndexValues, FX_INT32 &e);
+ FX_BOOL leftToRight, int32_t minCodewordWidth, int32_t maxCodewordWidth);
+ static void adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, int32_t &e);
+ static CBC_CommonDecoderResult* createDecoderResult(CBC_DetectionResult* detectionResult, int32_t &e);
+ static CBC_CommonDecoderResult* createDecoderResultFromAmbiguousValues(int32_t ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes,
+ CFX_PtrArray& ambiguousIndexValues, int32_t &e);
static CFX_PtrArray* createBarcodeMatrix(CBC_DetectionResult* detectionResult);
- static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult, FX_INT32 barcodeColumn);
- static FX_INT32 getStartColumn(CBC_DetectionResult* detectionResult, FX_INT32 barcodeColumn, FX_INT32 imageRow, FX_BOOL leftToRight);
- static CBC_Codeword* detectCodeword(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 startColumn,
- FX_INT32 imageRow, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth);
- static CFX_Int32Array* getModuleBitCount(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 startColumn, FX_INT32 imageRow);
- static FX_INT32 getNumberOfECCodeWords(FX_INT32 barcodeECLevel);
- static FX_INT32 adjustCodewordStartColumn(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 codewordStartColumn, FX_INT32 imageRow);
- static FX_BOOL checkCodewordSkew(FX_INT32 codewordSize, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth);
- static CBC_CommonDecoderResult* decodeCodewords(CFX_Int32Array &codewords, FX_INT32 ecLevel, CFX_Int32Array &erasures, FX_INT32 &e);
- static FX_INT32 correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, FX_INT32 numECCodewords, FX_INT32 &e);
- static void verifyCodewordCount(CFX_Int32Array &codewords, FX_INT32 numECCodewords, FX_INT32 &e);
- static CFX_Int32Array* getBitCountForCodeword(FX_INT32 codeword);
- static FX_INT32 getCodewordBucketNumber(FX_INT32 codeword);
- static FX_INT32 getCodewordBucketNumber(CFX_Int32Array& moduleBitCount);
+ static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn);
+ static int32_t getStartColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn, int32_t imageRow, FX_BOOL leftToRight);
+ static CBC_Codeword* detectCodeword(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn,
+ int32_t imageRow, int32_t minCodewordWidth, int32_t maxCodewordWidth);
+ static CFX_Int32Array* getModuleBitCount(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn, int32_t imageRow);
+ static int32_t getNumberOfECCodeWords(int32_t barcodeECLevel);
+ static int32_t adjustCodewordStartColumn(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t codewordStartColumn, int32_t imageRow);
+ static FX_BOOL checkCodewordSkew(int32_t codewordSize, int32_t minCodewordWidth, int32_t maxCodewordWidth);
+ static CBC_CommonDecoderResult* decodeCodewords(CFX_Int32Array &codewords, int32_t ecLevel, CFX_Int32Array &erasures, int32_t &e);
+ static int32_t correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, int32_t numECCodewords, int32_t &e);
+ static void verifyCodewordCount(CFX_Int32Array &codewords, int32_t numECCodewords, int32_t &e);
+ static CFX_Int32Array* getBitCountForCodeword(int32_t codeword);
+ static int32_t getCodewordBucketNumber(int32_t codeword);
+ static int32_t getCodewordBucketNumber(CFX_Int32Array& moduleBitCount);
};
#endif
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp index 86951c91e9..5154b2e231 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp @@ -36,7 +36,7 @@ CBC_PDF417Writer::~CBC_PDF417Writer() {
m_bTruncated = TRUE;
}
-FX_BOOL CBC_PDF417Writer:: SetErrorCorrectionLevel(FX_INT32 level)
+FX_BOOL CBC_PDF417Writer:: SetErrorCorrectionLevel(int32_t level)
{
if (level < 0 || level > 8) {
return FALSE;
@@ -48,7 +48,7 @@ void CBC_PDF417Writer::SetTruncated(FX_BOOL truncated) {
m_bTruncated = truncated;
}
-FX_BYTE* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
if ( format != BCFORMAT_PDF_417) {
return NULL;
@@ -56,15 +56,15 @@ FX_BYTE* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT forma CFX_WideString encodeContents = contents.UTF8Decode();
return Encode(encodeContents, outWidth, outHeight, e );
}
-FX_BYTE* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
return NULL;
}
-FX_BYTE* CBC_PDF417Writer::Encode(const CFX_WideString &contents, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString &contents, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
CBC_PDF417 encoder;
- FX_INT32 col = (m_Width / m_ModuleWidth - 69) / 17;
- FX_INT32 row = m_Height / (m_ModuleWidth * 20);
+ int32_t col = (m_Width / m_ModuleWidth - 69) / 17;
+ int32_t row = m_Height / (m_ModuleWidth * 20);
if (row >= 3 && row <= 90 && col >= 1 && col <= 30) {
encoder.setDimensions(col, col, row, row);
} else if (col >= 1 && col <= 30) {
@@ -74,26 +74,26 @@ FX_BYTE* CBC_PDF417Writer::Encode(const CFX_WideString &contents, FX_INT32 &outW }
encoder.generateBarcodeLogic(contents, m_iCorrectLevel, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 lineThickness = 2;
- FX_INT32 aspectRatio = 4;
+ int32_t lineThickness = 2;
+ int32_t aspectRatio = 4;
CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix();
CFX_ByteArray originalScale;
originalScale.Copy(barcodeMatrix->getScaledMatrix(lineThickness, aspectRatio * lineThickness));
- FX_INT32 width = outWidth;
- FX_INT32 height = outHeight;
+ int32_t width = outWidth;
+ int32_t height = outHeight;
outWidth = barcodeMatrix->getWidth();
outHeight = barcodeMatrix->getHeight();
FX_BOOL rotated = FALSE;
if ((height > width) ^ (outWidth < outHeight)) {
rotateArray(originalScale, outHeight, outWidth);
rotated = TRUE;
- FX_INT32 temp = outHeight;
+ int32_t temp = outHeight;
outHeight = outWidth;
outWidth = temp;
}
- FX_INT32 scaleX = width / outWidth;
- FX_INT32 scaleY = height / outHeight;
- FX_INT32 scale;
+ int32_t scaleX = width / outWidth;
+ int32_t scaleY = height / outHeight;
+ int32_t scale;
if (scaleX < scaleY) {
scale = scaleX;
} else {
@@ -104,22 +104,22 @@ FX_BYTE* CBC_PDF417Writer::Encode(const CFX_WideString &contents, FX_INT32 &outW originalScale.Copy(barcodeMatrix->getScaledMatrix(scale * lineThickness, scale * aspectRatio * lineThickness));
if (rotated) {
rotateArray(originalScale, outHeight, outWidth);
- FX_INT32 temp = outHeight;
+ int32_t temp = outHeight;
outHeight = outWidth;
outWidth = temp;
}
}
- FX_BYTE* result = (FX_BYTE*)FX_Alloc(FX_BYTE, outHeight * outWidth);
+ uint8_t* result = (uint8_t*)FX_Alloc(uint8_t, outHeight * outWidth);
FXSYS_memcpy32(result, originalScale.GetData(), outHeight * outWidth);
return result;
}
-void CBC_PDF417Writer::rotateArray(CFX_ByteArray& bitarray, FX_INT32 height, FX_INT32 width)
+void CBC_PDF417Writer::rotateArray(CFX_ByteArray& bitarray, int32_t height, int32_t width)
{
CFX_ByteArray temp;
temp.Copy(bitarray);
- for (FX_INT32 ii = 0; ii < height; ii++) {
- FX_INT32 inverseii = height - ii - 1;
- for (FX_INT32 jj = 0; jj < width; jj++) {
+ for (int32_t ii = 0; ii < height; ii++) {
+ int32_t inverseii = height - ii - 1;
+ for (int32_t jj = 0; jj < width; jj++) {
bitarray[jj * height + inverseii] = temp[ii * width + jj];
}
}
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h index 5d974f9377..e44959f4ff 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h @@ -13,14 +13,14 @@ class CBC_PDF417Writer : public CBC_TwoDimWriter public:
CBC_PDF417Writer();
virtual ~CBC_PDF417Writer();
- FX_BYTE * Encode(const CFX_WideString &contents, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
+ uint8_t * Encode(const CFX_WideString &contents, int32_t &outWidth, int32_t &outHeight, int32_t &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BOOL SetErrorCorrectionLevel(FX_INT32 level);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ FX_BOOL SetErrorCorrectionLevel(int32_t level);
void SetTruncated(FX_BOOL truncated);
private:
- void rotateArray(CFX_ByteArray& bitarray, FX_INT32 width, FX_INT32 height);
+ void rotateArray(CFX_ByteArray& bitarray, int32_t width, int32_t height);
FX_BOOL m_bTruncated;
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp index 669a0fbf7e..fa75cd8995 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp @@ -26,10 +26,10 @@ #include "BC_QRAlignmentPattern.h"
#include "BC_QRAlignmentPatternFinder.h"
CBC_QRAlignmentPatternFinder::CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix *image,
- FX_INT32 startX,
- FX_INT32 startY,
- FX_INT32 width,
- FX_INT32 height,
+ int32_t startX,
+ int32_t startY,
+ int32_t width,
+ int32_t height,
FX_FLOAT moduleSize): m_image(image),
m_startX(startX),
m_startY(startY),
@@ -42,29 +42,29 @@ CBC_QRAlignmentPatternFinder::CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix * }
CBC_QRAlignmentPatternFinder::~CBC_QRAlignmentPatternFinder()
{
- for (FX_INT32 i = 0; i < m_possibleCenters.GetSize(); i++) {
+ for (int32_t i = 0; i < m_possibleCenters.GetSize(); i++) {
delete (CBC_QRAlignmentPattern*)m_possibleCenters[i];
}
m_possibleCenters.RemoveAll();
}
-CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::Find(FX_INT32 &e)
+CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::Find(int32_t &e)
{
- FX_INT32 startX = m_startX;
- FX_INT32 height = m_height;
- FX_INT32 maxJ = startX + m_width;
- FX_INT32 middleI = m_startY + (height >> 1);
+ int32_t startX = m_startX;
+ int32_t height = m_height;
+ int32_t maxJ = startX + m_width;
+ int32_t middleI = m_startY + (height >> 1);
CFX_Int32Array stateCount;
stateCount.SetSize(3);
- for (FX_INT32 iGen = 0; iGen < height; iGen++) {
- FX_INT32 i = middleI + ((iGen & 0x01) == 0 ? ((iGen + 1) >> 1) : -((iGen + 1) >> 1));
+ for (int32_t iGen = 0; iGen < height; iGen++) {
+ int32_t i = middleI + ((iGen & 0x01) == 0 ? ((iGen + 1) >> 1) : -((iGen + 1) >> 1));
stateCount[0] = 0;
stateCount[1] = 0;
stateCount[2] = 0;
- FX_INT32 j = startX;
+ int32_t j = startX;
while (j < maxJ && !m_image->Get(j, i)) {
j++;
}
- FX_INT32 currentState = 0;
+ int32_t currentState = 0;
while (j < maxJ) {
if (m_image->Get(j, i)) {
if (currentState == 1) {
@@ -107,7 +107,7 @@ CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::Find(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return NULL;
}
-FX_FLOAT CBC_QRAlignmentPatternFinder::CenterFromEnd(const CFX_Int32Array &stateCount, FX_INT32 end)
+FX_FLOAT CBC_QRAlignmentPatternFinder::CenterFromEnd(const CFX_Int32Array &stateCount, int32_t end)
{
return (FX_FLOAT) (end - stateCount[2]) - stateCount[1] / 2.0f;
}
@@ -115,23 +115,23 @@ FX_BOOL CBC_QRAlignmentPatternFinder::FoundPatternCross(const CFX_Int32Array &st {
FX_FLOAT moduleSize = m_moduleSize;
FX_FLOAT maxVariance = moduleSize / 2.0f;
- for (FX_INT32 i = 0; i < 3; i++) {
+ for (int32_t i = 0; i < 3; i++) {
if (fabs(moduleSize - stateCount[i]) >= maxVariance) {
return false;
}
}
return TRUE;
}
-FX_FLOAT CBC_QRAlignmentPatternFinder::CrossCheckVertical(FX_INT32 startI, FX_INT32 centerJ, FX_INT32 maxCount, FX_INT32 originalStateCountTotal)
+FX_FLOAT CBC_QRAlignmentPatternFinder::CrossCheckVertical(int32_t startI, int32_t centerJ, int32_t maxCount, int32_t originalStateCountTotal)
{
CBC_CommonBitMatrix *image = m_image;
- FX_INT32 maxI = m_image->GetHeight();
+ int32_t maxI = m_image->GetHeight();
CFX_Int32Array stateCount;
stateCount.Copy(m_crossCheckStateCount);
stateCount[0] = 0;
stateCount[1] = 0;
stateCount[2] = 0;
- FX_INT32 i = startI;
+ int32_t i = startI;
while (i >= 0 && m_image->Get(centerJ, i) && stateCount[1] <= maxCount) {
stateCount[1]++;
i--;
@@ -161,21 +161,21 @@ FX_FLOAT CBC_QRAlignmentPatternFinder::CrossCheckVertical(FX_INT32 startI, FX_IN if (stateCount[2] > maxCount) {
return FXSYS_nan();
}
- FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
+ int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
if (5 * abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) {
return FXSYS_nan();
}
return FoundPatternCross(stateCount) ? CenterFromEnd(stateCount, i) : FXSYS_nan();
}
-CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::HandlePossibleCenter(const CFX_Int32Array &stateCount, FX_INT32 i, FX_INT32 j)
+CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::HandlePossibleCenter(const CFX_Int32Array &stateCount, int32_t i, int32_t j)
{
- FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
+ int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
FX_FLOAT centerJ = CenterFromEnd(stateCount, j);
- FX_FLOAT centerI = CrossCheckVertical(i, (FX_INT32) centerJ, 2 * stateCount[1], stateCountTotal);
+ FX_FLOAT centerI = CrossCheckVertical(i, (int32_t) centerJ, 2 * stateCount[1], stateCountTotal);
if (!FXSYS_isnan(centerI)) {
FX_FLOAT estimatedModuleSize = (FX_FLOAT) (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f;
- FX_INT32 max = m_possibleCenters.GetSize();
- for (FX_INT32 index = 0; index < max; index++) {
+ int32_t max = m_possibleCenters.GetSize();
+ for (int32_t index = 0; index < max; index++) {
CBC_QRAlignmentPattern *center = (CBC_QRAlignmentPattern *)(m_possibleCenters[index]);
if (center->AboutEquals(estimatedModuleSize, centerI, centerJ)) {
return FX_NEW CBC_QRAlignmentPattern(centerJ, centerI, estimatedModuleSize);
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h index c1d224a8eb..b16517ede2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h @@ -13,19 +13,19 @@ class CBC_QRAlignmentPatternFinder private:
CBC_CommonBitMatrix *m_image;
CFX_PtrArray m_possibleCenters;
- FX_INT32 m_startX;
- FX_INT32 m_startY;
- FX_INT32 m_width;
- FX_INT32 m_height;
+ int32_t m_startX;
+ int32_t m_startY;
+ int32_t m_width;
+ int32_t m_height;
FX_FLOAT m_moduleSize;
CFX_Int32Array m_crossCheckStateCount;
public:
- CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix *image, FX_INT32 startX, FX_INT32 startY, FX_INT32 width, FX_INT32 height, FX_FLOAT moduleSize);
+ CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix *image, int32_t startX, int32_t startY, int32_t width, int32_t height, FX_FLOAT moduleSize);
virtual ~CBC_QRAlignmentPatternFinder();
FX_BOOL FoundPatternCross(const CFX_Int32Array &stateCount);
- FX_FLOAT CrossCheckVertical(FX_INT32 startI, FX_INT32 startJ, FX_INT32 maxCount, FX_INT32 originalStateCountTotal);
- CBC_QRAlignmentPattern* Find(FX_INT32 &e);
- CBC_QRAlignmentPattern *HandlePossibleCenter(const CFX_Int32Array &stateCount, FX_INT32 i, FX_INT32 j);
- static FX_FLOAT CenterFromEnd(const CFX_Int32Array &stateCount, FX_INT32 end);
+ FX_FLOAT CrossCheckVertical(int32_t startI, int32_t startJ, int32_t maxCount, int32_t originalStateCountTotal);
+ CBC_QRAlignmentPattern* Find(int32_t &e);
+ CBC_QRAlignmentPattern *HandlePossibleCenter(const CFX_Int32Array &stateCount, int32_t i, int32_t j);
+ static FX_FLOAT CenterFromEnd(const CFX_Int32Array &stateCount, int32_t end);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp index 7c85c58367..ba5662bb4e 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp @@ -29,7 +29,7 @@ CBC_QRBitMatrixParser::CBC_QRBitMatrixParser()
{
}
-void CBC_QRBitMatrixParser::Init(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e)
+void CBC_QRBitMatrixParser::Init(CBC_CommonBitMatrix *bitMatrix, int32_t &e)
{
m_dimension = bitMatrix->GetDimension(e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -50,34 +50,34 @@ CBC_QRBitMatrixParser::~CBC_QRBitMatrixParser() }
m_version = NULL;
}
-CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(FX_INT32 &e)
+CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(int32_t &e)
{
if(m_parsedFormatInfo != NULL) {
return m_parsedFormatInfo;
}
- FX_INT32 formatInfoBits = 0;
- FX_INT32 j;
+ int32_t formatInfoBits = 0;
+ int32_t j;
for( j = 0; j < 6; j++) {
formatInfoBits = CopyBit(8, j, formatInfoBits);
}
formatInfoBits = CopyBit(8, 7, formatInfoBits);
formatInfoBits = CopyBit(8, 8, formatInfoBits);
formatInfoBits = CopyBit(7, 8, formatInfoBits);
- for(FX_INT32 i = 5; i >= 0; i--) {
+ for(int32_t i = 5; i >= 0; i--) {
formatInfoBits = CopyBit(i, 8, formatInfoBits);
}
m_parsedFormatInfo = CBC_QRCoderFormatInformation::DecodeFormatInformation(formatInfoBits);
if(m_parsedFormatInfo != NULL) {
return m_parsedFormatInfo;
}
- FX_INT32 dimension = m_bitMatrix->GetDimension(e);
+ int32_t dimension = m_bitMatrix->GetDimension(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
formatInfoBits = 0;
- FX_INT32 iMin = dimension - 8;
+ int32_t iMin = dimension - 8;
for(j = dimension - 1; j >= iMin; j--) {
formatInfoBits = CopyBit(j, 8, formatInfoBits);
}
- for(FX_INT32 k = dimension - 7; k < dimension; k++) {
+ for(int32_t k = dimension - 7; k < dimension; k++) {
formatInfoBits = CopyBit(8, k , formatInfoBits);
}
m_parsedFormatInfo = CBC_QRCoderFormatInformation::DecodeFormatInformation(formatInfoBits);
@@ -88,23 +88,23 @@ CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(FX_IN BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return NULL;
}
-CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(FX_INT32 &e)
+CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(int32_t &e)
{
if(m_version != NULL) {
return m_version;
}
- FX_INT32 dimension = m_bitMatrix->GetDimension(e);
+ int32_t dimension = m_bitMatrix->GetDimension(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 provisionVersion = (dimension - 17) >> 2;
+ int32_t provisionVersion = (dimension - 17) >> 2;
if(provisionVersion <= 6) {
CBC_QRCoderVersion* qrv = CBC_QRCoderVersion::GetVersionForNumber(provisionVersion, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return qrv;
}
- FX_INT32 versionBits = 0;
- for (FX_INT32 i = 5; i >= 0; i--) {
- FX_INT32 jMin = dimension - 11;
- for (FX_INT32 j = dimension - 9; j >= jMin; j--) {
+ int32_t versionBits = 0;
+ for (int32_t i = 5; i >= 0; i--) {
+ int32_t jMin = dimension - 11;
+ for (int32_t j = dimension - 9; j >= jMin; j--) {
versionBits = CopyBit(i, j, versionBits);
}
}
@@ -114,9 +114,9 @@ CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(FX_INT32 &e) return m_version;
}
versionBits = 0;
- for (FX_INT32 j = 5; j >= 0; j--) {
- FX_INT32 iMin = dimension - 11;
- for (FX_INT32 i = dimension - 9; i >= iMin; i--) {
+ for (int32_t j = 5; j >= 0; j--) {
+ int32_t iMin = dimension - 11;
+ for (int32_t i = dimension - 9; i >= iMin; i--) {
versionBits = CopyBit(i, j, versionBits);
}
}
@@ -129,19 +129,19 @@ CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return NULL;
}
-FX_INT32 CBC_QRBitMatrixParser::CopyBit(FX_INT32 i, FX_INT32 j, FX_INT32 versionBits)
+int32_t CBC_QRBitMatrixParser::CopyBit(int32_t i, int32_t j, int32_t versionBits)
{
return m_bitMatrix->Get(j, i) ? (versionBits << 1) | 0x1 : versionBits << 1;
}
-CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(FX_INT32 &e)
+CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(int32_t &e)
{
CBC_QRCoderFormatInformation *formatInfo = ReadFormatInformation(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL)
CBC_QRCoderVersion *version = ReadVersion(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_QRDataMask *dataMask = CBC_QRDataMask::ForReference((FX_INT32)(formatInfo->GetDataMask()), e);
+ CBC_QRDataMask *dataMask = CBC_QRDataMask::ForReference((int32_t)(formatInfo->GetDataMask()), e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 dimension = m_bitMatrix->GetDimension(e);
+ int32_t dimension = m_bitMatrix->GetDimension(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
dataMask->UnmaskBitMatirx(m_bitMatrix, dimension);
CBC_CommonBitMatrix* cbm = version->BuildFunctionPattern(e);
@@ -151,16 +151,16 @@ CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(FX_INT32 &e) CFX_ByteArray * temp = FX_NEW CFX_ByteArray;
temp->SetSize(version->GetTotalCodeWords());
CBC_AutoPtr<CFX_ByteArray> result(temp);
- FX_INT32 resultOffset = 0;
- FX_INT32 currentByte = 0;
- FX_INT32 bitsRead = 0;
- for(FX_INT32 j = dimension - 1; j > 0; j -= 2) {
+ int32_t resultOffset = 0;
+ int32_t currentByte = 0;
+ int32_t bitsRead = 0;
+ for(int32_t j = dimension - 1; j > 0; j -= 2) {
if(j == 6) {
j--;
}
- for(FX_INT32 count = 0; count < dimension; count++) {
- FX_INT32 i = readingUp ? dimension - 1 - count : count;
- for(FX_INT32 col = 0; col < 2; col++) {
+ for(int32_t count = 0; count < dimension; count++) {
+ int32_t i = readingUp ? dimension - 1 - count : count;
+ for(int32_t col = 0; col < 2; col++) {
if(!functionPattern->Get(j - col, i)) {
bitsRead++;
currentByte <<= 1;
@@ -168,7 +168,7 @@ CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(FX_INT32 &e) currentByte |= 1;
}
if(bitsRead == 8) {
- (*result)[resultOffset++] = (FX_BYTE) currentByte;
+ (*result)[resultOffset++] = (uint8_t) currentByte;
bitsRead = 0;
currentByte = 0;
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h index 0189ba7c81..6f378fff95 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h @@ -17,14 +17,14 @@ private: CBC_CommonBitMatrix *m_tempBitMatrix;
CBC_QRCoderVersion *m_version;
CBC_QRCoderFormatInformation *m_parsedFormatInfo;
- FX_INT32 m_dimension;
+ int32_t m_dimension;
public:
CBC_QRBitMatrixParser();
virtual ~CBC_QRBitMatrixParser();
- CBC_QRCoderFormatInformation *ReadFormatInformation(FX_INT32 &e);
- CBC_QRCoderVersion *ReadVersion(FX_INT32 &e);
- FX_INT32 CopyBit(FX_INT32 i, FX_INT32 j, FX_INT32 versionBits);
- CFX_ByteArray *ReadCodewords(FX_INT32 &e);
- virtual void Init(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e);
+ CBC_QRCoderFormatInformation *ReadFormatInformation(int32_t &e);
+ CBC_QRCoderVersion *ReadVersion(int32_t &e);
+ int32_t CopyBit(int32_t i, int32_t j, int32_t versionBits);
+ CFX_ByteArray *ReadCodewords(int32_t &e);
+ virtual void Init(CBC_CommonBitMatrix *bitMatrix, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp index f12c4e0ad3..ab28f3434d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp @@ -55,7 +55,7 @@ CBC_QRCodeReader::~CBC_QRCodeReader() }
m_decoder = NULL;
}
-CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
CBC_CommonBitMatrix *matrix = image->GetMatrix(e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -68,7 +68,7 @@ CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, CBC_AutoPtr<CBC_CommonDecoderResult> decodeResult(qdr2);
return (decodeResult->GetText());
}
-CFX_ByteString CBC_QRCodeReader::Decode(const CFX_WideString &filename, FX_INT32 hints, FX_INT32 byteModeDecode, FX_INT32 &e)
+CFX_ByteString CBC_QRCodeReader::Decode(const CFX_WideString &filename, int32_t hints, int32_t byteModeDecode, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(filename);
source.Init(e);
@@ -79,7 +79,7 @@ CFX_ByteString CBC_QRCodeReader::Decode(const CFX_WideString &filename, FX_INT32 BC_EXCEPTION_CHECK_ReturnValue(e, "");
return bs;
}
-CFX_ByteString CBC_QRCodeReader::Decode(CFX_DIBitmap *pBitmap, FX_INT32 hints, FX_INT32 byteModeDecode, FX_INT32 &e)
+CFX_ByteString CBC_QRCodeReader::Decode(CFX_DIBitmap *pBitmap, int32_t hints, int32_t byteModeDecode, int32_t &e)
{
CBC_BufferedImageLuminanceSource source(pBitmap);
CBC_GlobalHistogramBinarizer binarizer(&source);
@@ -88,7 +88,7 @@ CFX_ByteString CBC_QRCodeReader::Decode(CFX_DIBitmap *pBitmap, FX_INT32 hints, F BC_EXCEPTION_CHECK_ReturnValue(e, "");
return bs;
}
-CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e)
+CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, int32_t &e)
{
CFX_ByteString bs = Decode(image, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h index 71a1ad3dd6..73b83d390e 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h @@ -25,11 +25,11 @@ private: public:
CBC_QRCodeReader();
virtual ~CBC_QRCodeReader();
- CFX_ByteString Decode(CFX_DIBitmap *pBitmap, FX_INT32 hints, FX_INT32 byteModeDecode, FX_INT32 &e);
- CFX_ByteString Decode(const CFX_WideString &filename, FX_INT32 hints, FX_INT32 byteModeDecode, FX_INT32 &e);
+ CFX_ByteString Decode(CFX_DIBitmap *pBitmap, int32_t hints, int32_t byteModeDecode, int32_t &e);
+ CFX_ByteString Decode(const CFX_WideString &filename, int32_t hints, int32_t byteModeDecode, int32_t &e);
static void ReleaseAll();
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e);
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e);
virtual void Init();
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp index ccc0220d6c..37d0277bec 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp @@ -42,7 +42,7 @@ void CBC_QRCodeWriter::ReleaseAll() {
CBC_QRCodeReader::ReleaseAll();
}
-FX_BOOL CBC_QRCodeWriter::SetVersion(FX_INT32 version)
+FX_BOOL CBC_QRCodeWriter::SetVersion(int32_t version)
{
if (version < 0 || version > 40) {
return FALSE;
@@ -50,7 +50,7 @@ FX_BOOL CBC_QRCodeWriter::SetVersion(FX_INT32 version) m_iVersion = version;
return TRUE;
}
-FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(FX_INT32 level)
+FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level)
{
if (level < 0 || level > 3) {
return FALSE;
@@ -58,7 +58,7 @@ FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(FX_INT32 level) m_iCorrectLevel = level;
return TRUE;
}
-FX_BYTE* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, FX_INT32 ecLevel, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, int32_t ecLevel, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
CBC_QRCoderErrorCorrectionLevel *ec = NULL;
switch(ecLevel) {
@@ -89,15 +89,15 @@ FX_BYTE* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, FX_INT32 ecLev BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
outWidth = qr.GetMatrixWidth();
outHeight = qr.GetMatrixWidth();
- FX_BYTE* result = FX_Alloc(FX_BYTE, outWidth * outWidth);
+ uint8_t* result = FX_Alloc(uint8_t, outWidth * outWidth);
FXSYS_memcpy32(result, qr.GetMatrix()->GetArray(), outWidth * outHeight);
return result;
}
-FX_BYTE *CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
return NULL;
}
-FX_BYTE* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
return NULL;
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h index bf0ca71996..7cfd978c47 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h @@ -15,14 +15,14 @@ class CBC_QRCodeWriter : public CBC_TwoDimWriter public:
CBC_QRCodeWriter();
virtual ~CBC_QRCodeWriter();
- FX_BYTE* Encode(const CFX_WideString& contents, FX_INT32 ecLevel, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE* Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BYTE* Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BOOL SetVersion(FX_INT32 version);
- FX_BOOL SetErrorCorrectionLevel(FX_INT32 level);
+ uint8_t* Encode(const CFX_WideString& contents, int32_t ecLevel, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t* Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ uint8_t* Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ FX_BOOL SetVersion(int32_t version);
+ FX_BOOL SetErrorCorrectionLevel(int32_t level);
static void ReleaseAll();
private:
- FX_INT32 m_iVersion;
+ int32_t m_iVersion;
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp index f650f83b48..1f642016e2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp @@ -62,31 +62,31 @@ CBC_QRCoderErrorCorrectionLevel* CBC_QRCoder::GetECLevel() {
return m_ecLevel;
}
-FX_INT32 CBC_QRCoder::GetVersion()
+int32_t CBC_QRCoder::GetVersion()
{
return m_version;
}
-FX_INT32 CBC_QRCoder::GetMatrixWidth()
+int32_t CBC_QRCoder::GetMatrixWidth()
{
return m_matrixWidth;
}
-FX_INT32 CBC_QRCoder::GetMaskPattern()
+int32_t CBC_QRCoder::GetMaskPattern()
{
return m_maskPattern;
}
-FX_INT32 CBC_QRCoder::GetNumTotalBytes()
+int32_t CBC_QRCoder::GetNumTotalBytes()
{
return m_numTotalBytes;
}
-FX_INT32 CBC_QRCoder::GetNumDataBytes()
+int32_t CBC_QRCoder::GetNumDataBytes()
{
return m_numDataBytes;
}
-FX_INT32 CBC_QRCoder::GetNumECBytes()
+int32_t CBC_QRCoder::GetNumECBytes()
{
return m_numECBytes;
}
-FX_INT32 CBC_QRCoder::GetNumRSBlocks()
+int32_t CBC_QRCoder::GetNumRSBlocks()
{
return m_numRSBlocks;
}
@@ -94,9 +94,9 @@ CBC_CommonByteMatrix* CBC_QRCoder::GetMatrix() {
return m_matrix;
}
-FX_INT32 CBC_QRCoder::At(FX_INT32 x, FX_INT32 y, FX_INT32 &e)
+int32_t CBC_QRCoder::At(int32_t x, int32_t y, int32_t &e)
{
- FX_INT32 value = m_matrix->Get(x, y);
+ int32_t value = m_matrix->Get(x, y);
if(!(value == 0 || value == 1)) {
e = BCExceptionValueMustBeEither0or1;
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
@@ -129,35 +129,35 @@ void CBC_QRCoder::SetECLevel(CBC_QRCoderErrorCorrectionLevel* ecLevel) {
m_ecLevel = ecLevel;
}
-void CBC_QRCoder::SetVersion(FX_INT32 version)
+void CBC_QRCoder::SetVersion(int32_t version)
{
m_version = version;
}
-void CBC_QRCoder::SetMatrixWidth(FX_INT32 width)
+void CBC_QRCoder::SetMatrixWidth(int32_t width)
{
m_matrixWidth = width;
}
-void CBC_QRCoder::SetMaskPattern(FX_INT32 pattern)
+void CBC_QRCoder::SetMaskPattern(int32_t pattern)
{
m_maskPattern = pattern;
}
-void CBC_QRCoder::SetNumDataBytes(FX_INT32 bytes)
+void CBC_QRCoder::SetNumDataBytes(int32_t bytes)
{
m_numDataBytes = bytes;
}
-void CBC_QRCoder::SetNumTotalBytes(FX_INT32 value)
+void CBC_QRCoder::SetNumTotalBytes(int32_t value)
{
m_numTotalBytes = value;
}
-void CBC_QRCoder::SetNumRSBlocks(FX_INT32 block)
+void CBC_QRCoder::SetNumRSBlocks(int32_t block)
{
m_numRSBlocks = block;
}
-void CBC_QRCoder::SetNumECBytes(FX_INT32 value)
+void CBC_QRCoder::SetNumECBytes(int32_t value)
{
m_numECBytes = value;
}
-FX_BOOL CBC_QRCoder::IsValidMaskPattern(FX_INT32 maskPattern)
+FX_BOOL CBC_QRCoder::IsValidMaskPattern(int32_t maskPattern)
{
return maskPattern >= 0 && maskPattern < NUM_MASK_PATTERNS;
}
@@ -165,4 +165,4 @@ void CBC_QRCoder::SetMatrix(CBC_CommonByteMatrix* value) {
m_matrix = value;
}
-const FX_INT32 CBC_QRCoder::NUM_MASK_PATTERNS = 8;
+const int32_t CBC_QRCoder::NUM_MASK_PATTERNS = 8;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoder.h b/xfa/src/fxbarcode/qrcode/BC_QRCoder.h index 3c24dc2bc9..72db2fe487 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoder.h @@ -15,41 +15,41 @@ class CBC_QRCoder private:
CBC_QRCoderMode* m_mode;
CBC_QRCoderErrorCorrectionLevel* m_ecLevel;
- FX_INT32 m_version;
- FX_INT32 m_matrixWidth;
- FX_INT32 m_maskPattern;
- FX_INT32 m_numTotalBytes;
- FX_INT32 m_numDataBytes;
- FX_INT32 m_numECBytes;
- FX_INT32 m_numRSBlocks;
+ int32_t m_version;
+ int32_t m_matrixWidth;
+ int32_t m_maskPattern;
+ int32_t m_numTotalBytes;
+ int32_t m_numDataBytes;
+ int32_t m_numECBytes;
+ int32_t m_numRSBlocks;
CBC_CommonByteMatrix* m_matrix;
public:
- const static FX_INT32 NUM_MASK_PATTERNS;
+ const static int32_t NUM_MASK_PATTERNS;
CBC_QRCoder();
virtual ~CBC_QRCoder();
CBC_QRCoderMode* GetMode();
CBC_QRCoderErrorCorrectionLevel* GetECLevel();
- FX_INT32 GetVersion();
- FX_INT32 GetMatrixWidth();
- FX_INT32 GetMaskPattern();
- FX_INT32 GetNumTotalBytes();
- FX_INT32 GetNumDataBytes();
- FX_INT32 GetNumECBytes();
- FX_INT32 GetNumRSBlocks();
+ int32_t GetVersion();
+ int32_t GetMatrixWidth();
+ int32_t GetMaskPattern();
+ int32_t GetNumTotalBytes();
+ int32_t GetNumDataBytes();
+ int32_t GetNumECBytes();
+ int32_t GetNumRSBlocks();
CBC_CommonByteMatrix* GetMatrix();
- FX_INT32 At(FX_INT32 x, FX_INT32 y, FX_INT32 &e);
+ int32_t At(int32_t x, int32_t y, int32_t &e);
FX_BOOL IsValid();
void SetMode(CBC_QRCoderMode* value);
void SetECLevel(CBC_QRCoderErrorCorrectionLevel* ecLevel);
- void SetVersion(FX_INT32 version);
- void SetMatrixWidth(FX_INT32 width);
- void SetMaskPattern(FX_INT32 pattern);
- void SetNumDataBytes(FX_INT32 bytes);
- void SetNumTotalBytes(FX_INT32 value);
- void SetNumECBytes(FX_INT32 value);
- void SetNumRSBlocks(FX_INT32 block);
+ void SetVersion(int32_t version);
+ void SetMatrixWidth(int32_t width);
+ void SetMaskPattern(int32_t pattern);
+ void SetNumDataBytes(int32_t bytes);
+ void SetNumTotalBytes(int32_t value);
+ void SetNumECBytes(int32_t value);
+ void SetNumRSBlocks(int32_t block);
void SetMatrix(CBC_CommonByteMatrix* value);
- static FX_BOOL IsValidMaskPattern(FX_INT32 maskPattern);
+ static FX_BOOL IsValidMaskPattern(int32_t maskPattern);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp index b7a0a1c3a7..53a5e487a4 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp @@ -29,7 +29,7 @@ CBC_QRCoderBitVector::CBC_QRCoderBitVector() }
void CBC_QRCoderBitVector::Init()
{
- m_array = FX_Alloc(FX_BYTE, m_size);
+ m_array = FX_Alloc(uint8_t, m_size);
}
CBC_QRCoderBitVector::~CBC_QRCoderBitVector()
{
@@ -47,32 +47,32 @@ void CBC_QRCoderBitVector::Clear() }
m_sizeInBits = 0;
m_size = 32;
- m_array = FX_Alloc(FX_BYTE, m_size);
+ m_array = FX_Alloc(uint8_t, m_size);
}
-FX_INT32 CBC_QRCoderBitVector::At(FX_INT32 index, FX_INT32 &e)
+int32_t CBC_QRCoderBitVector::At(int32_t index, int32_t &e)
{
if(index < 0 || index >= m_sizeInBits) {
e = BCExceptionBadIndexException;
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
}
- FX_INT32 value = m_array[index >> 3] & 0xff;
+ int32_t value = m_array[index >> 3] & 0xff;
return (value >> (7 - (index & 0x7))) & 1;
}
-FX_INT32 CBC_QRCoderBitVector::sizeInBytes()
+int32_t CBC_QRCoderBitVector::sizeInBytes()
{
return (m_sizeInBits + 7) >> 3;
}
-FX_INT32 CBC_QRCoderBitVector::Size()
+int32_t CBC_QRCoderBitVector::Size()
{
return m_sizeInBits;
}
-void CBC_QRCoderBitVector::AppendBit(FX_INT32 bit, FX_INT32 &e)
+void CBC_QRCoderBitVector::AppendBit(int32_t bit, int32_t &e)
{
if(!(bit == 0 || bit == 1)) {
e = BCExceptionBadValueException;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 numBitsInLastByte = m_sizeInBits & 0x7;
+ int32_t numBitsInLastByte = m_sizeInBits & 0x7;
if(numBitsInLastByte == 0) {
AppendByte(0);
m_sizeInBits -= 8;
@@ -80,55 +80,55 @@ void CBC_QRCoderBitVector::AppendBit(FX_INT32 bit, FX_INT32 &e) m_array[m_sizeInBits >> 3] |= (bit << (7 - numBitsInLastByte));
++m_sizeInBits;
}
-void CBC_QRCoderBitVector::AppendBits(FX_INT32 value, FX_INT32 numBits, FX_INT32 &e)
+void CBC_QRCoderBitVector::AppendBits(int32_t value, int32_t numBits, int32_t &e)
{
if (numBits < 0 || numBits > 32) {
e = BCExceptionBadNumBitsException;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 numBitsLeft = numBits;
+ int32_t numBitsLeft = numBits;
while (numBitsLeft > 0) {
if ((m_sizeInBits & 0x7) == 0 && numBitsLeft >= 8) {
- FX_INT32 newByte = (value >> (numBitsLeft - 8)) & 0xff;
+ int32_t newByte = (value >> (numBitsLeft - 8)) & 0xff;
AppendByte(newByte);
numBitsLeft -= 8;
} else {
- FX_INT32 bit = (value >> (numBitsLeft - 1)) & 1;
+ int32_t bit = (value >> (numBitsLeft - 1)) & 1;
AppendBit(bit, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
--numBitsLeft;
}
}
}
-void CBC_QRCoderBitVector::AppendBitVector(CBC_QRCoderBitVector *bits, FX_INT32 &e)
+void CBC_QRCoderBitVector::AppendBitVector(CBC_QRCoderBitVector *bits, int32_t &e)
{
- FX_INT32 size = bits->Size();
- for(FX_INT32 i = 0; i < size; i++) {
- FX_INT32 num = bits->At(i, e);
+ int32_t size = bits->Size();
+ for(int32_t i = 0; i < size; i++) {
+ int32_t num = bits->At(i, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
AppendBit(num, e);
BC_EXCEPTION_CHECK_ReturnVoid(e)
}
}
-void CBC_QRCoderBitVector::XOR(CBC_QRCoderBitVector *other, FX_INT32 &e)
+void CBC_QRCoderBitVector::XOR(CBC_QRCoderBitVector *other, int32_t &e)
{
if(m_sizeInBits != other->Size()) {
e = BCExceptioncanNotOperatexorOperator;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 sizeInBytes = (m_sizeInBits + 7) >> 3;
- for(FX_INT32 i = 0; i < sizeInBytes; ++i) {
+ int32_t sizeInBytes = (m_sizeInBits + 7) >> 3;
+ for(int32_t i = 0; i < sizeInBytes; ++i) {
m_array[i] ^= (other->GetArray())[i];
}
}
-FX_BYTE* CBC_QRCoderBitVector::GetArray()
+uint8_t* CBC_QRCoderBitVector::GetArray()
{
return m_array;
}
-void CBC_QRCoderBitVector::AppendByte(FX_INT32 value)
+void CBC_QRCoderBitVector::AppendByte(int32_t value)
{
if((m_sizeInBits >> 3) == m_size) {
- FX_BYTE* newArray = FX_Alloc(FX_BYTE, m_size << 1);
+ uint8_t* newArray = FX_Alloc(uint8_t, m_size << 1);
FXSYS_memcpy32(newArray, m_array, m_size);
if(m_array != NULL) {
FX_Free(m_array);
@@ -136,6 +136,6 @@ void CBC_QRCoderBitVector::AppendByte(FX_INT32 value) m_array = newArray;
m_size = m_size << 1;
}
- m_array[m_sizeInBits >> 3] = (FX_BYTE) value;
+ m_array[m_sizeInBits >> 3] = (uint8_t) value;
m_sizeInBits += 8;
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h index ae73fe8c88..49549ba0d2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h @@ -9,22 +9,22 @@ class CBC_QRCoderBitVector
{
private:
- FX_INT32 m_sizeInBits;
- FX_BYTE *m_array;
- FX_INT32 m_size;
+ int32_t m_sizeInBits;
+ uint8_t *m_array;
+ int32_t m_size;
- void AppendByte(FX_INT32 value);
+ void AppendByte(int32_t value);
public:
CBC_QRCoderBitVector();
virtual ~CBC_QRCoderBitVector();
- FX_INT32 At(FX_INT32 index, FX_INT32 &e);
- FX_INT32 Size();
- FX_INT32 sizeInBytes();
- void AppendBit(FX_INT32 bit, FX_INT32 &e);
- void AppendBits(FX_INT32 value, FX_INT32 numBits, FX_INT32 &e);
- void AppendBitVector(CBC_QRCoderBitVector *bits, FX_INT32 &e);
- void XOR(CBC_QRCoderBitVector *other, FX_INT32 &e);
- FX_BYTE* GetArray();
+ int32_t At(int32_t index, int32_t &e);
+ int32_t Size();
+ int32_t sizeInBytes();
+ void AppendBit(int32_t bit, int32_t &e);
+ void AppendBits(int32_t value, int32_t numBits, int32_t &e);
+ void AppendBitVector(CBC_QRCoderBitVector *bits, int32_t &e);
+ void XOR(CBC_QRCoderBitVector *other, int32_t &e);
+ uint8_t* GetArray();
void Clear();
virtual void Init();
};
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp index 6f16db6ad8..e866873d24 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp @@ -47,12 +47,12 @@ CBC_QRCoderDecoder::~CBC_QRCoderDecoder() }
m_rsDecoder = NULL;
}
-CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, FX_INT32 width, FX_INT32 height, FX_INT32 &e)
+CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, int32_t width, int32_t height, int32_t &e)
{
CBC_CommonBitMatrix bits;
bits.Init(width);
- for(FX_INT32 i = 0; i < width; i++) {
- for(FX_INT32 j = 0; j < height; j++) {
+ for(int32_t i = 0; i < width; i++) {
+ for(int32_t j = 0; j < height; j++) {
if(image[i * width + j]) {
bits.Set(j, i);
}
@@ -62,7 +62,7 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, FX_INT32 wid BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return cdr;
}
-CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, FX_INT32 byteModeDecode, FX_INT32 &e)
+CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, int32_t byteModeDecode, int32_t &e)
{
CBC_QRBitMatrixParser parser;
parser.Init(bits, e);
@@ -77,19 +77,19 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, F CBC_AutoPtr<CFX_ByteArray > codewords(ba);
CFX_PtrArray *dataBlocks = CBC_QRDataBlock::GetDataBlocks(codewords.get(), version, ecLevel, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 totalBytes = 0;
- for (FX_INT32 i = 0; i < dataBlocks->GetSize(); i++) {
+ int32_t totalBytes = 0;
+ for (int32_t i = 0; i < dataBlocks->GetSize(); i++) {
totalBytes += ((CBC_QRDataBlock*) ((*dataBlocks)[i]))->GetNumDataCodewords();
}
CFX_ByteArray resultBytes;
- FX_INT32 resultOffset = 0;
- for (FX_INT32 j = 0; j < dataBlocks->GetSize(); j++) {
+ int32_t resultOffset = 0;
+ for (int32_t j = 0; j < dataBlocks->GetSize(); j++) {
CBC_QRDataBlock *dataBlock = (CBC_QRDataBlock *)((*dataBlocks)[j]);
CFX_ByteArray* codewordBytes = dataBlock->GetCodewords();
- FX_INT32 numDataCodewords = dataBlock->GetNumDataCodewords();
+ int32_t numDataCodewords = dataBlock->GetNumDataCodewords();
CorrectErrors(codewordBytes, numDataCodewords, e);
if (e != BCExceptionNO) {
- for(FX_INT32 k = 0; k < dataBlocks->GetSize(); k++) {
+ for(int32_t k = 0; k < dataBlocks->GetSize(); k++) {
delete (CBC_QRDataBlock*)(*dataBlocks)[k];
}
dataBlocks->RemoveAll();
@@ -97,11 +97,11 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, F dataBlocks = NULL;
return NULL;
}
- for(FX_INT32 i = 0; i < numDataCodewords; i++) {
+ for(int32_t i = 0; i < numDataCodewords; i++) {
resultBytes.Add((*codewordBytes)[i]);
}
}
- for(FX_INT32 k = 0; k < dataBlocks->GetSize(); k++) {
+ for(int32_t k = 0; k < dataBlocks->GetSize(); k++) {
delete (CBC_QRDataBlock*)(*dataBlocks)[k] ;
}
dataBlocks->RemoveAll();
@@ -111,18 +111,18 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, F BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return cdr;
}
-void CBC_QRCoderDecoder::CorrectErrors(CFX_ByteArray* codewordBytes, FX_INT32 numDataCodewords, FX_INT32 &e)
+void CBC_QRCoderDecoder::CorrectErrors(CFX_ByteArray* codewordBytes, int32_t numDataCodewords, int32_t &e)
{
- FX_INT32 numCodewords = codewordBytes->GetSize();
+ int32_t numCodewords = codewordBytes->GetSize();
CFX_Int32Array codewordsInts;
codewordsInts.SetSize(numCodewords);
- for(FX_INT32 i = 0; i < numCodewords; i++) {
- codewordsInts[i] = (FX_INT32)((*codewordBytes)[i] & 0xff);
+ for(int32_t i = 0; i < numCodewords; i++) {
+ codewordsInts[i] = (int32_t)((*codewordBytes)[i] & 0xff);
}
- FX_INT32 numECCodewords = codewordBytes->GetSize() - numDataCodewords;
+ int32_t numECCodewords = codewordBytes->GetSize() - numDataCodewords;
m_rsDecoder->Decode(&codewordsInts, numECCodewords, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- for(FX_INT32 k = 0; k < numDataCodewords; k++) {
- (*codewordBytes)[k] = (FX_BYTE) codewordsInts[k];
+ for(int32_t k = 0; k < numDataCodewords; k++) {
+ (*codewordBytes)[k] = (uint8_t) codewordsInts[k];
}
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h index 00238544c3..7747c7ba5b 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h @@ -20,9 +20,9 @@ public: CBC_QRCoderDecoder();
virtual ~CBC_QRCoderDecoder();
- CBC_CommonDecoderResult* Decode(FX_BOOL* image, FX_INT32 width, FX_INT32 height, FX_INT32 &e);
- CBC_CommonDecoderResult* Decode(CBC_CommonBitMatrix* bits, FX_INT32 byteModeDecode, FX_INT32 &e);
- void CorrectErrors(CFX_ByteArray* codewordBytes, FX_INT32 numDataCodewords, FX_INT32 &e);
+ CBC_CommonDecoderResult* Decode(FX_BOOL* image, int32_t width, int32_t height, int32_t &e);
+ CBC_CommonDecoderResult* Decode(CBC_CommonBitMatrix* bits, int32_t byteModeDecode, int32_t &e);
+ void CorrectErrors(CFX_ByteArray* codewordBytes, int32_t numDataCodewords, int32_t &e);
virtual void Init();
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp index a475cecb37..7dfef9356d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp @@ -22,7 +22,7 @@ #include "../barcode.h"
#include "BC_QRCoderECB.h"
-CBC_QRCoderECB::CBC_QRCoderECB(FX_INT32 count, FX_INT32 dataCodeWords)
+CBC_QRCoderECB::CBC_QRCoderECB(int32_t count, int32_t dataCodeWords)
{
m_dataCodeWords = dataCodeWords;
m_count = count;
@@ -30,11 +30,11 @@ CBC_QRCoderECB::CBC_QRCoderECB(FX_INT32 count, FX_INT32 dataCodeWords) CBC_QRCoderECB::~CBC_QRCoderECB()
{
}
-FX_INT32 CBC_QRCoderECB::GetCount()
+int32_t CBC_QRCoderECB::GetCount()
{
return m_count;
}
-FX_INT32 CBC_QRCoderECB::GetDataCodeWords()
+int32_t CBC_QRCoderECB::GetDataCodeWords()
{
return m_dataCodeWords;
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h index e8c2d36999..5a9c25bd53 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h @@ -9,12 +9,12 @@ class CBC_QRCoderECB
{
private:
- FX_INT32 m_count;
- FX_INT32 m_dataCodeWords;
+ int32_t m_count;
+ int32_t m_dataCodeWords;
public:
- CBC_QRCoderECB(FX_INT32 count, FX_INT32 dataCodeWords);
+ CBC_QRCoderECB(int32_t count, int32_t dataCodeWords);
virtual ~CBC_QRCoderECB();
- FX_INT32 GetCount();
- FX_INT32 GetDataCodeWords();
+ int32_t GetCount();
+ int32_t GetDataCodeWords();
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp index 22485fe733..3c40cfd34b 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp @@ -23,12 +23,12 @@ #include "../barcode.h"
#include "BC_QRCoderECB.h"
#include "BC_QRCoderECBlocks.h"
-CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks)
+CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks)
{
m_ecCodeWordsPerBlock = ecCodeWordsPerBlock;
m_ecBlocks.Add(ecBlocks);
}
-CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock,
+CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
CBC_QRCoderECB* ecBlocks1,
CBC_QRCoderECB* ecBlocks2)
{
@@ -38,24 +38,24 @@ CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, }
CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks()
{
- for (FX_INT32 i = 0 ; i < m_ecBlocks.GetSize(); i++) {
+ for (int32_t i = 0 ; i < m_ecBlocks.GetSize(); i++) {
delete ( (CBC_QRCoderECB*)(m_ecBlocks[i]) ) ;
}
m_ecBlocks.RemoveAll();
}
-FX_INT32 CBC_QRCoderECBlocks::GetECCodeWordsPerBlock()
+int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock()
{
return m_ecCodeWordsPerBlock;
}
-FX_INT32 CBC_QRCoderECBlocks::GetNumBlocks()
+int32_t CBC_QRCoderECBlocks::GetNumBlocks()
{
- FX_INT32 total = 0;
- for(FX_INT32 i = 0; i < m_ecBlocks.GetSize(); i++) {
+ int32_t total = 0;
+ for(int32_t i = 0; i < m_ecBlocks.GetSize(); i++) {
total += ( (CBC_QRCoderECB*)(m_ecBlocks[i]) )->GetCount();
}
return total;
}
-FX_INT32 CBC_QRCoderECBlocks::GetTotalECCodeWords()
+int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords()
{
return m_ecCodeWordsPerBlock * GetNumBlocks();
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h index 7f229742ab..8a962e1627 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h @@ -10,15 +10,15 @@ class CBC_QRCoderECB; class CBC_QRCoderECBlocks
{
private:
- FX_INT32 m_ecCodeWordsPerBlock;
+ int32_t m_ecCodeWordsPerBlock;
CFX_PtrArray m_ecBlocks;
public:
- CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks);
- CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks1, CBC_QRCoderECB* ecBlocks2);
+ CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks);
+ CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks1, CBC_QRCoderECB* ecBlocks2);
virtual ~CBC_QRCoderECBlocks();
- FX_INT32 GetECCodeWordsPerBlock();
- FX_INT32 GetNumBlocks();
- FX_INT32 GetTotalECCodeWords();
+ int32_t GetECCodeWordsPerBlock();
+ int32_t GetNumBlocks();
+ int32_t GetTotalECCodeWords();
CFX_PtrArray* GetECBlocks();
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index 3f6a644f0f..2ec490f109 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -36,7 +36,7 @@ #include "BC_QRCoderMaskUtil.h"
#include "BC_QRCoderMatrixUtil.h"
#include "BC_QRCoderBitVector.h"
-const FX_INT32 CBC_QRCoderEncoder::m_alphaNumbericTable[] = {
+const int32_t CBC_QRCoderEncoder::m_alphaNumbericTable[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
@@ -71,7 +71,7 @@ public: ~Make_Pair() {}
};
void CBC_QRCoderEncoder::Encode(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder *qrCode, FX_INT32 &e, FX_INT32 versionSpecify)
+ CBC_QRCoder *qrCode, int32_t &e, int32_t versionSpecify)
{
if(versionSpecify == 0) {
EncodeWithAutoVersion(content, ecLevel, qrCode, e);
@@ -88,9 +88,9 @@ void CBC_QRCoderEncoder::AppendECI(CBC_QRCoderBitVector* bits) {
}
void CBC_QRCoderEncoder::AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_QRCoderBitVector &headerAndDataBits,
- CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, FX_INT32 &e)
+ CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, int32_t &e)
{
- for(FX_INT32 i = 0; i < splitResult.GetSize(); i++) {
+ for(int32_t i = 0; i < splitResult.GetSize(); i++) {
tempMode = ((Make_Pair*)splitResult[i])->m_mode;
if(tempMode == CBC_QRCoderMode::sGBK) {
AppendModeInfo(tempMode, &headerAndDataBits, e);
@@ -130,9 +130,9 @@ void CBC_QRCoderEncoder::AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_ }
void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray &result)
{
- FX_INT32 index = 0, flag = 0;
- while((((FX_BYTE)content[index] >= 0xA1 && (FX_BYTE)content[index] <= 0xAA) ||
- ((FX_BYTE)content[index] >= 0xB0 && (FX_BYTE)content[index] <= 0xFA)) && (index < content.GetLength())) {
+ int32_t index = 0, flag = 0;
+ while((((uint8_t)content[index] >= 0xA1 && (uint8_t)content[index] <= 0xAA) ||
+ ((uint8_t)content[index] >= 0xB0 && (uint8_t)content[index] <= 0xFA)) && (index < content.GetLength())) {
index += 2;
}
if(index != flag) {
@@ -142,14 +142,14 @@ void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray if(index >= content.GetLength()) {
return;
}
- while(GetAlphaNumericCode((FX_BYTE)content[index]) == -1
- && !(((FX_BYTE)content[index] >= 0xA1 && (FX_BYTE)content[index] <= 0xAA) ||
- ((FX_BYTE)content[index] >= 0xB0 && (FX_BYTE)content[index] <= 0xFA))
+ while(GetAlphaNumericCode((uint8_t)content[index]) == -1
+ && !(((uint8_t)content[index] >= 0xA1 && (uint8_t)content[index] <= 0xAA) ||
+ ((uint8_t)content[index] >= 0xB0 && (uint8_t)content[index] <= 0xFA))
&& (index < content.GetLength())) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- if(IsDBCSLeadByte((FX_BYTE)content[index]))
+ if(IsDBCSLeadByte((uint8_t)content[index]))
#else
- if((FX_BYTE)content[index] > 127)
+ if((uint8_t)content[index] > 127)
#endif
{
index += 2;
@@ -164,7 +164,7 @@ void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray if(index >= content.GetLength()) {
return;
}
- while(FXSYS_Isdigit((FX_BYTE)content[index]) && (index < content.GetLength())) {
+ while(FXSYS_Isdigit((uint8_t)content[index]) && (index < content.GetLength())) {
index++;
}
if(index != flag) {
@@ -174,7 +174,7 @@ void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray if(index >= content.GetLength()) {
return;
}
- while(GetAlphaNumericCode((FX_BYTE)content[index]) != -1 && (index < content.GetLength())) {
+ while(GetAlphaNumericCode((uint8_t)content[index]) != -1 && (index < content.GetLength())) {
index++;
}
if(index != flag) {
@@ -186,7 +186,7 @@ void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray }
SplitString(content.Mid(index, content.GetLength() - index), result);
}
-FX_INT32 CBC_QRCoderEncoder::GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, FX_INT32 versionNum, FX_INT32 &e)
+int32_t CBC_QRCoderEncoder::GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, int32_t versionNum, int32_t &e)
{
if(versionNum == 0) {
return 0;
@@ -230,17 +230,17 @@ FX_INT32 CBC_QRCoderEncoder::GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QR }
return -1;
}
-void CBC_QRCoderEncoder::MergeString(CFX_PtrArray &result, FX_INT32 versionNum, FX_INT32 &e)
+void CBC_QRCoderEncoder::MergeString(CFX_PtrArray &result, int32_t versionNum, int32_t &e)
{
Make_Pair *first = NULL;
Make_Pair *second = NULL;
size_t mergeNum = 0;
- FX_INT32 i;
+ int32_t i;
for(i = 0; ((i < result.GetSize()) && (i + 1 < result.GetSize())); i++) {
first = (Make_Pair*)result[i];
second = (Make_Pair*)result[i + 1];
if(first->m_mode == CBC_QRCoderMode::sALPHANUMERIC) {
- FX_INT32 tmp = GetSpanByVersion(CBC_QRCoderMode::sALPHANUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e);
+ int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sALPHANUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if((second->m_mode == CBC_QRCoderMode::sBYTE)
&& (first->m_string.GetLength() < tmp)) {
@@ -260,7 +260,7 @@ void CBC_QRCoderEncoder::MergeString(CFX_PtrArray &result, FX_INT32 versionNum, mergeNum++;
}
} else if(first->m_mode == CBC_QRCoderMode::sNUMERIC) {
- FX_INT32 tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e);
+ int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if((second->m_mode == CBC_QRCoderMode::sBYTE)
&& (first->m_string.GetLength() < tmp)) {
@@ -290,18 +290,18 @@ void CBC_QRCoderEncoder::MergeString(CFX_PtrArray &result, FX_INT32 versionNum, MergeString(result, versionNum, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-void CBC_QRCoderEncoder::InitQRCode(FX_INT32 numInputBytes, FX_INT32 versionNumber,
- CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e)
+void CBC_QRCoderEncoder::InitQRCode(int32_t numInputBytes, int32_t versionNumber,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e)
{
qrCode->SetECLevel(ecLevel);
qrCode->SetMode(mode);
CBC_QRCoderVersion* version = CBC_QRCoderVersion::GetVersionForNumber(versionNumber, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 numBytes = version->GetTotalCodeWords();
+ int32_t numBytes = version->GetTotalCodeWords();
CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel);
- FX_INT32 numEcBytes = ecBlocks->GetTotalECCodeWords();
- FX_INT32 numRSBlocks = ecBlocks->GetNumBlocks();
- FX_INT32 numDataBytes = numBytes - numEcBytes;
+ int32_t numEcBytes = ecBlocks->GetTotalECCodeWords();
+ int32_t numRSBlocks = ecBlocks->GetNumBlocks();
+ int32_t numDataBytes = numBytes - numEcBytes;
if(numDataBytes >= numInputBytes + 3) {
qrCode->SetVersion(versionNumber);
qrCode->SetNumTotalBytes(numBytes);
@@ -315,7 +315,7 @@ void CBC_QRCoderEncoder::InitQRCode(FX_INT32 numInputBytes, FX_INT32 versionNumb BC_EXCEPTION_CHECK_ReturnVoid(e);
}
void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder *qrCode, FX_INT32 versionSpecify, FX_INT32 &e)
+ CBC_QRCoder *qrCode, int32_t versionSpecify, int32_t &e)
{
CFX_ByteString encoding = "utf8";
CBC_QRCoderMode *mode = CBC_QRCoderMode::sBYTE;
@@ -326,22 +326,22 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, MergeString(splitResult, versionSpecify, e);
BC_EXCEPTION_CHECK_ReturnVoid(e)
CBC_QRCoderMode *tempMode = NULL;
- for(FX_INT32 i = 0; i < splitResult.GetSize(); i++) {
+ for(int32_t i = 0; i < splitResult.GetSize(); i++) {
AppendBytes(((Make_Pair*)splitResult[i])->m_string, ((Make_Pair*)splitResult[i])->m_mode, &dataBits, encoding, e);
if(e != BCExceptionNO) {
- for(FX_INT32 y = 0; y < splitResult.GetSize(); y++) {
+ for(int32_t y = 0; y < splitResult.GetSize(); y++) {
delete (Make_Pair*)splitResult[y];
}
splitResult.RemoveAll();
return;
}
}
- FX_INT32 numInputBytes = dataBits.sizeInBytes();
+ int32_t numInputBytes = dataBits.sizeInBytes();
CBC_QRCoderBitVector headerAndDataBits;
headerAndDataBits.Init();
InitQRCode(numInputBytes, versionSpecify, ecLevel, mode, qrCode, e);
if(e != BCExceptionNO) {
- for(FX_INT32 k = 0; k < splitResult.GetSize(); k++) {
+ for(int32_t k = 0; k < splitResult.GetSize(); k++) {
delete (Make_Pair*)splitResult[k];
}
splitResult.RemoveAll();
@@ -349,7 +349,7 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, }
AppendDataModeLenghInfo(splitResult, headerAndDataBits, tempMode, qrCode, encoding, e);
if(e != BCExceptionNO) {
- for(FX_INT32 k = 0; k < splitResult.GetSize(); k++) {
+ for(int32_t k = 0; k < splitResult.GetSize(); k++) {
delete (Make_Pair*)splitResult[k];
}
splitResult.RemoveAll();
@@ -358,13 +358,13 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, numInputBytes = headerAndDataBits.sizeInBytes();
TerminateBits(qrCode->GetNumDataBytes(), &headerAndDataBits, e);
if(e != BCExceptionNO) {
- for(FX_INT32 k = 0; k < splitResult.GetSize(); k++) {
+ for(int32_t k = 0; k < splitResult.GetSize(); k++) {
delete (Make_Pair*)splitResult[k];
}
splitResult.RemoveAll();
return ;
}
- for(FX_INT32 j = 0; j < splitResult.GetSize(); j++) {
+ for(int32_t j = 0; j < splitResult.GetSize(); j++) {
delete (Make_Pair*)splitResult[j];
}
splitResult.RemoveAll();
@@ -376,7 +376,7 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, CBC_CommonByteMatrix* pDecoder = FX_NEW CBC_CommonByteMatrix(qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth());
pDecoder->Init();
CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder);
- FX_INT32 maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
+ int32_t maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
qrCode->SetMaskPattern(maskPattern);
CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), qrCode->GetMaskPattern(), matrix.get(), e);
@@ -387,7 +387,7 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e)
+void CBC_QRCoderEncoder::EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e)
{
CFX_ByteString encoding = "utf8";
CBC_QRCoderMode *mode = CBC_QRCoderMode::sBYTE;
@@ -398,23 +398,23 @@ void CBC_QRCoderEncoder::EncodeWithAutoVersion(const CFX_ByteString &content, CB MergeString(splitResult, 8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
CBC_QRCoderMode *tempMode = NULL;
- for(FX_INT32 i = 0; i < splitResult.GetSize(); i++) {
+ for(int32_t i = 0; i < splitResult.GetSize(); i++) {
AppendBytes(((Make_Pair*)splitResult[i])->m_string, ((Make_Pair*)splitResult[i])->m_mode, &dataBits, encoding, e);
if(e != BCExceptionNO) {
- for(FX_INT32 l = 0; l < splitResult.GetSize(); l++) {
+ for(int32_t l = 0; l < splitResult.GetSize(); l++) {
delete (Make_Pair*)splitResult[l];
}
splitResult.RemoveAll();
return;
}
}
- FX_INT32 numInputBytes = dataBits.sizeInBytes();
+ int32_t numInputBytes = dataBits.sizeInBytes();
InitQRCode(numInputBytes, ecLevel, mode, qrCode, e);
BC_EXCEPTION_CHECK_ReturnVoid(e)
CBC_QRCoderBitVector headerAndDataBits;
headerAndDataBits.Init();
tempMode = NULL;
- FX_INT32 versionNum = qrCode->GetVersion();
+ int32_t versionNum = qrCode->GetVersion();
sign:
AppendDataModeLenghInfo(splitResult, headerAndDataBits, tempMode, qrCode, encoding, e);
if (e != BCExceptionNO) {
@@ -427,7 +427,7 @@ sign: }
catchException:
if (e != BCExceptionNO) {
- FX_INT32 e1 = BCExceptionNO;
+ int32_t e1 = BCExceptionNO;
InitQRCode(numInputBytes, ecLevel, mode, qrCode, e1);
if (e1 != BCExceptionNO) {
e = e1;
@@ -439,14 +439,14 @@ catchException: e = BCExceptionNO;
goto sign;
} else {
- for (FX_INT32 j = 0; j < splitResult.GetSize(); j++) {
+ for (int32_t j = 0; j < splitResult.GetSize(); j++) {
delete (Make_Pair*)splitResult[j];
}
splitResult.RemoveAll();
return;
}
}
- for (FX_INT32 k = 0; k < splitResult.GetSize(); k++) {
+ for (int32_t k = 0; k < splitResult.GetSize(); k++) {
delete (Make_Pair*)splitResult[k];
}
splitResult.RemoveAll();
@@ -458,7 +458,7 @@ catchException: CBC_CommonByteMatrix* pDecoder = FX_NEW CBC_CommonByteMatrix(qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth());
pDecoder->Init();
CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder);
- FX_INT32 maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
+ int32_t maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
qrCode->SetMaskPattern(maskPattern);
CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), qrCode->GetMaskPattern(), matrix.get(), e);
@@ -469,7 +469,7 @@ catchException: BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e)
+void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e)
{
CFX_ByteString encoding = "utf8";
CFX_ByteString utf8Data;
@@ -479,14 +479,14 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorC dataBits.Init();
AppendBytes(utf8Data, mode, &dataBits, encoding, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 numInputBytes = dataBits.sizeInBytes();
+ int32_t numInputBytes = dataBits.sizeInBytes();
InitQRCode(numInputBytes, ecLevel, mode, qrCode, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
CBC_QRCoderBitVector headerAndDataBits;
headerAndDataBits.Init();
AppendModeInfo(mode, &headerAndDataBits, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 numLetters = mode == CBC_QRCoderMode::sBYTE ? dataBits.sizeInBytes() : content.GetLength();
+ int32_t numLetters = mode == CBC_QRCoderMode::sBYTE ? dataBits.sizeInBytes() : content.GetLength();
AppendLengthInfo(numLetters, qrCode->GetVersion(), mode, &headerAndDataBits, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
headerAndDataBits.AppendBitVector(&dataBits, e);
@@ -501,7 +501,7 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorC CBC_CommonByteMatrix* pDecoder = FX_NEW CBC_CommonByteMatrix(qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth());
pDecoder->Init();
CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder);
- FX_INT32 maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
+ int32_t maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
qrCode->SetMaskPattern(maskPattern);
CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), qrCode->GetMaskPattern(), matrix.get(), e);
@@ -512,21 +512,21 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorC BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+void CBC_QRCoderEncoder::TerminateBits(int32_t numDataBytes, CBC_QRCoderBitVector* bits, int32_t &e)
{
- FX_INT32 capacity = numDataBytes << 3;
+ int32_t capacity = numDataBytes << 3;
if(bits->Size() > capacity) {
e = BCExceptionDataTooMany;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- for (FX_INT32 i = 0; i < 4 && bits->Size() < capacity; ++i) {
+ for (int32_t i = 0; i < 4 && bits->Size() < capacity; ++i) {
bits->AppendBit(0, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 numBitsInLastByte = bits->Size() % 8;
+ int32_t numBitsInLastByte = bits->Size() % 8;
if (numBitsInLastByte > 0) {
- FX_INT32 numPaddingBits = 8 - numBitsInLastByte;
- for (FX_INT32 j = 0; j < numPaddingBits; ++j) {
+ int32_t numPaddingBits = 8 - numBitsInLastByte;
+ for (int32_t j = 0; j < numPaddingBits; ++j) {
bits->AppendBit(0, e);
BC_EXCEPTION_CHECK_ReturnVoid(e)
}
@@ -535,8 +535,8 @@ void CBC_QRCoderEncoder::TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVect e = BCExceptionDigitLengthMustBe8;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 numPaddingBytes = numDataBytes - bits->sizeInBytes();
- for (FX_INT32 k = 0; k < numPaddingBytes; ++k) {
+ int32_t numPaddingBytes = numDataBytes - bits->sizeInBytes();
+ for (int32_t k = 0; k < numPaddingBytes; ++k) {
if (k % 2 == 0) {
bits->AppendBits(0xec, 8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -550,14 +550,14 @@ void CBC_QRCoderEncoder::TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVect BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-FX_INT32 CBC_QRCoderEncoder::ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+int32_t CBC_QRCoderEncoder::ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e)
{
- FX_INT32 minPenalty = 65535;
- FX_INT32 bestMaskPattern = -1;
- for(FX_INT32 maskPattern = 0; maskPattern < CBC_QRCoder::NUM_MASK_PATTERNS; maskPattern++) {
+ int32_t minPenalty = 65535;
+ int32_t bestMaskPattern = -1;
+ for(int32_t maskPattern = 0; maskPattern < CBC_QRCoder::NUM_MASK_PATTERNS; maskPattern++) {
CBC_QRCoderMatrixUtil::BuildMatrix(bits, ecLevel, version, maskPattern, matrix, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- FX_INT32 penalty = CalculateMaskPenalty(matrix);
+ int32_t penalty = CalculateMaskPenalty(matrix);
if(penalty < minPenalty) {
minPenalty = penalty;
bestMaskPattern = maskPattern;
@@ -565,9 +565,9 @@ FX_INT32 CBC_QRCoderEncoder::ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_Q }
return bestMaskPattern;
}
-FX_INT32 CBC_QRCoderEncoder::CalculateMaskPenalty(CBC_CommonByteMatrix* matrix)
+int32_t CBC_QRCoderEncoder::CalculateMaskPenalty(CBC_CommonByteMatrix* matrix)
{
- FX_INT32 penalty = 0;
+ int32_t penalty = 0;
penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(matrix);
penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(matrix);
penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(matrix);
@@ -581,10 +581,10 @@ CBC_QRCoderMode *CBC_QRCoderEncoder::ChooseMode(const CFX_ByteString &content, C }
FX_BOOL hasNumeric = FALSE;
FX_BOOL hasAlphaNumeric = FALSE;
- for(FX_INT32 i = 0; i < content.GetLength(); i++) {
- if(isdigit((FX_BYTE)content[i])) {
+ for(int32_t i = 0; i < content.GetLength(); i++) {
+ if(isdigit((uint8_t)content[i])) {
hasNumeric = TRUE;
- } else if(GetAlphaNumericCode((FX_BYTE)content[i]) != -1) {
+ } else if(GetAlphaNumericCode((uint8_t)content[i]) != -1) {
hasAlphaNumeric = TRUE;
} else {
return CBC_QRCoderMode::sBYTE;
@@ -597,14 +597,14 @@ CBC_QRCoderMode *CBC_QRCoderEncoder::ChooseMode(const CFX_ByteString &content, C }
return CBC_QRCoderMode::sBYTE;
}
-FX_INT32 CBC_QRCoderEncoder::GetAlphaNumericCode(FX_INT32 code)
+int32_t CBC_QRCoderEncoder::GetAlphaNumericCode(int32_t code)
{
if(code < 96 && code >= 0) {
return m_alphaNumbericTable[code];
}
return -1;
}
-void CBC_QRCoderEncoder::AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e)
+void CBC_QRCoderEncoder::AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e)
{
if(mode == CBC_QRCoderMode::sNUMERIC) {
AppendNumericBytes(content, bits, e);
@@ -626,20 +626,20 @@ void CBC_QRCoderEncoder::AppendBytes(const CFX_ByteString &content, CBC_QRCoderM BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+void CBC_QRCoderEncoder::AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e)
{
- FX_INT32 length = content.GetLength();
- FX_INT32 i = 0;
+ int32_t length = content.GetLength();
+ int32_t i = 0;
while(i < length) {
- FX_INT32 num1 = content[i] - '0';
+ int32_t num1 = content[i] - '0';
if(i + 2 < length) {
- FX_INT32 num2 = content[i + 1] - '0';
- FX_INT32 num3 = content[i + 2] - '0';
+ int32_t num2 = content[i + 1] - '0';
+ int32_t num3 = content[i + 2] - '0';
bits->AppendBits(num1 * 100 + num2 * 10 + num3, 10, e);
BC_EXCEPTION_CHECK_ReturnVoid(e)
i += 3;
} else if(i + 1 < length) {
- FX_INT32 num2 = content[i + 1] - '0';
+ int32_t num2 = content[i + 1] - '0';
bits->AppendBits(num1 * 10 + num2, 7, e);
BC_EXCEPTION_CHECK_ReturnVoid(e)
i += 2;
@@ -650,18 +650,18 @@ void CBC_QRCoderEncoder::AppendNumericBytes(const CFX_ByteString &content, CBC_Q }
}
}
-void CBC_QRCoderEncoder::AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+void CBC_QRCoderEncoder::AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e)
{
- FX_INT32 length = content.GetLength();
- FX_INT32 i = 0;
+ int32_t length = content.GetLength();
+ int32_t i = 0;
while(i < length) {
- FX_INT32 code1 = GetAlphaNumericCode(content[i]);
+ int32_t code1 = GetAlphaNumericCode(content[i]);
if(code1 == -1) {
e = BCExceptionInvalidateCharacter;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
if(i + 1 < length) {
- FX_INT32 code2 = GetAlphaNumericCode(content[i + 1]);
+ int32_t code2 = GetAlphaNumericCode(content[i + 1]);
if(code2 == -1) {
e = BCExceptionInvalidateCharacter;
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -676,12 +676,12 @@ void CBC_QRCoderEncoder::AppendAlphaNumericBytes(const CFX_ByteString &content, }
}
}
-void CBC_QRCoderEncoder::AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+void CBC_QRCoderEncoder::AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e)
{
- FX_INT32 length = content.GetLength();
+ int32_t length = content.GetLength();
FX_DWORD value = 0;
- for(FX_INT32 i = 0; i < length; i += 2) {
- value = (FX_DWORD)((FX_BYTE)content[i] << 8 | (FX_BYTE)content[i + 1]);
+ for(int32_t i = 0; i < length; i += 2) {
+ value = (FX_DWORD)((uint8_t)content[i] << 8 | (uint8_t)content[i + 1]);
if(value <= 0xAAFE && value >= 0xA1A1) {
value -= 0xA1A1;
} else if(value <= 0xFAFE && value >= 0xB0A1) {
@@ -695,26 +695,26 @@ void CBC_QRCoderEncoder::AppendGBKBytes(const CFX_ByteString &content, CBC_QRCod BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e)
+void CBC_QRCoderEncoder::Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e)
{
- for(FX_INT32 i = 0; i < content.GetLength(); i++) {
+ for(int32_t i = 0; i < content.GetLength(); i++) {
bits->AppendBits(content[i], 8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, FX_INT32 &e)
+void CBC_QRCoderEncoder::Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, int32_t &e)
{
- for(FX_INT32 i = 0; i < bytes.GetSize(); i++) {
+ for(int32_t i = 0; i < bytes.GetSize(); i++) {
bits->AppendBits(bytes[i], 8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e)
{
CFX_ByteArray bytes;
FX_DWORD value = 0, h = 0;
- for(FX_INT32 i = 0; i < bytes.GetSize(); i += 2) {
- value = (FX_DWORD)((FX_BYTE)(content[i] << 8) | (FX_BYTE)content[i + 1]);
+ for(int32_t i = 0; i < bytes.GetSize(); i += 2) {
+ value = (FX_DWORD)((uint8_t)(content[i] << 8) | (uint8_t)content[i + 1]);
if(value <= 0x9ffc && value >= 0x8140) {
value -= 0x8140;
} else if(value <= 0xebbf && value >= 0xe040) {
@@ -728,19 +728,19 @@ void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString &content, CBC_QRC BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::InitQRCode(FX_INT32 numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e)
+void CBC_QRCoderEncoder::InitQRCode(int32_t numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e)
{
qrCode->SetECLevel(ecLevel);
qrCode->SetMode(mode);
- for(FX_INT32 versionNum = 1; versionNum <= 40; versionNum++) {
+ for(int32_t versionNum = 1; versionNum <= 40; versionNum++) {
CBC_QRCoderVersion* version = CBC_QRCoderVersion::GetVersionForNumber(versionNum, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 numBytes = version->GetTotalCodeWords();
+ int32_t numBytes = version->GetTotalCodeWords();
CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel);
- FX_INT32 numEcBytes = ecBlocks->GetTotalECCodeWords();
- FX_INT32 numRSBlocks = ecBlocks->GetNumBlocks();
- FX_INT32 numDataBytes = numBytes - numEcBytes;
+ int32_t numEcBytes = ecBlocks->GetTotalECCodeWords();
+ int32_t numRSBlocks = ecBlocks->GetNumBlocks();
+ int32_t numDataBytes = numBytes - numEcBytes;
if(numDataBytes >= numInputBytes + 3) {
qrCode->SetVersion(versionNum);
qrCode->SetNumTotalBytes(numBytes);
@@ -754,7 +754,7 @@ void CBC_QRCoderEncoder::InitQRCode(FX_INT32 numInputBytes, CBC_QRCoderErrorCorr e = BCExceptionCannotFindBlockInfo;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-void CBC_QRCoderEncoder::AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+void CBC_QRCoderEncoder::AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e)
{
bits->AppendBits(mode->GetBits(), 4, e);
if(mode == CBC_QRCoderMode::sGBK) {
@@ -762,11 +762,11 @@ void CBC_QRCoderEncoder::AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVec BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::AppendLengthInfo(FX_INT32 numLetters, FX_INT32 version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+void CBC_QRCoderEncoder::AppendLengthInfo(int32_t numLetters, int32_t version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e)
{
CBC_QRCoderVersion* qcv = CBC_QRCoderVersion::GetVersionForNumber(version, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 numBits = mode->GetCharacterCountBits(qcv, e);
+ int32_t numBits = mode->GetCharacterCountBits(qcv, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if(numBits > ((1 << numBits) - 1)) {
return;
@@ -778,20 +778,20 @@ void CBC_QRCoderEncoder::AppendLengthInfo(FX_INT32 numLetters, FX_INT32 version, bits->AppendBits(numLetters, numBits, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_INT32 numTotalBytes, FX_INT32 numDataBytes, FX_INT32 numRSBlocks, CBC_QRCoderBitVector* result, FX_INT32 &e)
+void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, int32_t numTotalBytes, int32_t numDataBytes, int32_t numRSBlocks, CBC_QRCoderBitVector* result, int32_t &e)
{
if(bits->sizeInBytes() != numDataBytes) {
e = BCExceptionBitsBytesNotMatch;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 dataBytesOffset = 0;
- FX_INT32 maxNumDataBytes = 0;
- FX_INT32 maxNumEcBytes = 0;
+ int32_t dataBytesOffset = 0;
+ int32_t maxNumDataBytes = 0;
+ int32_t maxNumEcBytes = 0;
CFX_PtrArray blocks;
- FX_INT32 i;
+ int32_t i;
for(i = 0; i < numRSBlocks; i++) {
- FX_INT32 numDataBytesInBlock;
- FX_INT32 numEcBytesInBlosk;
+ int32_t numDataBytesInBlock;
+ int32_t numEcBytesInBlosk;
GetNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes, numRSBlocks, i,
numDataBytesInBlock, numEcBytesInBlosk);
CBC_CommonByteArray* dataBytes = FX_NEW CBC_CommonByteArray;
@@ -807,8 +807,8 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_IN e = BCExceptionBytesNotMatchOffset;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- for(FX_INT32 x = 0; x < maxNumDataBytes; x++) {
- for(FX_INT32 j = 0; j < blocks.GetSize(); j++) {
+ for(int32_t x = 0; x < maxNumDataBytes; x++) {
+ for(int32_t j = 0; j < blocks.GetSize(); j++) {
CBC_CommonByteArray* dataBytes = ((CBC_QRCoderBlockPair*)blocks[j])->GetDataBytes();
if(x < dataBytes->Size()) {
result->AppendBits(dataBytes->At(x), 8, e);
@@ -816,8 +816,8 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_IN }
}
}
- for(FX_INT32 y = 0; y < maxNumEcBytes; y++) {
- for(FX_INT32 l = 0; l < blocks.GetSize(); l++) {
+ for(int32_t y = 0; y < maxNumEcBytes; y++) {
+ for(int32_t l = 0; l < blocks.GetSize(); l++) {
CBC_CommonByteArray* ecBytes = ((CBC_QRCoderBlockPair*)blocks[l])->GetErrorCorrectionBytes();
if(y < ecBytes->Size()) {
result->AppendBits(ecBytes->At(y), 8, e);
@@ -825,7 +825,7 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_IN }
}
}
- for(FX_INT32 k = 0; k < blocks.GetSize(); k++) {
+ for(int32_t k = 0; k < blocks.GetSize(); k++) {
delete (CBC_QRCoderBlockPair*)blocks[k];
}
if(numTotalBytes != result->sizeInBytes()) {
@@ -833,21 +833,21 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_IN BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderEncoder::GetNumDataBytesAndNumECBytesForBlockID(FX_INT32 numTotalBytes, FX_INT32 numDataBytes,
- FX_INT32 numRSBlocks, FX_INT32 blockID,
- FX_INT32 &numDataBytesInBlock, FX_INT32& numECBytesInBlock)
+void CBC_QRCoderEncoder::GetNumDataBytesAndNumECBytesForBlockID(int32_t numTotalBytes, int32_t numDataBytes,
+ int32_t numRSBlocks, int32_t blockID,
+ int32_t &numDataBytesInBlock, int32_t& numECBytesInBlock)
{
if(blockID >= numRSBlocks) {
return;
}
- FX_INT32 numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;
- FX_INT32 numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;
- FX_INT32 numTotalBytesInGroup1 = numTotalBytes / numRSBlocks;
- FX_INT32 numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;
- FX_INT32 numDataBytesInGroup1 = numDataBytes / numRSBlocks;
- FX_INT32 numDataBytesInGroup2 = numDataBytesInGroup1 + 1;
- FX_INT32 numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;
- FX_INT32 numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;
+ int32_t numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;
+ int32_t numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;
+ int32_t numTotalBytesInGroup1 = numTotalBytes / numRSBlocks;
+ int32_t numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;
+ int32_t numDataBytesInGroup1 = numDataBytes / numRSBlocks;
+ int32_t numDataBytesInGroup2 = numDataBytesInGroup1 + 1;
+ int32_t numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;
+ int32_t numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;
if (blockID < numRsBlocksInGroup1) {
numDataBytesInBlock = numDataBytesInGroup1;
numECBytesInBlock = numEcBytesInGroup1;
@@ -856,12 +856,12 @@ void CBC_QRCoderEncoder::GetNumDataBytesAndNumECBytesForBlockID(FX_INT32 numTota numECBytesInBlock = numEcBytesInGroup2;
}
}
-CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes(CBC_CommonByteArray* dataBytes, FX_INT32 numEcBytesInBlock, FX_INT32 &e)
+CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes(CBC_CommonByteArray* dataBytes, int32_t numEcBytesInBlock, int32_t &e)
{
- FX_INT32 numDataBytes = dataBytes->Size();
+ int32_t numDataBytes = dataBytes->Size();
CFX_Int32Array toEncode;
toEncode.SetSize(numDataBytes + numEcBytesInBlock);
- for(FX_INT32 i = 0; i < numDataBytes; i++) {
+ for(int32_t i = 0; i < numDataBytes; i++) {
toEncode[i] = (dataBytes->At(i));
}
CBC_ReedSolomonEncoder encode(CBC_ReedSolomonGF256::QRCodeFild);
@@ -869,7 +869,7 @@ CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes(CBC_CommonByteArray* da encode.Encode(&toEncode, numEcBytesInBlock, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_CommonByteArray* ecBytes = FX_NEW CBC_CommonByteArray(numEcBytesInBlock);
- for(FX_INT32 j = 0; j < numEcBytesInBlock; j++) {
+ for(int32_t j = 0; j < numEcBytesInBlock; j++) {
ecBytes->Set(j, toEncode[numDataBytes + j]);
}
return ecBytes;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h index f08d608fb8..303dbcb767 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h @@ -17,44 +17,44 @@ class CBC_QRCoderEncoder; class CBC_QRCoderEncoder
{
private:
- const static FX_INT32 m_alphaNumbericTable[96];
+ const static int32_t m_alphaNumbericTable[96];
public:
CBC_QRCoderEncoder();
virtual ~CBC_QRCoderEncoder();
- static void Encode(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e, FX_INT32 versionSpecify = 0);
- static void Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e);
+ static void Encode(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e, int32_t versionSpecify = 0);
+ static void Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e);
static void EncodeWithSpecifyVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel,
- CBC_QRCoder *qrCode, FX_INT32 versionSpecify, FX_INT32 &e);
- static void EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e);
+ CBC_QRCoder *qrCode, int32_t versionSpecify, int32_t &e);
+ static void EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e);
static CBC_QRCoderMode* ChooseMode(const CFX_ByteString & content, CFX_ByteString encoding);
- static FX_INT32 GetAlphaNumericCode(FX_INT32 code);
+ static int32_t GetAlphaNumericCode(int32_t code);
static void AppendECI(CBC_QRCoderBitVector* bits);
- static void AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e);
- static void AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e);
- static void AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e);
- static void Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e);
- static void Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, FX_INT32 &e);
- static void AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e);
- static void AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e);
- static void InitQRCode(FX_INT32 numInputBytes, FX_INT32 versionNumber,
- CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e);
- static void InitQRCode(FX_INT32 numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e);
- static void AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e);
- static void AppendLengthInfo(FX_INT32 numLetters, FX_INT32 version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e);
+ static void AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e);
+ static void AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e);
+ static void AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e);
+ static void Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e);
+ static void Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, int32_t &e);
+ static void AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e);
+ static void AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e);
+ static void InitQRCode(int32_t numInputBytes, int32_t versionNumber,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e);
+ static void InitQRCode(int32_t numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e);
+ static void AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e);
+ static void AppendLengthInfo(int32_t numLetters, int32_t version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e);
- static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_INT32 numTotalBytes, FX_INT32 numDataBytes, FX_INT32 numRSBlocks, CBC_QRCoderBitVector* result, FX_INT32 &e);
- static void GetNumDataBytesAndNumECBytesForBlockID(FX_INT32 numTotalBytes, FX_INT32 numDataBytes,
- FX_INT32 numRSBlocks, FX_INT32 blockID,
- FX_INT32 &numDataBytesInBlock, FX_INT32& numECBytesInBlocks);
- static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes, FX_INT32 numEcBytesInBlock, FX_INT32 &e);
- static FX_INT32 ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel,
- FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static FX_INT32 CalculateMaskPenalty(CBC_CommonByteMatrix* matrix);
- static void TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVector* bits, FX_INT32 &e);
- static FX_INT32 GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, FX_INT32 versionNum, FX_INT32 &e);
- static void MergeString(CFX_PtrArray &result, FX_INT32 versionNum, FX_INT32 &e);
+ static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits, int32_t numTotalBytes, int32_t numDataBytes, int32_t numRSBlocks, CBC_QRCoderBitVector* result, int32_t &e);
+ static void GetNumDataBytesAndNumECBytesForBlockID(int32_t numTotalBytes, int32_t numDataBytes,
+ int32_t numRSBlocks, int32_t blockID,
+ int32_t &numDataBytesInBlock, int32_t& numECBytesInBlocks);
+ static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes, int32_t numEcBytesInBlock, int32_t &e);
+ static int32_t ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix);
+ static void TerminateBits(int32_t numDataBytes, CBC_QRCoderBitVector* bits, int32_t &e);
+ static int32_t GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, int32_t versionNum, int32_t &e);
+ static void MergeString(CFX_PtrArray &result, int32_t versionNum, int32_t &e);
static void SplitString(const CFX_ByteString &content, CFX_PtrArray &result);
- static void AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_QRCoderBitVector &headerAndDataBits, CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, FX_INT32 &e);
+ static void AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_QRCoderBitVector &headerAndDataBits, CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp index f8aae491da..cccaf86da0 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp @@ -26,7 +26,7 @@ CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::L = NULL; CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::M = NULL;
CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::Q = NULL;
CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::H = NULL;
-CBC_QRCoderErrorCorrectionLevel::CBC_QRCoderErrorCorrectionLevel(FX_INT32 ordinal, FX_INT32 bits, FX_CHAR* name)
+CBC_QRCoderErrorCorrectionLevel::CBC_QRCoderErrorCorrectionLevel(int32_t ordinal, int32_t bits, FX_CHAR* name)
{
m_name += name;
m_ordinal = ordinal;
@@ -49,11 +49,11 @@ void CBC_QRCoderErrorCorrectionLevel::Finalize() delete Q;
delete H;
}
-FX_INT32 CBC_QRCoderErrorCorrectionLevel::Ordinal()
+int32_t CBC_QRCoderErrorCorrectionLevel::Ordinal()
{
return m_ordinal;
}
-FX_INT32 CBC_QRCoderErrorCorrectionLevel::GetBits()
+int32_t CBC_QRCoderErrorCorrectionLevel::GetBits()
{
return m_bits;
}
@@ -61,7 +61,7 @@ CFX_ByteString CBC_QRCoderErrorCorrectionLevel::GetName() {
return m_name;
}
-CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::ForBits(FX_INT32 bits)
+CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::ForBits(int32_t bits)
{
switch(bits) {
case 0x00:
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h index 907c20d1cc..e38abbcae9 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h @@ -9,10 +9,10 @@ class CBC_QRCoderErrorCorrectionLevel
{
private:
- FX_INT32 m_ordinal;
- FX_INT32 m_bits;
+ int32_t m_ordinal;
+ int32_t m_bits;
CFX_ByteString m_name;
- CBC_QRCoderErrorCorrectionLevel(FX_INT32 ordinal, FX_INT32 bits, FX_CHAR* name);
+ CBC_QRCoderErrorCorrectionLevel(int32_t ordinal, int32_t bits, FX_CHAR* name);
CBC_QRCoderErrorCorrectionLevel();
public:
static CBC_QRCoderErrorCorrectionLevel* L;
@@ -22,10 +22,10 @@ public: virtual ~CBC_QRCoderErrorCorrectionLevel();
static void Initialize();
static void Finalize();
- FX_INT32 Ordinal();
- FX_INT32 GetBits();
+ int32_t Ordinal();
+ int32_t GetBits();
CFX_ByteString GetName();
static void Destroy();
- static CBC_QRCoderErrorCorrectionLevel* ForBits(FX_INT32 bits);
+ static CBC_QRCoderErrorCorrectionLevel* ForBits(int32_t bits);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp index 5a205480ae..9c72140241 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp @@ -23,8 +23,8 @@ #include "../barcode.h"
#include "BC_QRCoderErrorCorrectionLevel.h"
#include "BC_QRCoderFormatInformation.h"
-const FX_INT32 CBC_QRCoderFormatInformation::FORMAT_INFO_MASK_QR = 0X5412;
-const FX_INT32 CBC_QRCoderFormatInformation::FORMAT_INFO_DECODE_LOOKUP[32][2] = {
+const int32_t CBC_QRCoderFormatInformation::FORMAT_INFO_MASK_QR = 0X5412;
+const int32_t CBC_QRCoderFormatInformation::FORMAT_INFO_DECODE_LOOKUP[32][2] = {
{0x5412, 0x00},
{0x5125, 0x01},
{0x5E7C, 0x02},
@@ -58,17 +58,17 @@ const FX_INT32 CBC_QRCoderFormatInformation::FORMAT_INFO_DECODE_LOOKUP[32][2] = {0x2EDA, 0x1E},
{0x2BED, 0x1F},
};
-const FX_INT32 CBC_QRCoderFormatInformation::BITS_SET_IN_HALF_BYTE[] =
+const int32_t CBC_QRCoderFormatInformation::BITS_SET_IN_HALF_BYTE[] =
{0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
-CBC_QRCoderFormatInformation::CBC_QRCoderFormatInformation(FX_INT32 formatInfo)
+CBC_QRCoderFormatInformation::CBC_QRCoderFormatInformation(int32_t formatInfo)
{
m_errorCorrectLevl = CBC_QRCoderErrorCorrectionLevel::ForBits((formatInfo >> 3) & 0x03);
- m_dataMask = (FX_BYTE) (formatInfo & 0x07);
+ m_dataMask = (uint8_t) (formatInfo & 0x07);
}
CBC_QRCoderFormatInformation::~CBC_QRCoderFormatInformation()
{
}
-FX_INT32 CBC_QRCoderFormatInformation::NumBitsDiffering(FX_INT32 a, FX_INT32 b)
+int32_t CBC_QRCoderFormatInformation::NumBitsDiffering(int32_t a, int32_t b)
{
a ^= b;
return BITS_SET_IN_HALF_BYTE[a & 0x0F] +
@@ -80,7 +80,7 @@ FX_INT32 CBC_QRCoderFormatInformation::NumBitsDiffering(FX_INT32 a, FX_INT32 b) BITS_SET_IN_HALF_BYTE[(a >> 24) & 0x0F] +
BITS_SET_IN_HALF_BYTE[(a >> 28) & 0x0F];
}
-FX_BYTE CBC_QRCoderFormatInformation::GetDataMask()
+uint8_t CBC_QRCoderFormatInformation::GetDataMask()
{
return m_dataMask;
}
@@ -88,7 +88,7 @@ CBC_QRCoderErrorCorrectionLevel *CBC_QRCoderFormatInformation::GetErrorCorrectio {
return m_errorCorrectLevl;
}
-CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DecodeFormatInformation(FX_INT32 maskedFormatInfo)
+CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DecodeFormatInformation(int32_t maskedFormatInfo)
{
CBC_QRCoderFormatInformation* formatInfo = DoDecodeFormatInformation(maskedFormatInfo);
if(formatInfo != NULL) {
@@ -96,17 +96,17 @@ CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DecodeFormatInformat }
return DoDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR);
}
-CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DoDecodeFormatInformation(FX_INT32 maskedFormatInfo)
+CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DoDecodeFormatInformation(int32_t maskedFormatInfo)
{
- FX_INT32 bestDifference = (FX_INT32)FXSYS_nan();
- FX_INT32 bestFormatInfo = 0;
- for(FX_INT32 i = 0; i < 32; i++) {
- FX_INT32 const* decodeInfo = &FORMAT_INFO_DECODE_LOOKUP[i][0];
- FX_INT32 targetInfo = decodeInfo[0];
+ int32_t bestDifference = (int32_t)FXSYS_nan();
+ int32_t bestFormatInfo = 0;
+ for(int32_t i = 0; i < 32; i++) {
+ int32_t const* decodeInfo = &FORMAT_INFO_DECODE_LOOKUP[i][0];
+ int32_t targetInfo = decodeInfo[0];
if(targetInfo == maskedFormatInfo) {
return FX_NEW CBC_QRCoderFormatInformation(decodeInfo[1]);
}
- FX_INT32 bitsDifference = NumBitsDiffering(maskedFormatInfo, targetInfo);
+ int32_t bitsDifference = NumBitsDiffering(maskedFormatInfo, targetInfo);
if(bitsDifference < bestDifference) {
bestFormatInfo = decodeInfo[1];
bestDifference = bitsDifference;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h index 49265e5033..5a0f15064c 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h @@ -10,19 +10,19 @@ class CBC_QRCoderErrorCorrectionLevel; class CBC_QRCoderFormatInformation
{
private:
- const static FX_INT32 FORMAT_INFO_MASK_QR;
- const static FX_INT32 FORMAT_INFO_DECODE_LOOKUP[32][2];
- const static FX_INT32 BITS_SET_IN_HALF_BYTE[16];
+ const static int32_t FORMAT_INFO_MASK_QR;
+ const static int32_t FORMAT_INFO_DECODE_LOOKUP[32][2];
+ const static int32_t BITS_SET_IN_HALF_BYTE[16];
CBC_QRCoderErrorCorrectionLevel* m_errorCorrectLevl;
- FX_BYTE m_dataMask;
+ uint8_t m_dataMask;
public:
- CBC_QRCoderFormatInformation(FX_INT32 formatInfo);
+ CBC_QRCoderFormatInformation(int32_t formatInfo);
virtual ~CBC_QRCoderFormatInformation();
- FX_BYTE GetDataMask();
+ uint8_t GetDataMask();
CBC_QRCoderErrorCorrectionLevel* GetErrorCorrectionLevel();
- static FX_INT32 NumBitsDiffering(FX_INT32 a, FX_INT32 b);
- static CBC_QRCoderFormatInformation* DecodeFormatInformation(FX_INT32 maskedFormatInfo);
- static CBC_QRCoderFormatInformation* DoDecodeFormatInformation(FX_INT32 maskedFormatInfo);
+ static int32_t NumBitsDiffering(int32_t a, int32_t b);
+ static CBC_QRCoderFormatInformation* DecodeFormatInformation(int32_t maskedFormatInfo);
+ static CBC_QRCoderFormatInformation* DoDecodeFormatInformation(int32_t maskedFormatInfo);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp index bc01eff442..f0e777c6eb 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp @@ -31,20 +31,20 @@ CBC_QRCoderMaskUtil::CBC_QRCoderMaskUtil() CBC_QRCoderMaskUtil::~CBC_QRCoderMaskUtil()
{
}
-FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix)
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix)
{
return ApplyMaskPenaltyRule1Internal(matrix, TRUE) +
ApplyMaskPenaltyRule1Internal(matrix, FALSE);
}
-FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix)
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix)
{
- FX_INT32 penalty = 0;
- FX_BYTE* array = matrix->GetArray();
- FX_INT32 width = matrix->GetWidth();
- FX_INT32 height = matrix->GetHeight();
- for(FX_INT32 y = 0; y < height - 1; y++) {
- for(FX_INT32 x = 0; x < width - 1; x++) {
- FX_INT32 value = array[y * width + x];
+ int32_t penalty = 0;
+ uint8_t* array = matrix->GetArray();
+ int32_t width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ for(int32_t y = 0; y < height - 1; y++) {
+ for(int32_t x = 0; x < width - 1; x++) {
+ int32_t value = array[y * width + x];
if(value == array[y * width + x + 1] &&
value == array[(y + 1) * width + x] &&
value == array[(y + 1) * width + x + 1]) {
@@ -54,14 +54,14 @@ FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix }
return 3 * penalty;
}
-FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix)
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix)
{
- FX_INT32 penalty = 0;
- FX_BYTE* array = matrix->GetArray();
- FX_INT32 width = matrix->GetWidth();
- FX_INT32 height = matrix->GetHeight();
- for (FX_INT32 y = 0; y < height; ++y) {
- for (FX_INT32 x = 0; x < width; ++x) {
+ int32_t penalty = 0;
+ uint8_t* array = matrix->GetArray();
+ int32_t width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ for (int32_t y = 0; y < height; ++y) {
+ for (int32_t x = 0; x < width; ++x) {
if (x == 0 && ((y >= 0 && y <= 6) || (y >= height - 7 && y <= height - 1))) {
continue;
}
@@ -118,30 +118,30 @@ FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix }
return penalty;
}
-FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix)
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix)
{
- FX_INT32 numDarkCells = 0;
- FX_BYTE* array = matrix->GetArray();
- FX_INT32 width = matrix->GetWidth();
- FX_INT32 height = matrix->GetHeight();
- for (FX_INT32 y = 0; y < height; ++y) {
- for (FX_INT32 x = 0; x < width; ++x) {
+ int32_t numDarkCells = 0;
+ uint8_t* array = matrix->GetArray();
+ int32_t width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ for (int32_t y = 0; y < height; ++y) {
+ for (int32_t x = 0; x < width; ++x) {
if (array[y * width + x] == 1) {
numDarkCells += 1;
}
}
}
- FX_INT32 numTotalCells = matrix->GetHeight() * matrix->GetWidth();
+ int32_t numTotalCells = matrix->GetHeight() * matrix->GetWidth();
double darkRatio = (double) numDarkCells / numTotalCells;
- return abs( (FX_INT32) (darkRatio * 100 - 50) / 5 ) * 5 * 10;
+ return abs( (int32_t) (darkRatio * 100 - 50) / 5 ) * 5 * 10;
}
-FX_BOOL CBC_QRCoderMaskUtil::GetDataMaskBit(FX_INT32 maskPattern, FX_INT32 x, FX_INT32 y, FX_INT32 &e)
+FX_BOOL CBC_QRCoderMaskUtil::GetDataMaskBit(int32_t maskPattern, int32_t x, int32_t y, int32_t &e)
{
if(!CBC_QRCoder::IsValidMaskPattern(maskPattern)) {
e = (BCExceptionInvalidateMaskPattern);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
}
- FX_INT32 intermediate = 0, temp = 0;
+ int32_t intermediate = 0, temp = 0;
switch(maskPattern) {
case 0:
intermediate = (y + x) & 0x1;
@@ -177,19 +177,19 @@ FX_BOOL CBC_QRCoderMaskUtil::GetDataMaskBit(FX_INT32 maskPattern, FX_INT32 x, FX }
return intermediate == 0;
}
-FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix, FX_BOOL isHorizontal)
+int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix, FX_BOOL isHorizontal)
{
- FX_INT32 penalty = 0;
- FX_INT32 numSameBitCells = 0;
- FX_INT32 prevBit = -1;
- FX_INT32 width = matrix->GetWidth();
- FX_INT32 height = matrix->GetHeight();
- FX_INT32 iLimit = isHorizontal ? height : width;
- FX_INT32 jLimit = isHorizontal ? width : height;
- FX_BYTE* array = matrix->GetArray();
- for (FX_INT32 i = 0; i < iLimit; ++i) {
- for (FX_INT32 j = 0; j < jLimit; ++j) {
- FX_INT32 bit = isHorizontal ? array[i * width + j] : array[j * width + i];
+ int32_t penalty = 0;
+ int32_t numSameBitCells = 0;
+ int32_t prevBit = -1;
+ int32_t width = matrix->GetWidth();
+ int32_t height = matrix->GetHeight();
+ int32_t iLimit = isHorizontal ? height : width;
+ int32_t jLimit = isHorizontal ? width : height;
+ uint8_t* array = matrix->GetArray();
+ for (int32_t i = 0; i < iLimit; ++i) {
+ for (int32_t j = 0; j < jLimit; ++j) {
+ int32_t bit = isHorizontal ? array[i * width + j] : array[j * width + i];
if (bit == prevBit) {
numSameBitCells += 1;
if (numSameBitCells == 5) {
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h index 13bb11691a..10ff964e97 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h @@ -12,12 +12,12 @@ class CBC_QRCoderMaskUtil public:
CBC_QRCoderMaskUtil();
virtual ~CBC_QRCoderMaskUtil();
- static FX_BOOL GetDataMaskBit(FX_INT32 maskPattern, FX_INT32 x, FX_INT32 y, FX_INT32 &e);
+ static FX_BOOL GetDataMaskBit(int32_t maskPattern, int32_t x, int32_t y, int32_t &e);
- static FX_INT32 ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix);
- static FX_INT32 ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix);
- static FX_INT32 ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix);
- static FX_INT32 ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix);
- static FX_INT32 ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix, FX_BOOL isHorizontal);
+ static int32_t ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix);
+ static int32_t ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix);
+ static int32_t ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix);
+ static int32_t ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix);
+ static int32_t ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix, FX_BOOL isHorizontal);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp index 4c2db5e34e..7caa6b5bab 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp @@ -27,7 +27,7 @@ #include "BC_QRCoderMaskUtil.h"
#include "BC_QRCoderMatrixUtil.h"
#include "BC_QRCoderBitVector.h"
-const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = {
+const int32_t CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = {
1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 0, 1,
1, 0, 1, 1, 1, 0, 1,
@@ -36,20 +36,20 @@ const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = { 1, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1
};
-const FX_INT32 CBC_QRCoderMatrixUtil::HORIZONTAL_SEPARATION_PATTERN[1][8] = {
+const int32_t CBC_QRCoderMatrixUtil::HORIZONTAL_SEPARATION_PATTERN[1][8] = {
0, 0, 0, 0, 0, 0, 0, 0
};
-const FX_INT32 CBC_QRCoderMatrixUtil::VERTICAL_SEPARATION_PATTERN[7][1] = {
+const int32_t CBC_QRCoderMatrixUtil::VERTICAL_SEPARATION_PATTERN[7][1] = {
0, 0, 0, 0, 0, 0, 0
};
-const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN[5][5] = {
+const int32_t CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN[5][5] = {
1, 1, 1, 1, 1,
1, 0, 0, 0, 1,
1, 0, 1, 0, 1,
1, 0, 0, 0, 1,
1, 1, 1, 1, 1
};
-const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7] = {
+const int32_t CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7] = {
{ -1, -1, -1, -1, -1, -1, -1},
{ 6, 18, -1, -1, -1, -1, -1},
{ 6, 22, -1, -1, -1, -1, -1},
@@ -91,7 +91,7 @@ const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TAB { 6, 26, 54, 82, 110, 138, 166},
{ 6, 30, 58, 86, 114, 142, 170},
};
-const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = {
+const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = {
{8, 0},
{8, 1},
{8, 2},
@@ -108,21 +108,21 @@ const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = { {1, 8},
{0, 8},
};
-const FX_INT32 CBC_QRCoderMatrixUtil::VERSION_INFO_POLY = 0x1f25;
-const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_POLY = 0x0537;
-const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_MASK_PATTERN = 0x5412;
-void CBC_QRCoderMatrixUtil::ClearMatrix(CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+const int32_t CBC_QRCoderMatrixUtil::VERSION_INFO_POLY = 0x1f25;
+const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_POLY = 0x0537;
+const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_MASK_PATTERN = 0x5412;
+void CBC_QRCoderMatrixUtil::ClearMatrix(CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- matrix->clear((FX_BYTE) - 1);
+ matrix->clear((uint8_t) - 1);
}
void CBC_QRCoderMatrixUtil::BuildMatrix(CBC_QRCoderBitVector* dataBits,
CBC_QRCoderErrorCorrectionLevel* ecLevel,
- FX_INT32 version, FX_INT32 maskPattern,
- CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+ int32_t version, int32_t maskPattern,
+ CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
@@ -139,7 +139,7 @@ void CBC_QRCoderMatrixUtil::BuildMatrix(CBC_QRCoderBitVector* dataBits, EmbedDataBits(dataBits, maskPattern, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
@@ -155,7 +155,7 @@ void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(FX_INT32 version, CBC_CommonByteM BC_EXCEPTION_CHECK_ReturnVoid(e);
}
void CBC_QRCoderMatrixUtil::EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLevel,
- FX_INT32 maskPattern, CBC_CommonByteMatrix *matrix, FX_INT32 &e)
+ int32_t maskPattern, CBC_CommonByteMatrix *matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
@@ -165,24 +165,24 @@ void CBC_QRCoderMatrixUtil::EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLev typeInfoBits.Init();
MakeTypeInfoBits(ecLevel, maskPattern, &typeInfoBits, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- for(FX_INT32 i = 0; i < typeInfoBits.Size(); i++) {
- FX_INT32 bit = typeInfoBits.At(typeInfoBits.Size() - 1 - i, e);
+ for(int32_t i = 0; i < typeInfoBits.Size(); i++) {
+ int32_t bit = typeInfoBits.At(typeInfoBits.Size() - 1 - i, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 x1 = TYPE_INFO_COORDINATES[i][0];
- FX_INT32 y1 = TYPE_INFO_COORDINATES[i][1];
+ int32_t x1 = TYPE_INFO_COORDINATES[i][0];
+ int32_t y1 = TYPE_INFO_COORDINATES[i][1];
matrix->Set(x1, y1, bit);
if(i < 8) {
- FX_INT32 x2 = matrix->GetWidth() - i - 1;
- FX_INT32 y2 = 8;
+ int32_t x2 = matrix->GetWidth() - i - 1;
+ int32_t y2 = 8;
matrix->Set(x2, y2, bit);
} else {
- FX_INT32 x2 = 8;
- FX_INT32 y2 = matrix->GetHeight() - 7 + (i - 8);
+ int32_t x2 = 8;
+ int32_t y2 = matrix->GetHeight() - 7 + (i - 8);
matrix->Set(x2, y2, bit);
}
}
}
-void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
@@ -195,10 +195,10 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonBy versionInfoBits.Init();
MakeVersionInfoBits(version, &versionInfoBits, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 bitIndex = 6 * 3 - 1;
- for(FX_INT32 i = 0; i < 6; i++) {
- for(FX_INT32 j = 0; j < 3; j++) {
- FX_INT32 bit = versionInfoBits.At(bitIndex, e);
+ int32_t bitIndex = 6 * 3 - 1;
+ for(int32_t i = 0; i < 6; i++) {
+ for(int32_t j = 0; j < 3; j++) {
+ int32_t bit = versionInfoBits.At(bitIndex, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
bitIndex--;
matrix->Set(i, matrix->GetHeight() - 11 + j, bit);
@@ -207,16 +207,16 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonBy }
}
void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits,
- FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+ int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL || dataBits == NULL) {
e = BCExceptionNullPointer;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 bitIndex = 0;
- FX_INT32 direction = -1;
- FX_INT32 x = matrix->GetWidth() - 1;
- FX_INT32 y = matrix->GetHeight() - 1;
+ int32_t bitIndex = 0;
+ int32_t direction = -1;
+ int32_t x = matrix->GetWidth() - 1;
+ int32_t y = matrix->GetHeight() - 1;
while(x > 0) {
if (x == 6) {
x -= 1;
@@ -226,12 +226,12 @@ void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits, y += direction;
continue;
}
- for(FX_INT32 i = 0; i < 2; i++) {
- FX_INT32 xx = x - i;
+ for(int32_t i = 0; i < 2; i++) {
+ int32_t xx = x - i;
if(!IsEmpty(matrix->Get(xx, y))) {
continue;
}
- FX_INT32 bit;
+ int32_t bit;
if(bitIndex < dataBits->Size()) {
bit = dataBits->At(bitIndex, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -258,9 +258,9 @@ void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits, return;
}
}
-FX_INT32 CBC_QRCoderMatrixUtil::CalculateBCHCode(FX_INT32 value, FX_INT32 poly)
+int32_t CBC_QRCoderMatrixUtil::CalculateBCHCode(int32_t value, int32_t poly)
{
- FX_INT32 msbSetInPoly = FindMSBSet(poly);
+ int32_t msbSetInPoly = FindMSBSet(poly);
value <<= msbSetInPoly - 1;
while(FindMSBSet(value) >= msbSetInPoly) {
value ^= poly << (FindMSBSet(value) - msbSetInPoly);
@@ -268,7 +268,7 @@ FX_INT32 CBC_QRCoderMatrixUtil::CalculateBCHCode(FX_INT32 value, FX_INT32 poly) return value;
}
void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ecLevel,
- FX_INT32 maskPattern, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+ int32_t maskPattern, CBC_QRCoderBitVector* bits, int32_t &e)
{
if(bits == NULL) {
e = BCExceptionNullPointer;
@@ -278,10 +278,10 @@ void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ec e = BCExceptionBadMask;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 typeInfo = (ecLevel->GetBits() << 3) | maskPattern;
+ int32_t typeInfo = (ecLevel->GetBits() << 3) | maskPattern;
BC_EXCEPTION_CHECK_ReturnVoid(e);
bits->AppendBits(typeInfo, 5, e);
- FX_INT32 bchCode = CalculateBCHCode(typeInfo, TYPE_INFO_POLY);
+ int32_t bchCode = CalculateBCHCode(typeInfo, TYPE_INFO_POLY);
BC_EXCEPTION_CHECK_ReturnVoid(e);
bits->AppendBits(bchCode, 10, e);
CBC_QRCoderBitVector maskBits;
@@ -295,7 +295,7 @@ void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ec BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBitVector* bits, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(int32_t version, CBC_QRCoderBitVector* bits, int32_t &e)
{
if(bits == NULL) {
e = BCExceptionNullPointer;
@@ -303,7 +303,7 @@ void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBit }
bits->AppendBits(version, 6, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 bchCode = CalculateBCHCode(version, VERSION_INFO_POLY);
+ int32_t bchCode = CalculateBCHCode(version, VERSION_INFO_POLY);
bits->AppendBits(bchCode, 12, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if(bits->Size() != 18) {
@@ -311,22 +311,22 @@ void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBit BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-FX_BOOL CBC_QRCoderMatrixUtil::IsEmpty(FX_INT32 value)
+FX_BOOL CBC_QRCoderMatrixUtil::IsEmpty(int32_t value)
{
- return (FX_BYTE)value == 0xff;
+ return (uint8_t)value == 0xff;
}
-FX_BOOL CBC_QRCoderMatrixUtil::IsValidValue(FX_INT32 value)
+FX_BOOL CBC_QRCoderMatrixUtil::IsValidValue(int32_t value)
{
- return ((FX_BYTE)value == 0xff || (FX_BYTE)value == 0x00 || (FX_BYTE)value == 0x01);
+ return ((uint8_t)value == 0xff || (uint8_t)value == 0x00 || (uint8_t)value == 0x01);
}
-void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- for(FX_INT32 i = 8; i < matrix->GetWidth() - 8; i++) {
- FX_INT32 bit = (i + 1) % 2;
+ for(int32_t i = 8; i < matrix->GetWidth() - 8; i++) {
+ int32_t bit = (i + 1) % 2;
if(!IsValidValue(matrix->Get(i, 6))) {
e = BCExceptionInvalidateImageData;
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -343,7 +343,7 @@ void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, FX }
}
}
-void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
@@ -355,14 +355,14 @@ void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* }
matrix->Set(8, matrix->GetHeight() - 8, 1);
}
-void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart,
- CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(int32_t xStart, int32_t yStart,
+ CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- for(FX_INT32 x = 0; x < 8; x++) {
+ for(int32_t x = 0; x < 8; x++) {
if(!IsEmpty(matrix->Get(xStart + x, yStart))) {
e = BCExceptionInvalidateData;
BC_EXCEPTION_CHECK_ReturnVoid(e)
@@ -370,14 +370,14 @@ void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(FX_INT32 xStart, FX matrix->Set(xStart + x, yStart, HORIZONTAL_SEPARATION_PATTERN[0][x]);
}
}
-void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart,
- CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(int32_t xStart, int32_t yStart,
+ CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- for(FX_INT32 y = 0; y < 7; y++) {
+ for(int32_t y = 0; y < 7; y++) {
if(!IsEmpty(matrix->Get(xStart, yStart + y))) {
e = BCExceptionInvalidateData;
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -385,15 +385,15 @@ void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(FX_INT32 xStart, FX_I matrix->Set(xStart, yStart + y, VERTICAL_SEPARATION_PATTERN[y][0]);
}
}
-void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(FX_INT32 xStart, FX_INT32 yStart,
- CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(int32_t xStart, int32_t yStart,
+ CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- for(FX_INT32 y = 0; y < 5; y++) {
- for(FX_INT32 x = 0; x < 5; x++) {
+ for(int32_t y = 0; y < 5; y++) {
+ for(int32_t x = 0; x < 5; x++) {
if(!IsEmpty(matrix->Get(xStart + x, y + yStart))) {
e = BCExceptionInvalidateData;
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -402,15 +402,15 @@ void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(FX_INT32 xStart, FX_I }
}
}
-void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern (FX_INT32 xStart, FX_INT32 yStart,
- CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern (int32_t xStart, int32_t yStart,
+ CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- for(FX_INT32 y = 0; y < 7; y++) {
- for(FX_INT32 x = 0; x < 7; x++) {
+ for(int32_t y = 0; y < 7; y++) {
+ for(int32_t x = 0; x < 7; x++) {
if(!IsEmpty(matrix->Get(xStart + x, yStart + y))) {
e = BCExceptionInvalidateData;
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -419,27 +419,27 @@ void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern (FX_INT32 xStart, FX_I }
}
}
-void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_INT32 pdpWidth = 7;
+ int32_t pdpWidth = 7;
EmbedPositionDetectionPattern(0, 0, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
EmbedPositionDetectionPattern(matrix->GetWidth() - pdpWidth, 0, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
EmbedPositionDetectionPattern(0, matrix->GetWidth() - pdpWidth, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 hspWidth = 8;
+ int32_t hspWidth = 8;
EmbedHorizontalSeparationPattern(0, hspWidth - 1, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
EmbedHorizontalSeparationPattern(matrix->GetWidth() - hspWidth, hspWidth - 1, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
EmbedHorizontalSeparationPattern(0, matrix->GetWidth() - hspWidth, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 vspSize = 7;
+ int32_t vspSize = 7;
EmbedVerticalSeparationPattern(vspSize, 0, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
EmbedVerticalSeparationPattern(matrix->GetHeight() - vspSize - 1, 0, matrix, e);
@@ -447,7 +447,7 @@ void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(CBC_Comm EmbedVerticalSeparationPattern(vspSize, matrix->GetHeight() - vspSize, matrix, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e)
+void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e)
{
if(matrix == NULL) {
e = BCExceptionNullPointer;
@@ -456,13 +456,13 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(FX_INT32 versio if(version < 2) {
return;
}
- FX_INT32 index = version - 1;
- FX_INT32 const* coordinates = &(POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index][0]);
- FX_INT32 numCoordinate = 7;
- for(FX_INT32 i = 0; i < numCoordinate; i++) {
- for(FX_INT32 j = 0; j < numCoordinate; j++) {
- FX_INT32 y = coordinates[i];
- FX_INT32 x = coordinates[j];
+ int32_t index = version - 1;
+ int32_t const* coordinates = &(POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index][0]);
+ int32_t numCoordinate = 7;
+ for(int32_t i = 0; i < numCoordinate; i++) {
+ for(int32_t j = 0; j < numCoordinate; j++) {
+ int32_t y = coordinates[i];
+ int32_t x = coordinates[j];
if(x == -1 || y == -1) {
continue;
}
@@ -473,9 +473,9 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(FX_INT32 versio }
}
}
-FX_INT32 CBC_QRCoderMatrixUtil::FindMSBSet(FX_INT32 value)
+int32_t CBC_QRCoderMatrixUtil::FindMSBSet(int32_t value)
{
- FX_INT32 numDigits = 0;
+ int32_t numDigits = 0;
while(value != 0) {
value >>= 1;
++numDigits;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h index ce1e65d4c2..5da32441fc 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h @@ -12,38 +12,38 @@ class CBC_QRCoderBitVector; class CBC_QRCoderMatrixUtil
{
private:
- const static FX_INT32 POSITION_DETECTION_PATTERN[7][7];
- const static FX_INT32 VERTICAL_SEPARATION_PATTERN[7][1];
- const static FX_INT32 HORIZONTAL_SEPARATION_PATTERN[1][8];
- const static FX_INT32 POSITION_ADJUSTMENT_PATTERN[5][5];
- const static FX_INT32 POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7];
- const static FX_INT32 TYPE_INFO_COORDINATES[15][2];
- const static FX_INT32 VERSION_INFO_POLY;
- const static FX_INT32 TYPE_INFO_POLY;
- const static FX_INT32 TYPE_INFO_MASK_PATTERN;
+ const static int32_t POSITION_DETECTION_PATTERN[7][7];
+ const static int32_t VERTICAL_SEPARATION_PATTERN[7][1];
+ const static int32_t HORIZONTAL_SEPARATION_PATTERN[1][8];
+ const static int32_t POSITION_ADJUSTMENT_PATTERN[5][5];
+ const static int32_t POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7];
+ const static int32_t TYPE_INFO_COORDINATES[15][2];
+ const static int32_t VERSION_INFO_POLY;
+ const static int32_t TYPE_INFO_POLY;
+ const static int32_t TYPE_INFO_MASK_PATTERN;
public:
CBC_QRCoderMatrixUtil();
virtual ~CBC_QRCoderMatrixUtil();
- static void ClearMatrix(CBC_CommonByteMatrix* matrix, FX_INT32 &e);
+ static void ClearMatrix(CBC_CommonByteMatrix* matrix, int32_t &e);
static void BuildMatrix(CBC_QRCoderBitVector* dataBits, CBC_QRCoderErrorCorrectionLevel* ecLevel,
- FX_INT32 version, FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void EmbedBasicPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 maskPattern, CBC_CommonByteMatrix *matrix, FX_INT32 &e);
- static void EmbedDataBits(CBC_QRCoderBitVector* dataBits, FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static FX_INT32 FindMSBSet(FX_INT32 value);
- static FX_INT32 CalculateBCHCode(FX_INT32 code, FX_INT32 poly);
- static void MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 maskPattern, CBC_QRCoderBitVector* bits, FX_INT32 &e);
- static void MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBitVector* bits, FX_INT32 &e);
- static FX_BOOL IsEmpty(FX_INT32 value);
- static FX_BOOL IsValidValue(FX_INT32 value);
- static void EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void EmbedHorizontalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void EmbedVerticalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void EmbedPositionAdjustmentPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void EmbedPositionDetectionPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, FX_INT32 &e);
- static void MaybeEmbedPositionAdjustmentPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e);
+ int32_t version, int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void EmbedBasicPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t maskPattern, CBC_CommonByteMatrix *matrix, int32_t &e);
+ static void EmbedDataBits(CBC_QRCoderBitVector* dataBits, int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void MaybeEmbedVersionInfo(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static int32_t FindMSBSet(int32_t value);
+ static int32_t CalculateBCHCode(int32_t code, int32_t poly);
+ static void MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t maskPattern, CBC_QRCoderBitVector* bits, int32_t &e);
+ static void MakeVersionInfoBits(int32_t version, CBC_QRCoderBitVector* bits, int32_t &e);
+ static FX_BOOL IsEmpty(int32_t value);
+ static FX_BOOL IsValidValue(int32_t value);
+ static void EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void EmbedHorizontalSeparationPattern(int32_t xStart, int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void EmbedVerticalSeparationPattern(int32_t xStart, int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void EmbedPositionAdjustmentPattern(int32_t xStart, int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void EmbedPositionDetectionPattern(int32_t xStart, int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, int32_t &e);
+ static void MaybeEmbedPositionAdjustmentPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp index 00c7e47cb7..5bc2fe0623 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp @@ -33,9 +33,9 @@ CBC_QRCoderMode* CBC_QRCoderMode::sTERMINATOR = NULL; CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_FIRST_POSITION = NULL;
CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_SECOND_POSITION = NULL;
CBC_QRCoderMode* CBC_QRCoderMode::sSTRUCTURED_APPEND = NULL;
-CBC_QRCoderMode::CBC_QRCoderMode(FX_INT32 *characterCountBitsForVersions,
- FX_INT32 x1, FX_INT32 x2, FX_INT32 x3,
- FX_INT32 bits, CFX_ByteString name)
+CBC_QRCoderMode::CBC_QRCoderMode(int32_t *characterCountBitsForVersions,
+ int32_t x1, int32_t x2, int32_t x3,
+ int32_t bits, CFX_ByteString name)
{
m_characterCountBitsForVersions = characterCountBitsForVersions;
if (m_characterCountBitsForVersions != NULL) {
@@ -54,16 +54,16 @@ CBC_QRCoderMode::~CBC_QRCoderMode() }
void CBC_QRCoderMode::Initialize()
{
- sBYTE = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 8, 16, 16, 0x4, "BYTE");
- sALPHANUMERIC = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 9, 11, 13, 0x2, "ALPHANUMERIC");
+ sBYTE = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 16, 16, 0x4, "BYTE");
+ sALPHANUMERIC = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 9, 11, 13, 0x2, "ALPHANUMERIC");
sECI = FX_NEW CBC_QRCoderMode(NULL, 0, 0, 0, 0x7, "ECI");
- sKANJI = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 8, 10, 12, 0x8, "KANJI");
- sNUMERIC = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 10, 12, 14, 0x1, "NUMERIC");
- sGBK = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 8, 10, 12, 0x0D, "GBK");
- sTERMINATOR = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 0, 0, 0, 0x00, "TERMINATOR");
+ sKANJI = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 10, 12, 0x8, "KANJI");
+ sNUMERIC = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 10, 12, 14, 0x1, "NUMERIC");
+ sGBK = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 10, 12, 0x0D, "GBK");
+ sTERMINATOR = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 0, 0, 0, 0x00, "TERMINATOR");
sFNC1_FIRST_POSITION = FX_NEW CBC_QRCoderMode(NULL, 0, 0, 0, 0x05, "FNC1_FIRST_POSITION");
sFNC1_SECOND_POSITION = FX_NEW CBC_QRCoderMode(NULL, 0, 0, 0, 0x09, "FNC1_SECOND_POSITION");
- sSTRUCTURED_APPEND = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 0, 0, 0, 0x03, "STRUCTURED_APPEND");
+ sSTRUCTURED_APPEND = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 0, 0, 0, 0x03, "STRUCTURED_APPEND");
}
void CBC_QRCoderMode::Finalize()
{
@@ -78,7 +78,7 @@ void CBC_QRCoderMode::Finalize() delete sFNC1_SECOND_POSITION;
delete sSTRUCTURED_APPEND;
}
-CBC_QRCoderMode* CBC_QRCoderMode::ForBits(FX_INT32 bits, FX_INT32 &e)
+CBC_QRCoderMode* CBC_QRCoderMode::ForBits(int32_t bits, int32_t &e)
{
switch (bits) {
case 0x0:
@@ -108,7 +108,7 @@ CBC_QRCoderMode* CBC_QRCoderMode::ForBits(FX_INT32 bits, FX_INT32 &e) }
return NULL;
}
-FX_INT32 CBC_QRCoderMode::GetBits()
+int32_t CBC_QRCoderMode::GetBits()
{
return m_bits;
}
@@ -116,14 +116,14 @@ CFX_ByteString CBC_QRCoderMode::GetName() {
return m_name;
}
-FX_INT32 CBC_QRCoderMode::GetCharacterCountBits(CBC_QRCoderVersion* version, FX_INT32 &e)
+int32_t CBC_QRCoderMode::GetCharacterCountBits(CBC_QRCoderVersion* version, int32_t &e)
{
if(m_characterCountBitsForVersions == NULL) {
e = BCExceptionCharacterNotThisMode;
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
}
- FX_INT32 number = version->GetVersionNumber();
- FX_INT32 offset;
+ int32_t number = version->GetVersionNumber();
+ int32_t offset;
if(number <= 9) {
offset = 0;
} else if(number <= 26) {
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h index fbd90871cf..472d3b1198 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h @@ -10,10 +10,10 @@ class CBC_QRCoderVersion; class CBC_QRCoderMode
{
private:
- FX_INT32* m_characterCountBitsForVersions;
- FX_INT32 m_bits;
+ int32_t* m_characterCountBitsForVersions;
+ int32_t m_bits;
CFX_ByteString m_name;
- CBC_QRCoderMode(FX_INT32 *characterCountBitsForVersions, FX_INT32 x1, FX_INT32 x2, FX_INT32 x3, FX_INT32 bits, CFX_ByteString name);
+ CBC_QRCoderMode(int32_t *characterCountBitsForVersions, int32_t x1, int32_t x2, int32_t x3, int32_t bits, CFX_ByteString name);
CBC_QRCoderMode();
public:
static CBC_QRCoderMode* sBYTE;
@@ -30,9 +30,9 @@ public: static void Initialize();
static void Finalize();
- static CBC_QRCoderMode* ForBits(FX_INT32 bits, FX_INT32 &e);
- FX_INT32 GetCharacterCountBits(CBC_QRCoderVersion* version, FX_INT32 &e);
- FX_INT32 GetBits();
+ static CBC_QRCoderMode* ForBits(int32_t bits, int32_t &e);
+ int32_t GetCharacterCountBits(CBC_QRCoderVersion* version, int32_t &e);
+ int32_t GetBits();
CFX_ByteString GetName();
static void Destroy();
};
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp index 9ff54f2a13..e0acf46fb9 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp @@ -29,7 +29,7 @@ #include "BC_QRCoderBitVector.h"
#include "BC_QRCoderECBlocks.h"
#include "BC_QRCoderVersion.h"
-const FX_INT32 CBC_QRCoderVersion::VERSION_DECODE_INFO[] = {
+const int32_t CBC_QRCoderVersion::VERSION_DECODE_INFO[] = {
0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6,
0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78,
0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683,
@@ -45,13 +45,13 @@ void CBC_QRCoderVersion::Initialize() }
void CBC_QRCoderVersion::Finalize()
{
- for(FX_INT32 i = 0 ; i < VERSION->GetSize(); i++) {
+ for(int32_t i = 0 ; i < VERSION->GetSize(); i++) {
CBC_QRCoderVersion* v = (CBC_QRCoderVersion*)(VERSION->GetAt(i));
delete v;
}
delete VERSION;
}
-CBC_QRCoderVersion::CBC_QRCoderVersion(FX_INT32 versionNumber,
+CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber,
CBC_QRCoderECBlocks* ecBlocks1,
CBC_QRCoderECBlocks* ecBlocks2,
CBC_QRCoderECBlocks* ecBlocks3,
@@ -62,10 +62,10 @@ CBC_QRCoderVersion::CBC_QRCoderVersion(FX_INT32 versionNumber, m_ecBlocks.Add(ecBlocks2);
m_ecBlocks.Add(ecBlocks3);
m_ecBlocks.Add(ecBlocks4);
- FX_INT32 total = 0;
- FX_INT32 ecCodeWords = ecBlocks1->GetECCodeWordsPerBlock();
+ int32_t total = 0;
+ int32_t ecCodeWords = ecBlocks1->GetECCodeWordsPerBlock();
CFX_PtrArray* ecbArray = ecBlocks1->GetECBlocks();
- for(FX_INT32 i = 0; i < ecbArray->GetSize(); i++) {
+ for(int32_t i = 0; i < ecbArray->GetSize(); i++) {
CBC_QRCoderECB* ecBlock = (CBC_QRCoderECB*)((*ecbArray)[i]);
total += ecBlock->GetCount() * (ecBlock->GetDataCodeWords() + ecCodeWords);
}
@@ -334,15 +334,15 @@ CBC_QRCoderVersion::CBC_QRCoderVersion(FX_INT32 versionNumber, CBC_QRCoderVersion::~CBC_QRCoderVersion()
{
if(m_ecBlocks.GetSize() != 0) {
- FX_INT32 itBeg = 0;
- FX_INT32 itEnd = m_ecBlocks.GetSize();
+ int32_t itBeg = 0;
+ int32_t itEnd = m_ecBlocks.GetSize();
while(itBeg != itEnd) {
delete ( (CBC_QRCoderECBlocks*)(m_ecBlocks[itBeg]) );
itBeg++;
}
}
}
-FX_INT32 CBC_QRCoderVersion::GetVersionNumber()
+int32_t CBC_QRCoderVersion::GetVersionNumber()
{
return m_versionNumber;
}
@@ -350,11 +350,11 @@ CFX_Int32Array* CBC_QRCoderVersion::GetAlignmentPatternCenters() {
return &m_alignmentPatternCenters;
}
-FX_INT32 CBC_QRCoderVersion::GetTotalCodeWords()
+int32_t CBC_QRCoderVersion::GetTotalCodeWords()
{
return m_totalCodeWords;
}
-FX_INT32 CBC_QRCoderVersion::GetDimensionForVersion()
+int32_t CBC_QRCoderVersion::GetDimensionForVersion()
{
return 17 + 4 * m_versionNumber;
}
@@ -362,7 +362,7 @@ CBC_QRCoderECBlocks* CBC_QRCoderVersion::GetECBlocksForLevel(CBC_QRCoderErrorCor {
return (CBC_QRCoderECBlocks*)m_ecBlocks[ecLevel->Ordinal()];
}
-CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension(FX_INT32 dimension, FX_INT32 &e)
+CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension(int32_t dimension, int32_t &e)
{
if((dimension % 4) != 1) {
e = BCExceptionRead;
@@ -372,18 +372,18 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension(FX_INT BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return qcv;
}
-CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation(FX_INT32 versionBits, FX_INT32 &e)
+CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation(int32_t versionBits, int32_t &e)
{
- FX_INT32 bestDifference = FXSYS_IntMax;
- FX_INT32 bestVersion = 0;
- for (FX_INT32 i = 0; i < 34; i++) {
- FX_INT32 targetVersion = VERSION_DECODE_INFO[i];
+ int32_t bestDifference = FXSYS_IntMax;
+ int32_t bestVersion = 0;
+ for (int32_t i = 0; i < 34; i++) {
+ int32_t targetVersion = VERSION_DECODE_INFO[i];
if(targetVersion == versionBits) {
CBC_QRCoderVersion* qcv = GetVersionForNumber(i + 7, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return qcv;
}
- FX_INT32 bitsDifference = CBC_QRCoderFormatInformation::NumBitsDiffering(versionBits, targetVersion);
+ int32_t bitsDifference = CBC_QRCoderFormatInformation::NumBitsDiffering(versionBits, targetVersion);
if(bitsDifference < bestDifference) {
bestVersion = i + 7;
bestDifference = bitsDifference;
@@ -396,9 +396,9 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation(FX_INT32 versio }
return NULL;
}
-CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(FX_INT32 &e)
+CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t &e)
{
- FX_INT32 dimension = GetDimensionForVersion();
+ int32_t dimension = GetDimensionForVersion();
CBC_CommonBitMatrix* bitMatrix = FX_NEW CBC_CommonBitMatrix();
bitMatrix->Init(dimension);
bitMatrix->SetRegion(0, 0 , 9, 9, e);
@@ -407,10 +407,10 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
bitMatrix->SetRegion(0, dimension - 8, 9, 8, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 max = m_alignmentPatternCenters.GetSize();
- for (FX_INT32 x = 0; x < max; x++) {
- FX_INT32 i = m_alignmentPatternCenters[x] - 2;
- for (FX_INT32 y = 0; y < max; y++) {
+ int32_t max = m_alignmentPatternCenters.GetSize();
+ for (int32_t x = 0; x < max; x++) {
+ int32_t i = m_alignmentPatternCenters[x] - 2;
+ for (int32_t y = 0; y < max; y++) {
if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) {
continue;
}
@@ -430,7 +430,7 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(FX_INT32 &e) }
return bitMatrix;
}
-CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(FX_INT32 versionNumber, FX_INT32 &e)
+CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(int32_t versionNumber, int32_t &e)
{
if(VERSION->GetSize() == 0) {
VERSION->Add(FX_NEW CBC_QRCoderVersion(1,
@@ -770,7 +770,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(FX_INT32 versionNumb }
void CBC_QRCoderVersion::Destroy()
{
- FX_INT32 i;
+ int32_t i;
for(i = 0; i < VERSION->GetSize(); i++) {
delete ( (CBC_QRCoderVersion*)(*VERSION)[i] );
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h index 17d392121d..46a80c8d09 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h @@ -12,30 +12,30 @@ class CBC_QRCoderErrorCorrectionLevel; class CBC_QRCoderVersion
{
private:
- const static FX_INT32 VERSION_DECODE_INFO[34];
+ const static int32_t VERSION_DECODE_INFO[34];
static CFX_PtrArray *VERSION;
- FX_INT32 m_versionNumber;
- FX_INT32 m_totalCodeWords;
+ int32_t m_versionNumber;
+ int32_t m_totalCodeWords;
CFX_Int32Array m_alignmentPatternCenters;
CFX_PtrArray m_ecBlocks;
CBC_QRCoderVersion();
- CBC_QRCoderVersion(FX_INT32 versionNumber, CBC_QRCoderECBlocks* ecBlocks1, CBC_QRCoderECBlocks* ecBlocks2,
+ CBC_QRCoderVersion(int32_t versionNumber, CBC_QRCoderECBlocks* ecBlocks1, CBC_QRCoderECBlocks* ecBlocks2,
CBC_QRCoderECBlocks* ecBlocks3, CBC_QRCoderECBlocks* ecBlocks4);
public:
virtual ~CBC_QRCoderVersion();
static void Initialize();
static void Finalize();
- FX_INT32 GetVersionNumber();
- FX_INT32 GetTotalCodeWords();
- FX_INT32 GetDimensionForVersion();
- CBC_CommonBitMatrix *BuildFunctionPattern(FX_INT32 &e);
+ int32_t GetVersionNumber();
+ int32_t GetTotalCodeWords();
+ int32_t GetDimensionForVersion();
+ CBC_CommonBitMatrix *BuildFunctionPattern(int32_t &e);
CFX_Int32Array* GetAlignmentPatternCenters();
CBC_QRCoderECBlocks* GetECBlocksForLevel(CBC_QRCoderErrorCorrectionLevel *ecLevel);
- static CBC_QRCoderVersion* GetVersionForNumber(FX_INT32 versionNumber, FX_INT32 &e);
- static CBC_QRCoderVersion* GetProvisionalVersionForDimension(FX_INT32 dimension, FX_INT32 &e);
- static CBC_QRCoderVersion* DecodeVersionInformation(FX_INT32 versionBits, FX_INT32 &e);
+ static CBC_QRCoderVersion* GetVersionForNumber(int32_t versionNumber, int32_t &e);
+ static CBC_QRCoderVersion* GetProvisionalVersionForDimension(int32_t dimension, int32_t &e);
+ static CBC_QRCoderVersion* DecodeVersionInformation(int32_t versionBits, int32_t &e);
static void Destroy();
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp index 87c14deac9..2877d2f82b 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp @@ -25,7 +25,7 @@ #include "BC_QRCoderECB.h"
#include "BC_QRDataBlock.h"
#include "BC_QRCoderVersion.h"
-CBC_QRDataBlock::CBC_QRDataBlock(FX_INT32 numDataCodewords, CFX_ByteArray *codewords)
+CBC_QRDataBlock::CBC_QRDataBlock(int32_t numDataCodewords, CFX_ByteArray *codewords)
: m_numDataCodewords(numDataCodewords)
, m_codewords(codewords)
{
@@ -37,7 +37,7 @@ CBC_QRDataBlock::~CBC_QRDataBlock() m_codewords = NULL;
}
}
-FX_INT32 CBC_QRDataBlock::GetNumDataCodewords()
+int32_t CBC_QRDataBlock::GetNumDataCodewords()
{
return m_numDataCodewords;
}
@@ -45,47 +45,47 @@ CFX_ByteArray *CBC_QRDataBlock::GetCodewords() {
return m_codewords;
}
-CFX_PtrArray *CBC_QRDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_QRCoderVersion *version, CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 &e)
+CFX_PtrArray *CBC_QRDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_QRCoderVersion *version, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t &e)
{
if(rawCodewords->GetSize() != version->GetTotalCodeWords()) {
e = BCExceptionIllegalArgument;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
CBC_QRCoderECBlocks *ecBlocks = version->GetECBlocksForLevel(ecLevel);
- FX_INT32 totalBlocks = 0;
+ int32_t totalBlocks = 0;
CFX_PtrArray* ecBlockArray = ecBlocks->GetECBlocks();
- FX_INT32 i = 0;
+ int32_t i = 0;
for(i = 0; i < ecBlockArray->GetSize(); i++) {
totalBlocks += ((CBC_QRCoderECB*)(*ecBlockArray)[i])->GetCount();
}
CFX_PtrArray *datablock = FX_NEW CFX_PtrArray();
datablock->SetSize(totalBlocks);
CBC_AutoPtr<CFX_PtrArray > result(datablock);
- FX_INT32 numResultBlocks = 0;
- for(FX_INT32 j = 0; j < ecBlockArray->GetSize(); j++) {
+ int32_t numResultBlocks = 0;
+ for(int32_t j = 0; j < ecBlockArray->GetSize(); j++) {
CBC_QRCoderECB *ecBlock = (CBC_QRCoderECB*)(*ecBlockArray)[j];
- for(FX_INT32 k = 0; k < ecBlock->GetCount(); k++) {
- FX_INT32 numDataCodewords = ecBlock->GetDataCodeWords();
- FX_INT32 numBlockCodewords = ecBlocks->GetECCodeWordsPerBlock() + numDataCodewords;
+ for(int32_t k = 0; k < ecBlock->GetCount(); k++) {
+ int32_t numDataCodewords = ecBlock->GetDataCodeWords();
+ int32_t numBlockCodewords = ecBlocks->GetECCodeWordsPerBlock() + numDataCodewords;
CFX_ByteArray *bytearray = FX_NEW CFX_ByteArray();
bytearray->SetSize(numBlockCodewords);
(*result)[numResultBlocks++] = FX_NEW CBC_QRDataBlock(numDataCodewords, bytearray);
}
}
- FX_INT32 shorterBlocksTotalCodewords = ((CBC_QRDataBlock*)(*result)[0])->m_codewords->GetSize();
- FX_INT32 longerBlocksStartAt = result->GetSize() - 1;
+ int32_t shorterBlocksTotalCodewords = ((CBC_QRDataBlock*)(*result)[0])->m_codewords->GetSize();
+ int32_t longerBlocksStartAt = result->GetSize() - 1;
while(longerBlocksStartAt >= 0) {
- FX_INT32 numCodewords = ((CBC_QRDataBlock*)(*result)[longerBlocksStartAt])->m_codewords->GetSize();
+ int32_t numCodewords = ((CBC_QRDataBlock*)(*result)[longerBlocksStartAt])->m_codewords->GetSize();
if(numCodewords == shorterBlocksTotalCodewords) {
break;
}
longerBlocksStartAt--;
}
longerBlocksStartAt++;
- FX_INT32 shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks->GetECCodeWordsPerBlock();
- FX_INT32 rawCodewordsOffset = 0;
- FX_INT32 x = 0;
- for(FX_INT32 k = 0; k < shorterBlocksNumDataCodewords; k++) {
+ int32_t shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks->GetECCodeWordsPerBlock();
+ int32_t rawCodewordsOffset = 0;
+ int32_t x = 0;
+ for(int32_t k = 0; k < shorterBlocksNumDataCodewords; k++) {
for(x = 0; x < numResultBlocks; x++) {
(*(((CBC_QRDataBlock*)(*result)[x])->m_codewords))[k] = (*rawCodewords)[rawCodewordsOffset++];
}
@@ -93,10 +93,10 @@ CFX_PtrArray *CBC_QRDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_QR for(x = longerBlocksStartAt; x < numResultBlocks; x++) {
(*(((CBC_QRDataBlock*)(*result)[x])->m_codewords))[shorterBlocksNumDataCodewords] = (*rawCodewords)[rawCodewordsOffset++];
}
- FX_INT32 max = ((CBC_QRDataBlock*)(*result)[0])->m_codewords->GetSize();
+ int32_t max = ((CBC_QRDataBlock*)(*result)[0])->m_codewords->GetSize();
for(i = shorterBlocksNumDataCodewords; i < max; i++) {
- for(FX_INT32 y = 0; y < numResultBlocks; y++) {
- FX_INT32 iOffset = y < longerBlocksStartAt ? i : i + 1;
+ for(int32_t y = 0; y < numResultBlocks; y++) {
+ int32_t iOffset = y < longerBlocksStartAt ? i : i + 1;
(*(((CBC_QRDataBlock*)(*result)[y])->m_codewords))[iOffset] = (*rawCodewords)[rawCodewordsOffset++];
}
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h index d5697ff724..4502398e92 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h @@ -13,14 +13,14 @@ class CBC_QRCoderErrorCorrectionLevel; class CBC_QRDataBlock
{
private:
- FX_INT32 m_numDataCodewords;
+ int32_t m_numDataCodewords;
CFX_ByteArray *m_codewords;
- CBC_QRDataBlock(FX_INT32 numDataCodewords, CFX_ByteArray *codewords);
+ CBC_QRDataBlock(int32_t numDataCodewords, CFX_ByteArray *codewords);
public:
virtual ~CBC_QRDataBlock();
- FX_INT32 GetNumDataCodewords();
+ int32_t GetNumDataCodewords();
CFX_ByteArray* GetCodewords();
static CFX_PtrArray *GetDataBlocks(CFX_ByteArray* rawCodewords,
- CBC_QRCoderVersion *version, CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 &e);
+ CBC_QRCoderVersion *version, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp index fd81b20f1b..bfea8e2d4d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp @@ -23,7 +23,7 @@ #include "../barcode.h"
#include "../common/BC_CommonBitMatrix.h"
#include "BC_QRDataMask.h"
-static FX_INT32 N_DATA_MASKS = 0;
+static int32_t N_DATA_MASKS = 0;
CFX_PtrArray* CBC_QRDataMask::DATA_MASKS = NULL;
void CBC_QRDataMask::Initialize()
{
@@ -37,7 +37,7 @@ void CBC_QRDataMask::Finalize() }
void CBC_QRDataMask::Destroy()
{
- FX_INT32 i;
+ int32_t i;
for(i = 0; i < N_DATA_MASKS; i++) {
CBC_QRDataMask* p = (CBC_QRDataMask*)(*DATA_MASKS)[i];
if (p) {
@@ -45,17 +45,17 @@ void CBC_QRDataMask::Destroy() }
}
}
-void CBC_QRDataMask::UnmaskBitMatirx(CBC_CommonBitMatrix *bits, FX_INT32 dimension)
+void CBC_QRDataMask::UnmaskBitMatirx(CBC_CommonBitMatrix *bits, int32_t dimension)
{
- for(FX_INT32 i = 0; i < dimension; i++) {
- for(FX_INT32 j = 0; j < dimension; j++) {
+ for(int32_t i = 0; i < dimension; i++) {
+ for(int32_t j = 0; j < dimension; j++) {
if(IsMasked(i, j)) {
bits->Flip(j, i);
}
}
}
}
-CBC_QRDataMask* CBC_QRDataMask::ForReference(FX_INT32 reference, FX_INT32 &e)
+CBC_QRDataMask* CBC_QRDataMask::ForReference(int32_t reference, int32_t &e)
{
if(reference < 0 || reference > 7) {
e = BCExceptionReferenceMustBeBetween0And7;
@@ -66,7 +66,7 @@ CBC_QRDataMask* CBC_QRDataMask::ForReference(FX_INT32 reference, FX_INT32 &e) class DataMask000 : public CBC_QRDataMask
{
public:
- FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y)
+ FX_BOOL IsMasked(int32_t x, int32_t y)
{
return ((x + y) % 2) == 0;
}
@@ -74,7 +74,7 @@ public: class DataMask001 : public CBC_QRDataMask
{
public:
- FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y)
+ FX_BOOL IsMasked(int32_t x, int32_t y)
{
return (x % 2) == 0;
}
@@ -82,7 +82,7 @@ public: class DataMask010 : public CBC_QRDataMask
{
public:
- FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y)
+ FX_BOOL IsMasked(int32_t x, int32_t y)
{
return y % 3 == 0;
}
@@ -90,7 +90,7 @@ public: class DataMask011 : public CBC_QRDataMask
{
public:
- FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y)
+ FX_BOOL IsMasked(int32_t x, int32_t y)
{
return (x + y) % 3 == 0;
}
@@ -98,7 +98,7 @@ public: class DataMask100 : public CBC_QRDataMask
{
public:
- FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y)
+ FX_BOOL IsMasked(int32_t x, int32_t y)
{
return (((x >> 1) + (y / 3)) % 2) == 0;
}
@@ -106,7 +106,7 @@ public: class DataMask101 : public CBC_QRDataMask
{
public:
- FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y)
+ FX_BOOL IsMasked(int32_t x, int32_t y)
{
size_t temp = x * y;
return (temp % 2) + (temp % 3) == 0;
@@ -115,7 +115,7 @@ public: class DataMask110 : public CBC_QRDataMask
{
public:
- FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y)
+ FX_BOOL IsMasked(int32_t x, int32_t y)
{
size_t temp = x * y;
return (((temp % 2) + (temp % 3)) % 2) == 0;
@@ -124,12 +124,12 @@ public: class DataMask111 : public CBC_QRDataMask
{
public:
- FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y)
+ FX_BOOL IsMasked(int32_t x, int32_t y)
{
return ((((x + y) % 2) + ((x * y) % 3)) % 2) == 0;
}
};
-FX_INT32 CBC_QRDataMask::BuildDataMasks()
+int32_t CBC_QRDataMask::BuildDataMasks()
{
DATA_MASKS->Add(FX_NEW DataMask000);
DATA_MASKS->Add(FX_NEW DataMask001);
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataMask.h b/xfa/src/fxbarcode/qrcode/BC_QRDataMask.h index 221218f34a..79ae4901b6 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataMask.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataMask.h @@ -15,10 +15,10 @@ public: virtual ~CBC_QRDataMask();
static void Initialize();
static void Finalize();
- virtual FX_BOOL IsMasked(FX_INT32 i, FX_INT32 j) = 0;
- void UnmaskBitMatirx(CBC_CommonBitMatrix *bits, FX_INT32 dimension);
- static CBC_QRDataMask* ForReference(FX_INT32 reference, FX_INT32 &e);
- static FX_INT32 BuildDataMasks();
+ virtual FX_BOOL IsMasked(int32_t i, int32_t j) = 0;
+ void UnmaskBitMatirx(CBC_CommonBitMatrix *bits, int32_t dimension);
+ static CBC_QRDataMask* ForReference(int32_t reference, int32_t &e);
+ static int32_t BuildDataMasks();
static void Destroy();
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp index 0fe4d1b2b6..b521222f00 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp @@ -42,7 +42,7 @@ CBC_QRDecodedBitStreamParser::~CBC_QRDecodedBitStreamParser() {
}
CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *bytes, CBC_QRCoderVersion *version,
- CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 byteModeDecode, FX_INT32 &e)
+ CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t byteModeDecode, int32_t &e)
{
CBC_CommonBitSource bits(bytes);
CFX_ByteString result;
@@ -54,7 +54,7 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt if(bits.Available() < 4) {
mode = CBC_QRCoderMode::sTERMINATOR;
} else {
- FX_INT32 iTemp1 = bits.ReadBits(4, e);
+ int32_t iTemp1 = bits.ReadBits(4, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
mode = CBC_QRCoderMode::ForBits(iTemp1, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -70,7 +70,7 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt bits.ReadBits(16, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
} else if(mode == CBC_QRCoderMode::sECI) {
- FX_INT32 value = ParseECIValue(&bits, e);
+ int32_t value = ParseECIValue(&bits, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
currentCharacterSetECI = CBC_CommonCharacterSetECI::GetCharacterSetECIByValue(value);
} else {
@@ -78,9 +78,9 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt bits.ReadBits(4, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
- FX_INT32 numBits = mode->GetCharacterCountBits(version, e);
+ int32_t numBits = mode->GetCharacterCountBits(version, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 count = bits.ReadBits(numBits, e);
+ int32_t count = bits.ReadBits(numBits, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
if(mode == CBC_QRCoderMode::sNUMERIC) {
DecodeNumericSegment(&bits, result, count, e);
@@ -109,46 +109,46 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return tempCd;
}
-void CBC_QRDecodedBitStreamParser::DecodeGBKSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e)
+void CBC_QRDecodedBitStreamParser::DecodeGBKSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e)
{
CFX_ByteString buffer;
- FX_INT32 offset = 0;
+ int32_t offset = 0;
while (count > 0) {
- FX_INT32 twoBytes = bits->ReadBits(13, e);
+ int32_t twoBytes = bits->ReadBits(13, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x060);
+ int32_t assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x060);
if (assembledTwoBytes <= 0x0095d) {
assembledTwoBytes += 0x0a1a1;
} else {
assembledTwoBytes += 0x0a6a1;
}
- buffer += (FX_BYTE) (assembledTwoBytes >> 8);
- buffer += (FX_BYTE) assembledTwoBytes;
+ buffer += (uint8_t) (assembledTwoBytes >> 8);
+ buffer += (uint8_t) assembledTwoBytes;
count--;
}
CBC_UtilCodingConvert::LocaleToUtf8(buffer, result);
}
-void CBC_QRDecodedBitStreamParser::DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e)
+void CBC_QRDecodedBitStreamParser::DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e)
{
CFX_ByteString buffer;
while (count > 0) {
- FX_INT32 twoBytes = bits->ReadBits(13, e);
+ int32_t twoBytes = bits->ReadBits(13, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
- FX_INT32 assembledTwoBytes = ((twoBytes / 0x0c0) << 8) | (twoBytes % 0x0c0);
+ int32_t assembledTwoBytes = ((twoBytes / 0x0c0) << 8) | (twoBytes % 0x0c0);
if (assembledTwoBytes <= 0x01f00) {
assembledTwoBytes += 0x08140;
} else {
assembledTwoBytes += 0x0c140;
}
- buffer += (FX_BYTE) (assembledTwoBytes >> 8);
- buffer += (FX_BYTE) assembledTwoBytes;
+ buffer += (uint8_t) (assembledTwoBytes >> 8);
+ buffer += (uint8_t) assembledTwoBytes;
count--;
}
CBC_UtilCodingConvert::LocaleToUtf8(buffer, result);
}
-void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count,
+void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count,
CBC_CommonCharacterSetECI *currentCharacterSetECI,
- CFX_Int32Array *byteSegments, FX_INT32 byteModeDecode, FX_INT32 &e)
+ CFX_Int32Array *byteSegments, int32_t byteModeDecode, int32_t &e)
{
if(count < 0) {
e = BCExceptionNotFound;
@@ -158,10 +158,10 @@ void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, e = BCExceptionRead;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
- FX_BYTE *readBytes = FX_Alloc(FX_BYTE, count);
+ uint8_t *readBytes = FX_Alloc(uint8_t, count);
FXSYS_memset32(readBytes, 0x00, count);
- for(FX_INT32 i = 0; i < count; i++) {
- readBytes[i] = (FX_BYTE) bits->ReadBits(8, e);
+ for(int32_t i = 0; i < count; i++) {
+ readBytes[i] = (uint8_t) bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
CFX_ByteString bs(readBytes, count);
@@ -169,23 +169,23 @@ void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, FX_Free(readBytes);
}
void CBC_QRDecodedBitStreamParser::DecodeAlphanumericSegment(CBC_CommonBitSource* bits,
- CFX_ByteString &result, FX_INT32 count, FX_BOOL fac1InEffect, FX_INT32 &e)
+ CFX_ByteString &result, int32_t count, FX_BOOL fac1InEffect, int32_t &e)
{
- FX_INT32 start = result.GetLength();
+ int32_t start = result.GetLength();
while(count > 1) {
- FX_INT32 nextTwoCharsBits = bits->ReadBits(11, e);
+ int32_t nextTwoCharsBits = bits->ReadBits(11, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[nextTwoCharsBits / 45]);
BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[nextTwoCharsBits % 45]);
count -= 2;
}
if(count == 1) {
- FX_INT32 itemp = bits->ReadBits(6, e);
+ int32_t itemp = bits->ReadBits(6, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[itemp]);
}
if(fac1InEffect) {
- for(FX_INT32 i = start; i < result.GetLength(); i++) {
+ for(int32_t i = start; i < result.GetLength(); i++) {
if(result[i] == '%') {
if((i < result.GetLength() - 1) && result[i + 1] == '%') {
result.Delete(i + 1, 1);
@@ -196,10 +196,10 @@ void CBC_QRDecodedBitStreamParser::DecodeAlphanumericSegment(CBC_CommonBitSource }
}
}
-void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e)
+void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e)
{
while(count >= 3) {
- FX_INT32 threeDigitsBits = bits->ReadBits(10, e);
+ int32_t threeDigitsBits = bits->ReadBits(10, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if(threeDigitsBits >= 1000) {
e = BCExceptionRead;
@@ -211,7 +211,7 @@ void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bit count -= 3;
}
if(count == 2) {
- FX_INT32 twoDigitBits = bits->ReadBits(7, e);
+ int32_t twoDigitBits = bits->ReadBits(7, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if(twoDigitBits >= 100) {
e = BCExceptionRead;
@@ -220,7 +220,7 @@ void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bit BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[twoDigitBits / 10]);
BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[twoDigitBits % 10]);
} else if(count == 1) {
- FX_INT32 digitBits = bits->ReadBits(4, e);
+ int32_t digitBits = bits->ReadBits(4, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
if(digitBits >= 10) {
e = BCExceptionRead;
@@ -233,18 +233,18 @@ const CFX_ByteString CBC_QRDecodedBitStreamParser::GuessEncoding(CFX_ByteArray * {
return *UTF_8;
}
-FX_INT32 CBC_QRDecodedBitStreamParser::ParseECIValue(CBC_CommonBitSource* bits, FX_INT32 &e)
+int32_t CBC_QRDecodedBitStreamParser::ParseECIValue(CBC_CommonBitSource* bits, int32_t &e)
{
- FX_INT32 firstByte = bits->ReadBits(8, e);
+ int32_t firstByte = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
if((firstByte & 0x80) == 0) {
return firstByte & 0x7f;
} else if((firstByte & 0xc0) == 0x80) {
- FX_INT32 secondByte = bits->ReadBits(8, e);
+ int32_t secondByte = bits->ReadBits(8, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
return ((firstByte & 0x3f) << 8) | secondByte;
} else if((firstByte & 0xe0) == 0xc0) {
- FX_INT32 secondThirdByte = bits->ReadBits(16, e);
+ int32_t secondThirdByte = bits->ReadBits(16, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
return ((firstByte & 0x1f) << 16) | secondThirdByte;
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h b/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h index f4ac06b984..d607e72da8 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h @@ -20,15 +20,15 @@ private: public:
virtual ~CBC_QRDecodedBitStreamParser();
static CBC_CommonDecoderResult* Decode(CFX_ByteArray *bytes, CBC_QRCoderVersion *version,
- CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 byteModeDecode, FX_INT32 &e);
+ CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t byteModeDecode, int32_t &e);
static const CFX_ByteString GuessEncoding(CFX_ByteArray* bytes);
- static FX_INT32 ParseECIValue(CBC_CommonBitSource* bits, FX_INT32 &e);
- static void DecodeGBKSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e);
- static void DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e);
- static void DecodeNumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e);
- static void DecodeAlphanumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_BOOL fac1InEffect, FX_INT32 &e);
- static void DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, CBC_CommonCharacterSetECI *currentCharacterSetECI,
- CFX_Int32Array *byteSegments, FX_INT32 byteModeDecode, FX_INT32 &e);
+ static int32_t ParseECIValue(CBC_CommonBitSource* bits, int32_t &e);
+ static void DecodeGBKSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e);
+ static void DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e);
+ static void DecodeNumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e);
+ static void DecodeAlphanumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, FX_BOOL fac1InEffect, int32_t &e);
+ static void DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, CBC_CommonCharacterSetECI *currentCharacterSetECI,
+ CFX_Int32Array *byteSegments, int32_t byteModeDecode, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp index 01d90832b9..0b75da7bec 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp @@ -37,7 +37,7 @@ CBC_QRDetector::CBC_QRDetector(CBC_CommonBitMatrix *image): m_image(image) CBC_QRDetector::~CBC_QRDetector()
{
}
-CBC_QRDetectorResult *CBC_QRDetector::Detect(FX_INT32 hints, FX_INT32 &e)
+CBC_QRDetectorResult *CBC_QRDetector::Detect(int32_t hints, int32_t &e)
{
CBC_QRFinderPatternFinder finder(m_image);
CBC_QRFinderPatternInfo* qpi = finder.Find(hints, e);
@@ -47,7 +47,7 @@ CBC_QRDetectorResult *CBC_QRDetector::Detect(FX_INT32 hints, FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return qdr;
}
-CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(CBC_QRFinderPatternInfo *info, FX_INT32 &e)
+CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(CBC_QRFinderPatternInfo *info, int32_t &e)
{
CBC_AutoPtr<CBC_QRFinderPattern> topLeft(info->GetTopLeft());
CBC_AutoPtr<CBC_QRFinderPattern> topRight(info->GetTopRight());
@@ -57,21 +57,21 @@ CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(CBC_QRFinderPatte e = BCExceptionRead;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
- FX_INT32 dimension = ComputeDimension(topLeft.get(), topRight.get(), bottomLeft.get(), moduleSize, e);
+ int32_t dimension = ComputeDimension(topLeft.get(), topRight.get(), bottomLeft.get(), moduleSize, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_QRCoderVersion *provisionalVersion = CBC_QRCoderVersion::GetProvisionalVersionForDimension(dimension, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 modulesBetweenFPCenters = provisionalVersion->GetDimensionForVersion() - 7;
+ int32_t modulesBetweenFPCenters = provisionalVersion->GetDimensionForVersion() - 7;
CBC_QRAlignmentPattern * alignmentPattern = NULL;
if(provisionalVersion->GetAlignmentPatternCenters()->GetSize() > 0) {
FX_FLOAT bottomRightX = topRight->GetX() - topLeft->GetX() + bottomLeft->GetX();
FX_FLOAT bottomRightY = topRight->GetY() - topLeft->GetY() + bottomLeft->GetY();
FX_FLOAT correctionToTopLeft = 1.0f - 3.0f / (FX_FLOAT) modulesBetweenFPCenters;
FX_FLOAT xtemp = (topLeft->GetX() + correctionToTopLeft * (bottomRightX - topLeft->GetX()));
- FX_INT32 estAlignmentX = (FX_INT32)xtemp ;
+ int32_t estAlignmentX = (int32_t)xtemp ;
FX_FLOAT ytemp = (topLeft->GetY() + correctionToTopLeft * (bottomRightY - topLeft->GetY()));
- FX_INT32 estAlignmentY = (FX_INT32)ytemp;
- for(FX_INT32 i = 4; i <= 16; i <<= 1) {
+ int32_t estAlignmentY = (int32_t)ytemp;
+ for(int32_t i = 4; i <= 16; i <<= 1) {
CBC_QRAlignmentPattern *temp = FindAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, (FX_FLOAT) i, e);
alignmentPattern = temp;
break;
@@ -94,7 +94,7 @@ CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(CBC_QRFinderPatte }
CBC_CommonBitMatrix *CBC_QRDetector::SampleGrid(CBC_CommonBitMatrix *image, CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight,
CBC_ResultPoint *bottomLeft, CBC_ResultPoint* alignmentPattern,
- FX_INT32 dimension, FX_INT32 &e)
+ int32_t dimension, int32_t &e)
{
FX_FLOAT dimMinusThree = (FX_FLOAT) dimension - 3.5f;
FX_FLOAT bottomRightX;
@@ -132,12 +132,12 @@ CBC_CommonBitMatrix *CBC_QRDetector::SampleGrid(CBC_CommonBitMatrix *image, CBC_ BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return cbm;
}
-FX_INT32 CBC_QRDetector::ComputeDimension(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight,
- CBC_ResultPoint *bottomLeft, FX_FLOAT moduleSize, FX_INT32 &e)
+int32_t CBC_QRDetector::ComputeDimension(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight,
+ CBC_ResultPoint *bottomLeft, FX_FLOAT moduleSize, int32_t &e)
{
- FX_INT32 tltrCentersDimension = Round(CBC_QRFinderPatternFinder::Distance(topLeft, topRight) / moduleSize);
- FX_INT32 tlblCentersDimension = Round(CBC_QRFinderPatternFinder::Distance(topLeft, bottomLeft) / moduleSize);
- FX_INT32 dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;
+ int32_t tltrCentersDimension = Round(CBC_QRFinderPatternFinder::Distance(topLeft, topRight) / moduleSize);
+ int32_t tlblCentersDimension = Round(CBC_QRFinderPatternFinder::Distance(topLeft, bottomLeft) / moduleSize);
+ int32_t dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;
switch(dimension & 0x03) {
case 0:
dimension++;
@@ -158,14 +158,14 @@ FX_FLOAT CBC_QRDetector::CalculateModuleSize(CBC_ResultPoint *topLeft, CBC_Resul }
FX_FLOAT CBC_QRDetector::CalculateModuleSizeOneWay(CBC_ResultPoint *pattern, CBC_ResultPoint *otherPattern)
{
- FX_FLOAT moduleSizeEst1 = SizeOfBlackWhiteBlackRunBothWays((FX_INT32) pattern->GetX(),
- (FX_INT32) pattern->GetY(),
- (FX_INT32) otherPattern->GetX(),
- (FX_INT32) otherPattern->GetY());
- FX_FLOAT moduleSizeEst2 = SizeOfBlackWhiteBlackRunBothWays((FX_INT32) otherPattern->GetX(),
- (FX_INT32) otherPattern->GetY(),
- (FX_INT32) pattern->GetX(),
- (FX_INT32) pattern->GetY());
+ FX_FLOAT moduleSizeEst1 = SizeOfBlackWhiteBlackRunBothWays((int32_t) pattern->GetX(),
+ (int32_t) pattern->GetY(),
+ (int32_t) otherPattern->GetX(),
+ (int32_t) otherPattern->GetY());
+ FX_FLOAT moduleSizeEst2 = SizeOfBlackWhiteBlackRunBothWays((int32_t) otherPattern->GetX(),
+ (int32_t) otherPattern->GetY(),
+ (int32_t) pattern->GetX(),
+ (int32_t) pattern->GetY());
if (FXSYS_isnan(moduleSizeEst1)) {
return moduleSizeEst2;
}
@@ -174,20 +174,20 @@ FX_FLOAT CBC_QRDetector::CalculateModuleSizeOneWay(CBC_ResultPoint *pattern, CBC }
return (moduleSizeEst1 + moduleSizeEst2) / 14.0f;
}
-FX_INT32 CBC_QRDetector::Round(FX_FLOAT d)
+int32_t CBC_QRDetector::Round(FX_FLOAT d)
{
- return (FX_INT32)(d + 0.5f);
+ return (int32_t)(d + 0.5f);
}
-FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRunBothWays(FX_INT32 fromX, FX_INT32 fromY, FX_INT32 toX, FX_INT32 toY)
+FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRunBothWays(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY)
{
FX_FLOAT result = SizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);
- FX_INT32 otherToX = fromX - (toX - fromX);
+ int32_t otherToX = fromX - (toX - fromX);
if (otherToX < 0) {
otherToX = -1;
} else if (otherToX >= m_image->GetWidth()) {
otherToX = m_image->GetWidth();
}
- FX_INT32 otherToY = fromY - (toY - fromY);
+ int32_t otherToY = fromY - (toY - fromY);
if (otherToY < 0) {
otherToY = -1;
} else if (otherToY >= m_image->GetHeight()) {
@@ -196,26 +196,26 @@ FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRunBothWays(FX_INT32 fromX, FX_INT result += SizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);
return result - 1.0f;
}
-FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRun(FX_INT32 fromX, FX_INT32 fromY, FX_INT32 toX, FX_INT32 toY)
+FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRun(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY)
{
FX_BOOL steep = FXSYS_abs(toY - fromY) > FXSYS_abs(toX - fromX);
if (steep) {
- FX_INT32 temp = fromX;
+ int32_t temp = fromX;
fromX = fromY;
fromY = temp;
temp = toX;
toX = toY;
toY = temp;
}
- FX_INT32 dx = FXSYS_abs(toX - fromX);
- FX_INT32 dy = FXSYS_abs(toY - fromY);
- FX_INT32 error = -dx >> 1;
- FX_INT32 ystep = fromY < toY ? 1 : -1;
- FX_INT32 xstep = fromX < toX ? 1 : -1;
- FX_INT32 state = 0;
- for (FX_INT32 x = fromX, y = fromY; x != toX; x += xstep) {
- FX_INT32 realX = steep ? y : x;
- FX_INT32 realY = steep ? x : y;
+ int32_t dx = FXSYS_abs(toX - fromX);
+ int32_t dy = FXSYS_abs(toY - fromY);
+ int32_t error = -dx >> 1;
+ int32_t ystep = fromY < toY ? 1 : -1;
+ int32_t xstep = fromX < toX ? 1 : -1;
+ int32_t state = 0;
+ for (int32_t x = fromX, y = fromY; x != toX; x += xstep) {
+ int32_t realX = steep ? y : x;
+ int32_t realY = steep ? x : y;
if (state == 1) {
if (m_image->Get(realX, realY)) {
state++;
@@ -226,8 +226,8 @@ FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRun(FX_INT32 fromX, FX_INT32 fromY }
}
if (state == 3) {
- FX_INT32 diffX = x - fromX;
- FX_INT32 diffY = y - fromY;
+ int32_t diffX = x - fromX;
+ int32_t diffY = y - fromY;
return (FX_FLOAT) sqrt((double) (diffX * diffX + diffY * diffY));
}
error += dy;
@@ -236,22 +236,22 @@ FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRun(FX_INT32 fromX, FX_INT32 fromY error -= dx;
}
}
- FX_INT32 diffX = toX - fromX;
- FX_INT32 diffY = toY - fromY;
+ int32_t diffX = toX - fromX;
+ int32_t diffY = toY - fromY;
return (FX_FLOAT) sqrt((double) (diffX * diffX + diffY * diffY));
}
-CBC_QRAlignmentPattern *CBC_QRDetector::FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, FX_INT32 estAlignmentX,
- FX_INT32 estAlignmentY, FX_FLOAT allowanceFactor, FX_INT32 &e)
+CBC_QRAlignmentPattern *CBC_QRDetector::FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, int32_t estAlignmentX,
+ int32_t estAlignmentY, FX_FLOAT allowanceFactor, int32_t &e)
{
- FX_INT32 allowance = (FX_INT32) (allowanceFactor * overallEstModuleSize);
- FX_INT32 alignmentAreaLeftX = FX_MAX(0, estAlignmentX - allowance);
- FX_INT32 alignmentAreaRightX = FX_MIN(m_image->GetWidth() - 1, estAlignmentX + allowance);
+ int32_t allowance = (int32_t) (allowanceFactor * overallEstModuleSize);
+ int32_t alignmentAreaLeftX = FX_MAX(0, estAlignmentX - allowance);
+ int32_t alignmentAreaRightX = FX_MIN(m_image->GetWidth() - 1, estAlignmentX + allowance);
if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) {
e = BCExceptionRead;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
- FX_INT32 alignmentAreaTopY = FX_MAX(0, estAlignmentY - allowance);
- FX_INT32 alignmentAreaBottomY = FX_MIN(m_image->GetHeight() - 1, estAlignmentY + allowance);
+ int32_t alignmentAreaTopY = FX_MAX(0, estAlignmentY - allowance);
+ int32_t alignmentAreaBottomY = FX_MIN(m_image->GetHeight() - 1, estAlignmentY + allowance);
CBC_QRAlignmentPatternFinder alignmentFinder(m_image,
alignmentAreaLeftX,
alignmentAreaTopY,
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetector.h b/xfa/src/fxbarcode/qrcode/BC_QRDetector.h index 60c301cb7b..298ccf4d4c 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDetector.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDetector.h @@ -26,16 +26,16 @@ public: virtual ~CBC_QRDetector();
CBC_CommonBitMatrix* GetImage();
- CBC_QRDetectorResult* Detect(FX_INT32 hints, FX_INT32 &e);
- CBC_QRDetectorResult* ProcessFinderPatternInfo(CBC_QRFinderPatternInfo *info, FX_INT32 &e);
+ CBC_QRDetectorResult* Detect(int32_t hints, int32_t &e);
+ CBC_QRDetectorResult* ProcessFinderPatternInfo(CBC_QRFinderPatternInfo *info, int32_t &e);
FX_FLOAT CalculateModuleSize(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, CBC_ResultPoint *bottomLeft);
FX_FLOAT CalculateModuleSizeOneWay(CBC_ResultPoint *pattern, CBC_ResultPoint *otherPattern);
- FX_FLOAT SizeOfBlackWhiteBlackRunBothWays(FX_INT32 fromX, FX_INT32 fromY, FX_INT32 toX, FX_INT32 toY);
- FX_FLOAT SizeOfBlackWhiteBlackRun(FX_INT32 fromX, FX_INT32 fromY, FX_INT32 toX, FX_INT32 toY);
- CBC_QRAlignmentPattern* FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, FX_INT32 estAlignmentX, FX_INT32 estAlignmentY, FX_FLOAT allowanceFactor, FX_INT32 &e);
- static FX_INT32 Round(FX_FLOAT d);
- static FX_INT32 ComputeDimension(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, CBC_ResultPoint *bottomLeft, FX_FLOAT moduleSize, FX_INT32 &e);
+ FX_FLOAT SizeOfBlackWhiteBlackRunBothWays(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY);
+ FX_FLOAT SizeOfBlackWhiteBlackRun(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY);
+ CBC_QRAlignmentPattern* FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, int32_t estAlignmentX, int32_t estAlignmentY, FX_FLOAT allowanceFactor, int32_t &e);
+ static int32_t Round(FX_FLOAT d);
+ static int32_t ComputeDimension(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, CBC_ResultPoint *bottomLeft, FX_FLOAT moduleSize, int32_t &e);
static CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix *image, CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight,
- CBC_ResultPoint *bottomLeft, CBC_ResultPoint* alignmentPattern, FX_INT32 dimension, FX_INT32 &e);
+ CBC_ResultPoint *bottomLeft, CBC_ResultPoint* alignmentPattern, int32_t dimension, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp index 369dc3a527..3734fab24d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp @@ -30,7 +30,7 @@ CBC_QRDetectorResult::CBC_QRDetectorResult(CBC_CommonBitMatrix *bits, CFX_PtrArr }
CBC_QRDetectorResult::~CBC_QRDetectorResult()
{
- for(FX_INT32 i = 0; i < m_points->GetSize(); i++) {
+ for(int32_t i = 0; i < m_points->GetSize(); i++) {
delete (CBC_ResultPoint*) (*m_points)[i];
}
m_points->RemoveAll();
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp b/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp index 8d1385e99a..dc08fc1e77 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp @@ -45,7 +45,7 @@ FX_FLOAT CBC_QRFinderPattern::GetEstimatedModuleSize() {
return m_estimatedModuleSize;
}
-FX_INT32 CBC_QRFinderPattern::GetCount()
+int32_t CBC_QRFinderPattern::GetCount()
{
return m_count;
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h b/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h index af88a727d9..919b0c1534 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h @@ -12,12 +12,12 @@ class CBC_QRFinderPattern : public CBC_ResultPoint {
private:
FX_FLOAT m_estimatedModuleSize;
- FX_INT32 m_count;
+ int32_t m_count;
public:
CBC_QRFinderPattern(FX_FLOAT x, FX_FLOAT posY, FX_FLOAT estimatedModuleSize);
virtual ~CBC_QRFinderPattern();
- FX_INT32 GetCount();
+ int32_t GetCount();
FX_FLOAT GetX();
FX_FLOAT GetY();
FX_FLOAT GetEstimatedModuleSize();
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp index da2d1231f8..975776db3f 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp @@ -26,10 +26,10 @@ #include "BC_QRFinderPatternFinder.h"
#include "BC_FinderPatternInfo.h"
#include "BC_QRFinderPattern.h"
-const FX_INT32 CBC_QRFinderPatternFinder::CENTER_QUORUM = 2;
-const FX_INT32 CBC_QRFinderPatternFinder::MIN_SKIP = 3;
-const FX_INT32 CBC_QRFinderPatternFinder::MAX_MODULES = 57;
-const FX_INT32 CBC_QRFinderPatternFinder::INTEGER_MATH_SHIFT = 8;
+const int32_t CBC_QRFinderPatternFinder::CENTER_QUORUM = 2;
+const int32_t CBC_QRFinderPatternFinder::MIN_SKIP = 3;
+const int32_t CBC_QRFinderPatternFinder::MAX_MODULES = 57;
+const int32_t CBC_QRFinderPatternFinder::INTEGER_MATH_SHIFT = 8;
CBC_QRFinderPatternFinder::CBC_QRFinderPatternFinder(CBC_CommonBitMatrix* image)
{
m_image = image;
@@ -38,7 +38,7 @@ CBC_QRFinderPatternFinder::CBC_QRFinderPatternFinder(CBC_CommonBitMatrix* image) }
CBC_QRFinderPatternFinder::~CBC_QRFinderPatternFinder()
{
- for(FX_INT32 i = 0; i < m_possibleCenters.GetSize(); i++) {
+ for(int32_t i = 0; i < m_possibleCenters.GetSize(); i++) {
delete (CBC_QRFinderPattern*)m_possibleCenters[i];
}
m_possibleCenters.RemoveAll();
@@ -51,7 +51,7 @@ public: ClosestToAverageComparator(FX_FLOAT averageModuleSize) : m_averageModuleSize(averageModuleSize)
{
}
- FX_INT32 operator()(FinderPattern *a, FinderPattern *b)
+ int32_t operator()(FinderPattern *a, FinderPattern *b)
{
FX_FLOAT dA = (FX_FLOAT)fabs(a->GetEstimatedModuleSize() - m_averageModuleSize);
FX_FLOAT dB = (FX_FLOAT)fabs(b->GetEstimatedModuleSize() - m_averageModuleSize);
@@ -61,7 +61,7 @@ public: class CenterComparator
{
public:
- FX_INT32 operator()(FinderPattern *a, FinderPattern *b)
+ int32_t operator()(FinderPattern *a, FinderPattern *b)
{
return b->GetCount() - a->GetCount();
}
@@ -83,25 +83,25 @@ CFX_PtrArray *CBC_QRFinderPatternFinder::GetPossibleCenters() {
return &m_possibleCenters;
}
-CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(FX_INT32 hint, FX_INT32 &e)
+CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(int32_t hint, int32_t &e)
{
- FX_INT32 maxI = m_image->GetHeight();
- FX_INT32 maxJ = m_image->GetWidth();
- FX_INT32 iSkip = (3 * maxI) / (4 * MAX_MODULES);
+ int32_t maxI = m_image->GetHeight();
+ int32_t maxJ = m_image->GetWidth();
+ int32_t iSkip = (3 * maxI) / (4 * MAX_MODULES);
if(iSkip < MIN_SKIP || 0) {
iSkip = MIN_SKIP;
}
FX_BOOL done = FALSE;
CFX_Int32Array stateCount;
stateCount.SetSize(5);
- for(FX_INT32 i = iSkip - 1; i < maxI && !done; i += iSkip) {
+ for(int32_t i = iSkip - 1; i < maxI && !done; i += iSkip) {
stateCount[0] = 0;
stateCount[1] = 0;
stateCount[2] = 0;
stateCount[3] = 0;
stateCount[4] = 0;
- FX_INT32 currentState = 0;
- for(FX_INT32 j = 0; j < maxJ; j++) {
+ int32_t currentState = 0;
+ for(int32_t j = 0; j < maxJ; j++) {
if(m_image->Get(j, i)) {
if((currentState & 1) == 1) {
currentState++;
@@ -117,7 +117,7 @@ CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(FX_INT32 hint, FX_INT32 if(m_hasSkipped) {
done = HaveMultiplyConfirmedCenters();
} else {
- FX_INT32 rowSkip = FindRowSkip();
+ int32_t rowSkip = FindRowSkip();
if(rowSkip > stateCount[2]) {
i += rowSkip - stateCount[2] - iSkip;
j = maxJ - 1;
@@ -202,15 +202,15 @@ FX_FLOAT CBC_QRFinderPatternFinder::Distance(CBC_ResultPoint* point1, CBC_Result FX_FLOAT dy = point1->GetY() - point2->GetY();
return (FX_FLOAT)FXSYS_sqrt(dx * dx + dy * dy);
}
-FX_FLOAT CBC_QRFinderPatternFinder::CenterFromEnd(const CFX_Int32Array &stateCount, FX_INT32 end)
+FX_FLOAT CBC_QRFinderPatternFinder::CenterFromEnd(const CFX_Int32Array &stateCount, int32_t end)
{
return (FX_FLOAT)(end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0f;
}
FX_BOOL CBC_QRFinderPatternFinder::FoundPatternCross(const CFX_Int32Array &stateCount)
{
- FX_INT32 totalModuleSize = 0;
- for (FX_INT32 i = 0; i < 5; i++) {
- FX_INT32 count = stateCount[i];
+ int32_t totalModuleSize = 0;
+ for (int32_t i = 0; i < 5; i++) {
+ int32_t count = stateCount[i];
if (count == 0) {
return FALSE;
}
@@ -219,21 +219,21 @@ FX_BOOL CBC_QRFinderPatternFinder::FoundPatternCross(const CFX_Int32Array &state if (totalModuleSize < 7) {
return FALSE;
}
- FX_INT32 moduleSize = (totalModuleSize << INTEGER_MATH_SHIFT) / 7;
- FX_INT32 maxVariance = moduleSize / 2;
+ int32_t moduleSize = (totalModuleSize << INTEGER_MATH_SHIFT) / 7;
+ int32_t maxVariance = moduleSize / 2;
return FXSYS_abs(moduleSize - (stateCount[0] << INTEGER_MATH_SHIFT)) < maxVariance &&
FXSYS_abs(moduleSize - (stateCount[1] << INTEGER_MATH_SHIFT)) < maxVariance &&
FXSYS_abs(3 * moduleSize - (stateCount[2] << INTEGER_MATH_SHIFT)) < 3 * maxVariance &&
FXSYS_abs(moduleSize - (stateCount[3] << INTEGER_MATH_SHIFT)) < maxVariance &&
FXSYS_abs(moduleSize - (stateCount[4] << INTEGER_MATH_SHIFT)) < maxVariance;
}
-FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckVertical(FX_INT32 startI, FX_INT32 centerJ, FX_INT32 maxCount,
- FX_INT32 originalStateCountTotal)
+FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckVertical(int32_t startI, int32_t centerJ, int32_t maxCount,
+ int32_t originalStateCountTotal)
{
CBC_CommonBitMatrix *image = m_image;
- FX_INT32 maxI = image->GetHeight();
+ int32_t maxI = image->GetHeight();
CFX_Int32Array &stateCount = GetCrossCheckStateCount();
- FX_INT32 i = startI;
+ int32_t i = startI;
while(i >= 0 && image->Get(centerJ, i)) {
stateCount[2]++;
i--;
@@ -277,18 +277,18 @@ FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckVertical(FX_INT32 startI, FX_INT32 if (stateCount[4] >= maxCount) {
return FXSYS_nan();
}
- FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
+ int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
if (5 * FXSYS_abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) {
return FXSYS_nan();
}
return FoundPatternCross(stateCount) ? CenterFromEnd(stateCount, i) : FXSYS_nan();
}
-FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckHorizontal(FX_INT32 startJ, FX_INT32 centerI, FX_INT32 maxCount, FX_INT32 originalStateCountTotal)
+FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckHorizontal(int32_t startJ, int32_t centerI, int32_t maxCount, int32_t originalStateCountTotal)
{
CBC_CommonBitMatrix *image = m_image;
- FX_INT32 maxJ = image->GetWidth();
+ int32_t maxJ = image->GetWidth();
CFX_Int32Array &stateCount = GetCrossCheckStateCount();
- FX_INT32 j = startJ;
+ int32_t j = startJ;
while (j >= 0 && image->Get(j, centerI)) {
stateCount[2]++;
j--;
@@ -332,7 +332,7 @@ FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckHorizontal(FX_INT32 startJ, FX_INT if (stateCount[4] >= maxCount) {
return FXSYS_nan();
}
- FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] +
+ int32_t stateCountTotal = stateCount[0] + stateCount[1] +
stateCount[2] + stateCount[3] +
stateCount[4];
if (5 * FXSYS_abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) {
@@ -340,18 +340,18 @@ FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckHorizontal(FX_INT32 startJ, FX_INT }
return FoundPatternCross(stateCount) ? CenterFromEnd(stateCount, j) : FXSYS_nan();
}
-FX_BOOL CBC_QRFinderPatternFinder::HandlePossibleCenter(const CFX_Int32Array &stateCount, FX_INT32 i, FX_INT32 j)
+FX_BOOL CBC_QRFinderPatternFinder::HandlePossibleCenter(const CFX_Int32Array &stateCount, int32_t i, int32_t j)
{
- FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
+ int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
FX_FLOAT centerJ = CenterFromEnd(stateCount, j);
- FX_FLOAT centerI = CrossCheckVertical(i, (FX_INT32) centerJ, stateCount[2], stateCountTotal);
+ FX_FLOAT centerI = CrossCheckVertical(i, (int32_t) centerJ, stateCount[2], stateCountTotal);
if(!FXSYS_isnan(centerI)) {
- centerJ = CrossCheckHorizontal((FX_INT32) centerJ, (FX_INT32) centerI, stateCount[2], stateCountTotal);
+ centerJ = CrossCheckHorizontal((int32_t) centerJ, (int32_t) centerI, stateCount[2], stateCountTotal);
if(!FXSYS_isnan(centerJ)) {
FX_FLOAT estimatedModuleSize = (FX_FLOAT) stateCountTotal / 7.0f;
FX_BOOL found = FALSE;
- FX_INT32 max = m_possibleCenters.GetSize();
- for(FX_INT32 index = 0; index < max; index++) {
+ int32_t max = m_possibleCenters.GetSize();
+ for(int32_t index = 0; index < max; index++) {
CBC_QRFinderPattern *center = (CBC_QRFinderPattern*)(m_possibleCenters[index]);
if(center->AboutEquals(estimatedModuleSize, centerI, centerJ)) {
center->IncrementCount();
@@ -367,21 +367,21 @@ FX_BOOL CBC_QRFinderPatternFinder::HandlePossibleCenter(const CFX_Int32Array &st }
return FALSE;
}
-FX_INT32 CBC_QRFinderPatternFinder::FindRowSkip()
+int32_t CBC_QRFinderPatternFinder::FindRowSkip()
{
- FX_INT32 max = m_possibleCenters.GetSize();
+ int32_t max = m_possibleCenters.GetSize();
if (max <= 1) {
return 0;
}
FinderPattern *firstConfirmedCenter = NULL;
- for (FX_INT32 i = 0; i < max; i++) {
+ for (int32_t i = 0; i < max; i++) {
CBC_QRFinderPattern *center = (CBC_QRFinderPattern*)m_possibleCenters[i];
if (center->GetCount() >= CENTER_QUORUM) {
if (firstConfirmedCenter == NULL) {
firstConfirmedCenter = center;
} else {
m_hasSkipped = TRUE;
- return (FX_INT32) ((fabs(firstConfirmedCenter->GetX() - center->GetX()) -
+ return (int32_t) ((fabs(firstConfirmedCenter->GetX() - center->GetX()) -
fabs(firstConfirmedCenter->GetY() - center->GetY())) / 2);
}
}
@@ -390,10 +390,10 @@ FX_INT32 CBC_QRFinderPatternFinder::FindRowSkip() }
FX_BOOL CBC_QRFinderPatternFinder::HaveMultiplyConfirmedCenters()
{
- FX_INT32 confirmedCount = 0;
+ int32_t confirmedCount = 0;
FX_FLOAT totalModuleSize = 0.0f;
- FX_INT32 max = m_possibleCenters.GetSize();
- FX_INT32 i;
+ int32_t max = m_possibleCenters.GetSize();
+ int32_t i;
for (i = 0; i < max; i++) {
CBC_QRFinderPattern *pattern = (CBC_QRFinderPattern*)m_possibleCenters[i];
if (pattern->GetCount() >= CENTER_QUORUM) {
@@ -416,9 +416,9 @@ inline FX_BOOL centerComparator(FX_LPVOID a, FX_LPVOID b) {
return ((CBC_QRFinderPattern*)b)->GetCount() < ((CBC_QRFinderPattern*)a)->GetCount();
}
-CFX_PtrArray *CBC_QRFinderPatternFinder::SelectBestpatterns(FX_INT32 &e)
+CFX_PtrArray *CBC_QRFinderPatternFinder::SelectBestpatterns(int32_t &e)
{
- FX_INT32 startSize = m_possibleCenters.GetSize();
+ int32_t startSize = m_possibleCenters.GetSize();
if(m_possibleCenters.GetSize() < 3) {
e = BCExceptionRead;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -426,11 +426,11 @@ CFX_PtrArray *CBC_QRFinderPatternFinder::SelectBestpatterns(FX_INT32 &e) FX_FLOAT average = 0.0f;
if(startSize > 3) {
FX_FLOAT totalModuleSize = 0.0f;
- for(FX_INT32 i = 0; i < startSize; i++) {
+ for(int32_t i = 0; i < startSize; i++) {
totalModuleSize += ((CBC_QRFinderPattern*)m_possibleCenters[i])->GetEstimatedModuleSize();
}
average = totalModuleSize / (FX_FLOAT)startSize;
- for(FX_INT32 j = 0; j < m_possibleCenters.GetSize() && m_possibleCenters.GetSize() > 3; j++) {
+ for(int32_t j = 0; j < m_possibleCenters.GetSize() && m_possibleCenters.GetSize() > 3; j++) {
CBC_QRFinderPattern *pattern = (CBC_QRFinderPattern*)m_possibleCenters[j];
if(fabs(pattern->GetEstimatedModuleSize() - average) > 0.2f * average) {
delete pattern;
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h index d0fde46542..f24d22bed2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h @@ -14,10 +14,10 @@ class CBC_QRFinderPatternInfo; class CBC_QRFinderPatternFinder
{
private:
- const static FX_INT32 CENTER_QUORUM;
- const static FX_INT32 MIN_SKIP;
- const static FX_INT32 MAX_MODULES;
- const static FX_INT32 INTEGER_MATH_SHIFT;
+ const static int32_t CENTER_QUORUM;
+ const static int32_t MIN_SKIP;
+ const static int32_t MAX_MODULES;
+ const static int32_t INTEGER_MATH_SHIFT;
FX_BOOL m_hasSkipped;
CBC_CommonBitMatrix* m_image;
CFX_Int32Array m_crossCheckStateCount;
@@ -25,19 +25,19 @@ private: public:
CBC_QRFinderPatternFinder(CBC_CommonBitMatrix *image);
virtual ~CBC_QRFinderPatternFinder();
- FX_INT32 FindRowSkip();
+ int32_t FindRowSkip();
CBC_CommonBitMatrix* GetImage();
- CBC_QRFinderPatternInfo* Find(FX_INT32 hint, FX_INT32 &e);
+ CBC_QRFinderPatternInfo* Find(int32_t hint, int32_t &e);
CFX_Int32Array &GetCrossCheckStateCount();
CFX_PtrArray *GetPossibleCenters();
- CFX_PtrArray *SelectBestpatterns(FX_INT32 &e);
+ CFX_PtrArray *SelectBestpatterns(int32_t &e);
- FX_BOOL HandlePossibleCenter(const CFX_Int32Array &stateCount, FX_INT32 i, FX_INT32 j);
+ FX_BOOL HandlePossibleCenter(const CFX_Int32Array &stateCount, int32_t i, int32_t j);
FX_BOOL HaveMultiplyConfirmedCenters();
- FX_FLOAT CenterFromEnd(const CFX_Int32Array &stateCount, FX_INT32 end);
- FX_FLOAT CrossCheckVertical(FX_INT32 startI, FX_INT32 centerJ, FX_INT32 maxCount, FX_INT32 originalStateCountTotal);
- FX_FLOAT CrossCheckHorizontal(FX_INT32 startJ, FX_INT32 CenterI, FX_INT32 maxCOunt, FX_INT32 originalStateCountTotal);
+ FX_FLOAT CenterFromEnd(const CFX_Int32Array &stateCount, int32_t end);
+ FX_FLOAT CrossCheckVertical(int32_t startI, int32_t centerJ, int32_t maxCount, int32_t originalStateCountTotal);
+ FX_FLOAT CrossCheckHorizontal(int32_t startJ, int32_t CenterI, int32_t maxCOunt, int32_t originalStateCountTotal);
static void OrderBestPatterns(CFX_PtrArray *patterns);
static FX_BOOL FoundPatternCross(const CFX_Int32Array &stateCount);
static FX_FLOAT Distance(CBC_ResultPoint* point1, CBC_ResultPoint* point2);
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp index 8783078690..a5e478e1da 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp @@ -35,15 +35,15 @@ CBC_QRGridSampler &CBC_QRGridSampler::GetInstance() {
return m_gridSampler;
}
-void CBC_QRGridSampler::CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_FloatArray *points, FX_INT32 &e)
+void CBC_QRGridSampler::CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_FloatArray *points, int32_t &e)
{
- FX_INT32 width = image->GetWidth();
- FX_INT32 height = image->GetHeight();
+ int32_t width = image->GetWidth();
+ int32_t height = image->GetHeight();
FX_BOOL nudged = TRUE;
- FX_INT32 offset;
+ int32_t offset;
for (offset = 0; offset < points->GetSize() && nudged; offset += 2) {
- FX_INT32 x = (FX_INT32) (*points)[offset];
- FX_INT32 y = (FX_INT32) (*points)[offset + 1];
+ int32_t x = (int32_t) (*points)[offset];
+ int32_t y = (int32_t) (*points)[offset + 1];
if (x < -1 || x > width || y < -1 || y > height) {
e = BCExceptionRead;
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -66,8 +66,8 @@ void CBC_QRGridSampler::CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_Floa }
nudged = TRUE;
for (offset = (*points).GetSize() - 2; offset >= 0 && nudged; offset -= 2) {
- FX_INT32 x = (FX_INT32) (*points)[offset];
- FX_INT32 y = (FX_INT32) (*points)[offset + 1];
+ int32_t x = (int32_t) (*points)[offset];
+ int32_t y = (int32_t) (*points)[offset + 1];
if (x < -1 || x > width || y < -1 || y > height) {
e = BCExceptionRead;
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -89,7 +89,7 @@ void CBC_QRGridSampler::CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_Floa }
}
}
-CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, FX_INT32 dimensionX, FX_INT32 dimensionY,
+CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, int32_t dimensionX, int32_t dimensionY,
FX_FLOAT p1ToX, FX_FLOAT p1ToY,
FX_FLOAT p2ToX, FX_FLOAT p2ToY,
FX_FLOAT p3ToX, FX_FLOAT p3ToY,
@@ -97,7 +97,7 @@ CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, F FX_FLOAT p1FromX, FX_FLOAT p1FromY,
FX_FLOAT p2FromX, FX_FLOAT p2FromY,
FX_FLOAT p3FromX, FX_FLOAT p3FromY,
- FX_FLOAT p4FromX, FX_FLOAT p4FromY, FX_INT32 &e)
+ FX_FLOAT p4FromX, FX_FLOAT p4FromY, int32_t &e)
{
CBC_AutoPtr<CBC_CommonPerspectiveTransform> transform(CBC_CommonPerspectiveTransform::QuadrilateralToQuadrilateral(
p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY,
@@ -107,10 +107,10 @@ CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, F CBC_AutoPtr<CBC_CommonBitMatrix> bits(tempBitM);
CFX_FloatArray points;
points.SetSize(dimensionX << 1);
- for (FX_INT32 y = 0; y < dimensionY; y++) {
- FX_INT32 max = points.GetSize();
+ for (int32_t y = 0; y < dimensionY; y++) {
+ int32_t max = points.GetSize();
FX_FLOAT iValue = (FX_FLOAT) (y + 0.5f);
- FX_INT32 x;
+ int32_t x;
for (x = 0; x < max; x += 2) {
points[x] = (FX_FLOAT) ((x >> 1) + 0.5f);
points[x + 1] = iValue;
@@ -119,7 +119,7 @@ CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, F CheckAndNudgePoints(image, &points, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
for (x = 0; x < max; x += 2) {
- if (image->Get((FX_INT32) points[x], (FX_INT32) points[x + 1])) {
+ if (image->Get((int32_t) points[x], (int32_t) points[x + 1])) {
bits->Set(x >> 1, y);
}
}
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h index 0b8c7d3ab7..c7abf75f8d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h @@ -17,7 +17,7 @@ private: public:
CBC_QRGridSampler();
virtual ~CBC_QRGridSampler();
- virtual CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix *image, FX_INT32 dimensionX, FX_INT32 dimensionY,
+ virtual CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix *image, int32_t dimensionX, int32_t dimensionY,
FX_FLOAT p1ToX, FX_FLOAT p1ToY,
FX_FLOAT p2ToX, FX_FLOAT p2ToY,
FX_FLOAT p3ToX, FX_FLOAT p3ToY,
@@ -25,9 +25,9 @@ public: FX_FLOAT p1FromX, FX_FLOAT p1FromY,
FX_FLOAT p2FromX, FX_FLOAT p2FromY,
FX_FLOAT p3FromX, FX_FLOAT p3FromY,
- FX_FLOAT p4FromX, FX_FLOAT p4FromY, FX_INT32 &e);
+ FX_FLOAT p4FromX, FX_FLOAT p4FromY, int32_t &e);
static CBC_QRGridSampler &GetInstance();
- static void CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_FloatArray *points, FX_INT32 &e);
+ static void CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_FloatArray *points, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/utils.h b/xfa/src/fxbarcode/utils.h index ecaadccef0..9639ba8504 100644 --- a/xfa/src/fxbarcode/utils.h +++ b/xfa/src/fxbarcode/utils.h @@ -6,9 +6,9 @@ #ifndef _BC_UTILS_H_
#define _BC_UTILS_H_
-typedef CFX_MapPtrTemplate<FX_LPVOID, FX_INT32> CFX_PtrToInt32;
-FX_BOOL BC_FX_ByteString_Replace(CFX_ByteString &dst, FX_DWORD first, FX_DWORD last, FX_INT32 count, FX_CHAR c);
-void BC_FX_ByteString_Append(CFX_ByteString &dst, FX_INT32 count, FX_CHAR c);
+typedef CFX_MapPtrTemplate<FX_LPVOID, int32_t> CFX_PtrToInt32;
+FX_BOOL BC_FX_ByteString_Replace(CFX_ByteString &dst, FX_DWORD first, FX_DWORD last, int32_t count, FX_CHAR c);
+void BC_FX_ByteString_Append(CFX_ByteString &dst, int32_t count, FX_CHAR c);
void BC_FX_ByteString_Append(CFX_ByteString &dst, const CFX_ByteArray &ba);
typedef FX_BOOL (*BC_PtrArrayCompareCallback)(FX_LPVOID l, FX_LPVOID r);
void BC_FX_PtrArray_Sort(CFX_PtrArray &src, BC_PtrArrayCompareCallback fun);
|