summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode')
-rw-r--r--xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp8
-rw-r--r--xfa/fxbarcode/cbc_codabar.cpp6
-rw-r--r--xfa/fxbarcode/cbc_codabar.h14
-rw-r--r--xfa/fxbarcode/cbc_code128.cpp6
-rw-r--r--xfa/fxbarcode/cbc_code128.h18
-rw-r--r--xfa/fxbarcode/cbc_code39.cpp6
-rw-r--r--xfa/fxbarcode/cbc_code39.h25
-rw-r--r--xfa/fxbarcode/cbc_codebase.h4
-rw-r--r--xfa/fxbarcode/cbc_datamatrix.cpp6
-rw-r--r--xfa/fxbarcode/cbc_datamatrix.h26
-rw-r--r--xfa/fxbarcode/cbc_ean13.cpp6
-rw-r--r--xfa/fxbarcode/cbc_ean13.h26
-rw-r--r--xfa/fxbarcode/cbc_ean8.cpp6
-rw-r--r--xfa/fxbarcode/cbc_ean8.h26
-rw-r--r--xfa/fxbarcode/cbc_onecode.h19
-rw-r--r--xfa/fxbarcode/cbc_pdf417i.cpp6
-rw-r--r--xfa/fxbarcode/cbc_pdf417i.h26
-rw-r--r--xfa/fxbarcode/cbc_qrcode.cpp6
-rw-r--r--xfa/fxbarcode/cbc_qrcode.h26
-rw-r--r--xfa/fxbarcode/cbc_upca.cpp6
-rw-r--r--xfa/fxbarcode/cbc_upca.h23
-rw-r--r--xfa/fxbarcode/oned/BC_OnedUPCAReader.h1
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp97
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.h22
24 files changed, 225 insertions, 190 deletions
diff --git a/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp b/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp
index 982cc9c4ad..814f300b2d 100644
--- a/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp
+++ b/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp
@@ -135,8 +135,8 @@ CFX_ByteArray* CBC_BufferedImageLuminanceSource::GetRow(int32_t y,
}
CFX_ByteArray* CBC_BufferedImageLuminanceSource::GetMatrix() {
- CFX_ByteArray* matirx = new CFX_ByteArray();
- matirx->SetSize(m_bytesPerLine * m_height);
+ CFX_ByteArray* matrix = new CFX_ByteArray();
+ matrix->SetSize(m_bytesPerLine * m_height);
int32_t* rgb = (int32_t*)m_pBitmap->GetBuffer();
int32_t y;
for (y = 0; y < m_height; y++) {
@@ -148,8 +148,8 @@ CFX_ByteArray* CBC_BufferedImageLuminanceSource::GetMatrix() {
(306 * ((pixel >> 16) & 0xFF) + 601 * ((pixel >> 8) & 0xFF) +
117 * (pixel & 0xFF)) >>
10;
- (*matirx)[offset + x] = (uint8_t)luminance;
+ (*matrix)[offset + x] = (uint8_t)luminance;
}
}
- return matirx;
+ return matrix;
}
diff --git a/xfa/fxbarcode/cbc_codabar.cpp b/xfa/fxbarcode/cbc_codabar.cpp
index fad026ddb7..3bdc6c1935 100644
--- a/xfa/fxbarcode/cbc_codabar.cpp
+++ b/xfa/fxbarcode/cbc_codabar.cpp
@@ -84,13 +84,13 @@ FX_BOOL CBC_Codabar::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_Codabar::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
CFX_WideString renderCon =
((CBC_OnedCodaBarWriter*)m_pBCWriter)
->encodedContents(m_renderContents.AsStringC());
((CBC_OneDimWriter*)m_pBCWriter)
- ->RenderDeviceResult(device, matirx, renderCon.AsStringC(), e);
+ ->RenderDeviceResult(device, matrix, renderCon.AsStringC(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
@@ -107,7 +107,7 @@ FX_BOOL CBC_Codabar::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_Codabar::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_codabar.h b/xfa/fxbarcode/cbc_codabar.h
index c375cccfb0..9684b584a1 100644
--- a/xfa/fxbarcode/cbc_codabar.h
+++ b/xfa/fxbarcode/cbc_codabar.h
@@ -17,15 +17,19 @@ class CBC_Codabar : public CBC_OneCode {
CBC_Codabar();
~CBC_Codabar() override;
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e) override;
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e) override;
+ // CBC_OneCode:
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
-
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) override;
FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
-
BC_TYPE GetType() override { return BC_CODABAR; }
FX_BOOL SetStartChar(FX_CHAR start);
diff --git a/xfa/fxbarcode/cbc_code128.cpp b/xfa/fxbarcode/cbc_code128.cpp
index 98490f2e60..039e37275d 100644
--- a/xfa/fxbarcode/cbc_code128.cpp
+++ b/xfa/fxbarcode/cbc_code128.cpp
@@ -73,10 +73,10 @@ FX_BOOL CBC_Code128::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_Code128::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
((CBC_OneDimWriter*)m_pBCWriter)
- ->RenderDeviceResult(device, matirx, m_renderContents.AsStringC(), e);
+ ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
@@ -90,7 +90,7 @@ FX_BOOL CBC_Code128::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_Code128::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_code128.h b/xfa/fxbarcode/cbc_code128.h
index d351a9af33..c5aa8e19b1 100644
--- a/xfa/fxbarcode/cbc_code128.h
+++ b/xfa/fxbarcode/cbc_code128.h
@@ -15,17 +15,21 @@
class CBC_Code128 : public CBC_OneCode {
public:
explicit CBC_Code128(BC_TYPE type);
- virtual ~CBC_Code128();
-
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e) override;
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e) override;
+ ~CBC_Code128() override;
+
+ // CBC_OneCode:
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
-
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) override;
FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
-
BC_TYPE GetType() override { return BC_CODE128; }
FX_BOOL SetTextLocation(BC_TEXT_LOC loction);
diff --git a/xfa/fxbarcode/cbc_code39.cpp b/xfa/fxbarcode/cbc_code39.cpp
index 627ea4d173..516b34e8e3 100644
--- a/xfa/fxbarcode/cbc_code39.cpp
+++ b/xfa/fxbarcode/cbc_code39.cpp
@@ -75,13 +75,13 @@ FX_BOOL CBC_Code39::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_Code39::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
CFX_WideString renderCon =
((CBC_OnedCode39Writer*)m_pBCWriter)
->encodedContents(m_renderContents.AsStringC(), e);
((CBC_OneDimWriter*)m_pBCWriter)
- ->RenderDeviceResult(device, matirx, renderCon.AsStringC(), e);
+ ->RenderDeviceResult(device, matrix, renderCon.AsStringC(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
@@ -98,7 +98,7 @@ FX_BOOL CBC_Code39::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_Code39::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_code39.h b/xfa/fxbarcode/cbc_code39.h
index 3853da18d7..d6dad7df31 100644
--- a/xfa/fxbarcode/cbc_code39.h
+++ b/xfa/fxbarcode/cbc_code39.h
@@ -17,18 +17,23 @@ class CBC_Code39 : public CBC_OneCode {
CBC_Code39();
explicit CBC_Code39(FX_BOOL usingCheckDigit);
CBC_Code39(FX_BOOL usingCheckDigit, FX_BOOL extendedMode);
- virtual ~CBC_Code39();
-
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e);
- CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e);
-
+ ~CBC_Code39() override;
+
+ // CBC_OneCode:
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
+ CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e);
- FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
+ BC_TYPE GetType() override { return BC_CODE39; }
- BC_TYPE GetType() { return BC_CODE39; }
FX_BOOL SetTextLocation(BC_TEXT_LOC location);
FX_BOOL SetWideNarrowRatio(int32_t ratio);
diff --git a/xfa/fxbarcode/cbc_codebase.h b/xfa/fxbarcode/cbc_codebase.h
index 317e0ecef7..2124f75d78 100644
--- a/xfa/fxbarcode/cbc_codebase.h
+++ b/xfa/fxbarcode/cbc_codebase.h
@@ -26,12 +26,12 @@ class CBC_CodeBase {
FX_BOOL isDevice,
int32_t& e) = 0;
virtual FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) = 0;
virtual FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) = 0;
virtual CFX_WideString Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) = 0;
virtual CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) = 0;
diff --git a/xfa/fxbarcode/cbc_datamatrix.cpp b/xfa/fxbarcode/cbc_datamatrix.cpp
index c23aa33fc3..63385aa2db 100644
--- a/xfa/fxbarcode/cbc_datamatrix.cpp
+++ b/xfa/fxbarcode/cbc_datamatrix.cpp
@@ -53,9 +53,9 @@ FX_BOOL CBC_DataMatrix::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_DataMatrix::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
- ((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx);
+ ((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matrix);
return TRUE;
}
@@ -67,7 +67,7 @@ FX_BOOL CBC_DataMatrix::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_DataMatrix::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_datamatrix.h b/xfa/fxbarcode/cbc_datamatrix.h
index 496df6ecaa..7cd487567d 100644
--- a/xfa/fxbarcode/cbc_datamatrix.h
+++ b/xfa/fxbarcode/cbc_datamatrix.h
@@ -15,18 +15,22 @@
class CBC_DataMatrix : public CBC_CodeBase {
public:
CBC_DataMatrix();
- virtual ~CBC_DataMatrix();
-
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e);
- CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e);
-
+ ~CBC_DataMatrix() override;
+
+ // CBC_OneCode:
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
+ CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e);
- FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
-
- BC_TYPE GetType() { return BC_DATAMATRIX; }
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
+ BC_TYPE GetType() override { return BC_DATAMATRIX; }
};
#endif // XFA_FXBARCODE_CBC_DATAMATRIX_H_
diff --git a/xfa/fxbarcode/cbc_ean13.cpp b/xfa/fxbarcode/cbc_ean13.cpp
index c51e262128..5f33f4c3d2 100644
--- a/xfa/fxbarcode/cbc_ean13.cpp
+++ b/xfa/fxbarcode/cbc_ean13.cpp
@@ -81,10 +81,10 @@ FX_BOOL CBC_EAN13::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_EAN13::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
((CBC_OneDimWriter*)m_pBCWriter)
- ->RenderDeviceResult(device, matirx, m_renderContents.AsStringC(), e);
+ ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
@@ -98,7 +98,7 @@ FX_BOOL CBC_EAN13::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_EAN13::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_ean13.h b/xfa/fxbarcode/cbc_ean13.h
index 7c33f512a9..93abab27ff 100644
--- a/xfa/fxbarcode/cbc_ean13.h
+++ b/xfa/fxbarcode/cbc_ean13.h
@@ -15,18 +15,22 @@
class CBC_EAN13 : public CBC_OneCode {
public:
CBC_EAN13();
- virtual ~CBC_EAN13();
-
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e);
- CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e);
-
+ ~CBC_EAN13() override;
+
+ // CBC_OneCode:
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
+ CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e);
- FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
-
- BC_TYPE GetType() { return BC_EAN13; }
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
+ BC_TYPE GetType() override { return BC_EAN13; }
private:
CFX_WideString Preprocess(const CFX_WideStringC& contents);
diff --git a/xfa/fxbarcode/cbc_ean8.cpp b/xfa/fxbarcode/cbc_ean8.cpp
index 1128b8469c..e92605f2c4 100644
--- a/xfa/fxbarcode/cbc_ean8.cpp
+++ b/xfa/fxbarcode/cbc_ean8.cpp
@@ -80,10 +80,10 @@ FX_BOOL CBC_EAN8::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_EAN8::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
((CBC_OneDimWriter*)m_pBCWriter)
- ->RenderDeviceResult(device, matirx, m_renderContents.AsStringC(), e);
+ ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
@@ -97,7 +97,7 @@ FX_BOOL CBC_EAN8::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_EAN8::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_ean8.h b/xfa/fxbarcode/cbc_ean8.h
index 82fe0c167d..d9cd0574da 100644
--- a/xfa/fxbarcode/cbc_ean8.h
+++ b/xfa/fxbarcode/cbc_ean8.h
@@ -15,18 +15,22 @@
class CBC_EAN8 : public CBC_OneCode {
public:
CBC_EAN8();
- virtual ~CBC_EAN8();
-
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e);
- CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e);
-
+ ~CBC_EAN8() override;
+
+ // CBC_OneCode:
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
+ CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e);
- FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
-
- BC_TYPE GetType() { return BC_EAN8; }
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
+ BC_TYPE GetType() override { return BC_EAN8; }
private:
CFX_WideString Preprocess(const CFX_WideStringC& contents);
diff --git a/xfa/fxbarcode/cbc_onecode.h b/xfa/fxbarcode/cbc_onecode.h
index 7c32cf8606..6e447cc772 100644
--- a/xfa/fxbarcode/cbc_onecode.h
+++ b/xfa/fxbarcode/cbc_onecode.h
@@ -18,24 +18,7 @@ class CFX_RenderDevice;
class CBC_OneCode : public CBC_CodeBase {
public:
CBC_OneCode();
- virtual ~CBC_OneCode();
-
- virtual BC_TYPE GetType() = 0;
-
- virtual FX_BOOL Encode(const CFX_WideStringC& contents,
- FX_BOOL isDevice,
- int32_t& e) = 0;
- virtual CFX_WideString Decode(uint8_t* buf,
- int32_t width,
- int32_t hight,
- int32_t& e) = 0;
- virtual CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) = 0;
-
- virtual FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e) = 0;
- virtual FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) = 0;
-
+ ~CBC_OneCode() override;
virtual FX_BOOL CheckContentValidity(const CFX_WideStringC& contents);
virtual CFX_WideString FilterContents(const CFX_WideStringC& contents);
diff --git a/xfa/fxbarcode/cbc_pdf417i.cpp b/xfa/fxbarcode/cbc_pdf417i.cpp
index 7cb8275bc4..0b7a558327 100644
--- a/xfa/fxbarcode/cbc_pdf417i.cpp
+++ b/xfa/fxbarcode/cbc_pdf417i.cpp
@@ -61,9 +61,9 @@ FX_BOOL CBC_PDF417I::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_PDF417I::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
- ((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx);
+ ((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matrix);
return TRUE;
}
@@ -75,7 +75,7 @@ FX_BOOL CBC_PDF417I::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_PDF417I::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_pdf417i.h b/xfa/fxbarcode/cbc_pdf417i.h
index f38b416170..0658ff7a53 100644
--- a/xfa/fxbarcode/cbc_pdf417i.h
+++ b/xfa/fxbarcode/cbc_pdf417i.h
@@ -15,18 +15,22 @@
class CBC_PDF417I : public CBC_CodeBase {
public:
CBC_PDF417I();
- virtual ~CBC_PDF417I();
-
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e);
- CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e);
-
+ ~CBC_PDF417I() override;
+
+ // CBC_CodeBase::
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
+ CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e);
- FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
-
- BC_TYPE GetType() { return BC_PDF417; }
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
+ BC_TYPE GetType() override { return BC_PDF417; }
FX_BOOL SetErrorCorrectionLevel(int32_t level);
void SetTruncated(FX_BOOL truncated);
diff --git a/xfa/fxbarcode/cbc_qrcode.cpp b/xfa/fxbarcode/cbc_qrcode.cpp
index 41c252e180..8faf5ad2de 100644
--- a/xfa/fxbarcode/cbc_qrcode.cpp
+++ b/xfa/fxbarcode/cbc_qrcode.cpp
@@ -71,9 +71,9 @@ FX_BOOL CBC_QRCode::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_QRCode::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
- ((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matirx);
+ ((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matrix);
return TRUE;
}
@@ -85,7 +85,7 @@ FX_BOOL CBC_QRCode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_QRCode::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_qrcode.h b/xfa/fxbarcode/cbc_qrcode.h
index d77a23d4ab..4038164643 100644
--- a/xfa/fxbarcode/cbc_qrcode.h
+++ b/xfa/fxbarcode/cbc_qrcode.h
@@ -15,18 +15,22 @@
class CBC_QRCode : public CBC_CodeBase {
public:
CBC_QRCode();
- virtual ~CBC_QRCode();
-
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e);
- CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e);
-
+ ~CBC_QRCode() override;
+
+ // CBC_CodeBase:
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
+ CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e);
- FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
-
- BC_TYPE GetType() { return BC_QR_CODE; }
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
+ BC_TYPE GetType() override { return BC_QR_CODE; }
FX_BOOL SetVersion(int32_t version);
FX_BOOL SetErrorCorrectionLevel(int32_t level);
diff --git a/xfa/fxbarcode/cbc_upca.cpp b/xfa/fxbarcode/cbc_upca.cpp
index 38d481946e..2c60c92f40 100644
--- a/xfa/fxbarcode/cbc_upca.cpp
+++ b/xfa/fxbarcode/cbc_upca.cpp
@@ -83,10 +83,10 @@ FX_BOOL CBC_UPCA::Encode(const CFX_WideStringC& contents,
}
FX_BOOL CBC_UPCA::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
((CBC_OneDimWriter*)m_pBCWriter)
- ->RenderDeviceResult(device, matirx, m_renderContents.AsStringC(), e);
+ ->RenderDeviceResult(device, matrix, m_renderContents.AsStringC(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
@@ -100,7 +100,7 @@ FX_BOOL CBC_UPCA::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
CFX_WideString CBC_UPCA::Decode(uint8_t* buf,
int32_t width,
- int32_t hight,
+ int32_t height,
int32_t& e) {
CFX_WideString str;
return str;
diff --git a/xfa/fxbarcode/cbc_upca.h b/xfa/fxbarcode/cbc_upca.h
index 3e0d24a934..a2e0658f39 100644
--- a/xfa/fxbarcode/cbc_upca.h
+++ b/xfa/fxbarcode/cbc_upca.h
@@ -15,15 +15,22 @@
class CBC_UPCA : public CBC_OneCode {
public:
CBC_UPCA();
- virtual ~CBC_UPCA();
- FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
+ ~CBC_UPCA() override;
+
+ // CBC_OneCode:
+ FX_BOOL Encode(const CFX_WideStringC& contents,
+ FX_BOOL isDevice,
+ int32_t& e) override;
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
- int32_t& e);
- FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
- CFX_WideString Decode(uint8_t* buf, int32_t width, int32_t hight, int32_t& e);
- CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e);
- BC_TYPE GetType() { return BC_UPCA; }
+ const CFX_Matrix* matrix,
+ int32_t& e) override;
+ FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) override;
+ CFX_WideString Decode(uint8_t* buf,
+ int32_t width,
+ int32_t height,
+ int32_t& e) override;
+ CFX_WideString Decode(CFX_DIBitmap* pBitmap, int32_t& e) override;
+ BC_TYPE GetType() override { return BC_UPCA; }
private:
CFX_WideString Preprocess(const CFX_WideStringC& contents);
diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAReader.h b/xfa/fxbarcode/oned/BC_OnedUPCAReader.h
index 1f2ba6222c..c073930c5b 100644
--- a/xfa/fxbarcode/oned/BC_OnedUPCAReader.h
+++ b/xfa/fxbarcode/oned/BC_OnedUPCAReader.h
@@ -43,7 +43,6 @@ class CBC_OnedUPCAReader : public CBC_OneDimReader {
private:
CBC_OnedEAN13Reader* m_ean13Reader;
-
};
#endif // XFA_FXBARCODE_ONED_BC_ONEDUPCAREADER_H_
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp
index f915e58aae..1c85aa16d7 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp
@@ -20,30 +20,63 @@
* limitations under the License.
*/
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
#include "xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.h"
+
+#include <limits>
+
+#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
#include "xfa/fxbarcode/utils.h"
-const uint16_t CBC_QRCoderFormatInformation::FORMAT_INFO_MASK_QR = 0X5412;
-const uint16_t CBC_QRCoderFormatInformation::FORMAT_INFO_DECODE_LOOKUP[32][2] =
- {
- {0x5412, 0x00}, {0x5125, 0x01}, {0x5E7C, 0x02}, {0x5B4B, 0x03},
- {0x45F9, 0x04}, {0x40CE, 0x05}, {0x4F97, 0x06}, {0x4AA0, 0x07},
- {0x77C4, 0x08}, {0x72F3, 0x09}, {0x7DAA, 0x0A}, {0x789D, 0x0B},
- {0x662F, 0x0C}, {0x6318, 0x0D}, {0x6C41, 0x0E}, {0x6976, 0x0F},
- {0x1689, 0x10}, {0x13BE, 0x11}, {0x1CE7, 0x12}, {0x19D0, 0x13},
- {0x0762, 0x14}, {0x0255, 0x15}, {0x0D0C, 0x16}, {0x083B, 0x17},
- {0x355F, 0x18}, {0x3068, 0x19}, {0x3F31, 0x1A}, {0x3A06, 0x1B},
- {0x24B4, 0x1C}, {0x2183, 0x1D}, {0x2EDA, 0x1E}, {0x2BED, 0x1F},
+namespace {
+
+const uint16_t FORMAT_INFO_MASK_QR = 0X5412;
+
+struct DecodeInfo {
+ uint16_t target;
+ uint16_t format;
};
-const uint8_t CBC_QRCoderFormatInformation::BITS_SET_IN_HALF_BYTE[] = {
- 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
+const DecodeInfo FORMAT_INFO_DECODE_LOOKUP[32] = {
+ {0x5412, 0x00}, {0x5125, 0x01}, {0x5E7C, 0x02}, {0x5B4B, 0x03},
+ {0x45F9, 0x04}, {0x40CE, 0x05}, {0x4F97, 0x06}, {0x4AA0, 0x07},
+ {0x77C4, 0x08}, {0x72F3, 0x09}, {0x7DAA, 0x0A}, {0x789D, 0x0B},
+ {0x662F, 0x0C}, {0x6318, 0x0D}, {0x6C41, 0x0E}, {0x6976, 0x0F},
+ {0x1689, 0x10}, {0x13BE, 0x11}, {0x1CE7, 0x12}, {0x19D0, 0x13},
+ {0x0762, 0x14}, {0x0255, 0x15}, {0x0D0C, 0x16}, {0x083B, 0x17},
+ {0x355F, 0x18}, {0x3068, 0x19}, {0x3F31, 0x1A}, {0x3A06, 0x1B},
+ {0x24B4, 0x1C}, {0x2183, 0x1D}, {0x2EDA, 0x1E}, {0x2BED, 0x1F},
+};
+const uint8_t BITS_SET_IN_HALF_BYTE[] = {0, 1, 1, 2, 1, 2, 2, 3,
+ 1, 2, 2, 3, 2, 3, 3, 4};
+
+CBC_QRCoderFormatInformation* DoDecodeFormatInformation(
+ int32_t maskedFormatInfo) {
+ int32_t bestDifference = std::numeric_limits<int32_t>::max();
+ int32_t bestFormatInfo = 0;
+ for (int32_t i = 0; i < 32; ++i) {
+ const DecodeInfo& decodeInfo = FORMAT_INFO_DECODE_LOOKUP[i];
+ if (decodeInfo.target == maskedFormatInfo)
+ return new CBC_QRCoderFormatInformation(decodeInfo.format);
+
+ int32_t bitsDifference = CBC_QRCoderFormatInformation::NumBitsDiffering(
+ maskedFormatInfo, decodeInfo.target);
+ if (bitsDifference < bestDifference) {
+ bestFormatInfo = decodeInfo.format;
+ bestDifference = bitsDifference;
+ }
+ }
+ if (bestDifference > 3)
+ return nullptr;
+ return new CBC_QRCoderFormatInformation(bestFormatInfo);
+}
+
+} // namespace
-CBC_QRCoderFormatInformation::CBC_QRCoderFormatInformation(int32_t formatInfo) {
- m_errorCorrectLevl =
+CBC_QRCoderFormatInformation::CBC_QRCoderFormatInformation(int32_t formatInfo)
+ : m_dataMask(static_cast<uint8_t>(formatInfo & 0x07)) {
+ m_errorCorrectLevel =
CBC_QRCoderErrorCorrectionLevel::ForBits((formatInfo >> 3) & 0x03);
- m_dataMask = (uint8_t)(formatInfo & 0x07);
}
+
CBC_QRCoderFormatInformation::~CBC_QRCoderFormatInformation() {}
int32_t CBC_QRCoderFormatInformation::NumBitsDiffering(int32_t a, int32_t b) {
a ^= b;
@@ -56,13 +89,17 @@ int32_t CBC_QRCoderFormatInformation::NumBitsDiffering(int32_t a, int32_t b) {
BITS_SET_IN_HALF_BYTE[(a >> 24) & 0x0F] +
BITS_SET_IN_HALF_BYTE[(a >> 28) & 0x0F];
}
-uint8_t CBC_QRCoderFormatInformation::GetDataMask() {
+uint8_t CBC_QRCoderFormatInformation::GetDataMask() const {
return m_dataMask;
}
+
+// static
CBC_QRCoderErrorCorrectionLevel*
CBC_QRCoderFormatInformation::GetErrorCorrectionLevel() {
- return m_errorCorrectLevl;
+ return m_errorCorrectLevel;
}
+
+// static
CBC_QRCoderFormatInformation*
CBC_QRCoderFormatInformation::DecodeFormatInformation(
int32_t maskedFormatInfo) {
@@ -72,25 +109,3 @@ CBC_QRCoderFormatInformation::DecodeFormatInformation(
return formatInfo;
return DoDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR);
}
-CBC_QRCoderFormatInformation*
-CBC_QRCoderFormatInformation::DoDecodeFormatInformation(
- int32_t maskedFormatInfo) {
- int32_t bestDifference = (int32_t)FXSYS_nan();
- int32_t bestFormatInfo = 0;
- for (int32_t i = 0; i < 32; i++) {
- uint16_t const* decodeInfo = &FORMAT_INFO_DECODE_LOOKUP[i][0];
- uint16_t targetInfo = decodeInfo[0];
- if (targetInfo == maskedFormatInfo) {
- return new CBC_QRCoderFormatInformation(decodeInfo[1]);
- }
- int32_t bitsDifference = NumBitsDiffering(maskedFormatInfo, targetInfo);
- if (bitsDifference < bestDifference) {
- bestFormatInfo = decodeInfo[1];
- bestDifference = bitsDifference;
- }
- }
- if (bestDifference <= 3) {
- return new CBC_QRCoderFormatInformation(bestFormatInfo);
- }
- return NULL;
-}
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.h b/xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.h
index a988d3bd6b..b069795ce1 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.h
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderFormatInformation.h
@@ -7,26 +7,24 @@
#ifndef XFA_FXBARCODE_QRCODE_BC_QRCODERFORMATINFORMATION_H_
#define XFA_FXBARCODE_QRCODE_BC_QRCODERFORMATINFORMATION_H_
+#include <stdint.h>
+
class CBC_QRCoderErrorCorrectionLevel;
class CBC_QRCoderFormatInformation {
- private:
- static const uint16_t FORMAT_INFO_MASK_QR;
- static const uint16_t FORMAT_INFO_DECODE_LOOKUP[32][2];
- static const uint8_t BITS_SET_IN_HALF_BYTE[16];
- CBC_QRCoderErrorCorrectionLevel* m_errorCorrectLevl;
- uint8_t m_dataMask;
-
public:
- CBC_QRCoderFormatInformation(int32_t formatInfo);
- virtual ~CBC_QRCoderFormatInformation();
- uint8_t GetDataMask();
+ explicit CBC_QRCoderFormatInformation(int32_t formatInfo);
+ ~CBC_QRCoderFormatInformation();
+
+ uint8_t GetDataMask() const;
CBC_QRCoderErrorCorrectionLevel* GetErrorCorrectionLevel();
static int32_t NumBitsDiffering(int32_t a, int32_t b);
static CBC_QRCoderFormatInformation* DecodeFormatInformation(
int32_t maskedFormatInfo);
- static CBC_QRCoderFormatInformation* DoDecodeFormatInformation(
- int32_t maskedFormatInfo);
+
+ private:
+ CBC_QRCoderErrorCorrectionLevel* m_errorCorrectLevel;
+ const uint8_t m_dataMask;
};
#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERFORMATINFORMATION_H_