Fix lint bugs.
Also fix typos and overrides.
Review-Url: https://codereview.chromium.org/1935793002
diff --git a/xfa/fwl/basewidget/fxmath_barcodeimp.cpp b/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
index 5efd162..1d3af69 100644
--- a/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
+++ b/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
@@ -338,12 +338,12 @@
return m_pBCEngine->Encode(contents, isDevice, e);
}
FX_BOOL CFX_Barcode::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e) {
if (!m_pBCEngine) {
return FALSE;
}
- return m_pBCEngine->RenderDevice(device, matirx, e);
+ return m_pBCEngine->RenderDevice(device, matrix, e);
}
FX_BOOL CFX_Barcode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
if (!m_pBCEngine) {
diff --git a/xfa/fwl/basewidget/fxmath_barcodeimp.h b/xfa/fwl/basewidget/fxmath_barcodeimp.h
index b52e900..eca41d0 100644
--- a/xfa/fwl/basewidget/fxmath_barcodeimp.h
+++ b/xfa/fwl/basewidget/fxmath_barcodeimp.h
@@ -28,7 +28,7 @@
BC_TYPE GetType();
FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e);
FX_BOOL RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matirx,
+ const CFX_Matrix* matrix,
int32_t& e);
FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
CFX_WideString Decode(uint8_t* buf,
diff --git a/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp b/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp
index 982cc9c..814f300 100644
--- a/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp
+++ b/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp
@@ -135,8 +135,8 @@
}
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 @@
(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 fad026d..3bdc6c1 100644
--- a/xfa/fxbarcode/cbc_codabar.cpp
+++ b/xfa/fxbarcode/cbc_codabar.cpp
@@ -84,13 +84,13 @@
}
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 @@
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 c375ccc..9684b58 100644
--- a/xfa/fxbarcode/cbc_codabar.h
+++ b/xfa/fxbarcode/cbc_codabar.h
@@ -17,15 +17,19 @@
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 98490f2..039e372 100644
--- a/xfa/fxbarcode/cbc_code128.cpp
+++ b/xfa/fxbarcode/cbc_code128.cpp
@@ -73,10 +73,10 @@
}
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 @@
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 d351a9a..c5aa8e1 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();
+ ~CBC_Code128() 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_CODE128; }
FX_BOOL SetTextLocation(BC_TEXT_LOC loction);
diff --git a/xfa/fxbarcode/cbc_code39.cpp b/xfa/fxbarcode/cbc_code39.cpp
index 627ea4d..516b34e 100644
--- a/xfa/fxbarcode/cbc_code39.cpp
+++ b/xfa/fxbarcode/cbc_code39.cpp
@@ -75,13 +75,13 @@
}
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 @@
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 3853da1..d6dad7d 100644
--- a/xfa/fxbarcode/cbc_code39.h
+++ b/xfa/fxbarcode/cbc_code39.h
@@ -17,18 +17,23 @@
CBC_Code39();
explicit CBC_Code39(FX_BOOL usingCheckDigit);
CBC_Code39(FX_BOOL usingCheckDigit, FX_BOOL extendedMode);
- virtual ~CBC_Code39();
+ ~CBC_Code39() override;
- 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_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 317e0ec..2124f75 100644
--- a/xfa/fxbarcode/cbc_codebase.h
+++ b/xfa/fxbarcode/cbc_codebase.h
@@ -26,12 +26,12 @@
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 c23aa33..63385aa 100644
--- a/xfa/fxbarcode/cbc_datamatrix.cpp
+++ b/xfa/fxbarcode/cbc_datamatrix.cpp
@@ -53,9 +53,9 @@
}
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 @@
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 496df6e..7cd4875 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();
+ ~CBC_DataMatrix() override;
- 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_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 c51e262..5f33f4c 100644
--- a/xfa/fxbarcode/cbc_ean13.cpp
+++ b/xfa/fxbarcode/cbc_ean13.cpp
@@ -81,10 +81,10 @@
}
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 @@
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 7c33f51..93abab2 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();
+ ~CBC_EAN13() override;
- 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_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 1128b84..e92605f 100644
--- a/xfa/fxbarcode/cbc_ean8.cpp
+++ b/xfa/fxbarcode/cbc_ean8.cpp
@@ -80,10 +80,10 @@
}
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 @@
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 82fe0c1..d9cd057 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();
+ ~CBC_EAN8() override;
- 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_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 7c32cf8..6e447cc 100644
--- a/xfa/fxbarcode/cbc_onecode.h
+++ b/xfa/fxbarcode/cbc_onecode.h
@@ -18,24 +18,7 @@
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 7cb8275..0b7a558 100644
--- a/xfa/fxbarcode/cbc_pdf417i.cpp
+++ b/xfa/fxbarcode/cbc_pdf417i.cpp
@@ -61,9 +61,9 @@
}
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 @@
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 f38b416..0658ff7 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();
+ ~CBC_PDF417I() override;
- 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_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 41c252e..8faf5ad 100644
--- a/xfa/fxbarcode/cbc_qrcode.cpp
+++ b/xfa/fxbarcode/cbc_qrcode.cpp
@@ -71,9 +71,9 @@
}
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 @@
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 d77a23d..4038164 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();
+ ~CBC_QRCode() override;
- 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_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 38d4819..2c60c92 100644
--- a/xfa/fxbarcode/cbc_upca.cpp
+++ b/xfa/fxbarcode/cbc_upca.cpp
@@ -83,10 +83,10 @@
}
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 @@
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 3e0d24a..a2e0658 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 1f2ba62..c073930 100644
--- a/xfa/fxbarcode/oned/BC_OnedUPCAReader.h
+++ b/xfa/fxbarcode/oned/BC_OnedUPCAReader.h
@@ -43,7 +43,6 @@
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 f915e58..1c85aa1 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},
-};
-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};
+namespace {
-CBC_QRCoderFormatInformation::CBC_QRCoderFormatInformation(int32_t formatInfo) {
- m_errorCorrectLevl =
- CBC_QRCoderErrorCorrectionLevel::ForBits((formatInfo >> 3) & 0x03);
- m_dataMask = (uint8_t)(formatInfo & 0x07);
+const uint16_t FORMAT_INFO_MASK_QR = 0X5412;
+
+struct DecodeInfo {
+ uint16_t target;
+ uint16_t format;
+};
+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_dataMask(static_cast<uint8_t>(formatInfo & 0x07)) {
+ m_errorCorrectLevel =
+ CBC_QRCoderErrorCorrectionLevel::ForBits((formatInfo >> 3) & 0x03);
+}
+
CBC_QRCoderFormatInformation::~CBC_QRCoderFormatInformation() {}
int32_t CBC_QRCoderFormatInformation::NumBitsDiffering(int32_t a, int32_t b) {
a ^= b;
@@ -56,13 +89,17 @@
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 @@
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 a988d3b..b069795 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_