From e93dbd6c18b8b58e5d6b4813052fafbc323e9692 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 27 Oct 2016 13:10:24 -0700 Subject: Fix some FX_BOOL / int noise in XFA barcodes Review-Url: https://codereview.chromium.org/2447163007 --- xfa/fwl/core/cfwl_barcode.cpp | 30 +++++++++++++++--------------- xfa/fwl/core/cfwl_barcode.h | 40 +++++++++++++++++++++------------------- xfa/fwl/core/cfx_barcode.cpp | 2 +- xfa/fwl/core/cfx_barcode.h | 2 +- xfa/fwl/core/ifwl_barcode.h | 28 ++++++++++++++-------------- 5 files changed, 52 insertions(+), 50 deletions(-) (limited to 'xfa/fwl/core') diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp index 67cbc301bd..5a3f9dd545 100644 --- a/xfa/fwl/core/cfwl_barcode.cpp +++ b/xfa/fwl/core/cfwl_barcode.cpp @@ -54,58 +54,58 @@ FWL_Error CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget* pWidget, return FWL_Error::Succeeded; } -BC_CHAR_ENCODING CFWL_Barcode::CFWL_BarcodeDP::GetCharEncoding() { +BC_CHAR_ENCODING CFWL_Barcode::CFWL_BarcodeDP::GetCharEncoding() const { return m_eCharEncoding; } -int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleHeight() { +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleHeight() const { return m_nModuleHeight; } -int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleWidth() { +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetModuleWidth() const { return m_nModuleWidth; } -int32_t CFWL_Barcode::CFWL_BarcodeDP::GetDataLength() { +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetDataLength() const { return m_nDataLength; } -int32_t CFWL_Barcode::CFWL_BarcodeDP::GetCalChecksum() { - return m_nCalChecksum; +FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetCalChecksum() const { + return m_bCalChecksum; } -FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetPrintChecksum() { +FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetPrintChecksum() const { return m_bPrintChecksum; } -BC_TEXT_LOC CFWL_Barcode::CFWL_BarcodeDP::GetTextLocation() { +BC_TEXT_LOC CFWL_Barcode::CFWL_BarcodeDP::GetTextLocation() const { return m_eTextLocation; } -int32_t CFWL_Barcode::CFWL_BarcodeDP::GetWideNarrowRatio() { +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetWideNarrowRatio() const { return m_nWideNarrowRatio; } -FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetStartChar() { +FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetStartChar() const { return m_cStartChar; } -FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetEndChar() { +FX_CHAR CFWL_Barcode::CFWL_BarcodeDP::GetEndChar() const { return m_cEndChar; } -int32_t CFWL_Barcode::CFWL_BarcodeDP::GetVersion() { +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetVersion() const { return m_nVersion; } -int32_t CFWL_Barcode::CFWL_BarcodeDP::GetErrorCorrectionLevel() { +int32_t CFWL_Barcode::CFWL_BarcodeDP::GetErrorCorrectionLevel() const { return m_nECLevel; } -FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() { +FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const { return m_bTruncated; } -uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() { +uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() const { return m_dwAttributeMask; } diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index 39006676e9..aa6f8fccf4 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -43,9 +43,9 @@ class CFWL_Barcode : public CFWL_Edit { m_barcodeData.m_nDataLength = dataLength; GetWidget()->SetLimit(dataLength); } - void SetCalChecksum(int32_t calChecksum) { + void SetCalChecksum(FX_BOOL calChecksum) { m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM; - m_barcodeData.m_nCalChecksum = calChecksum; + m_barcodeData.m_bCalChecksum = calChecksum; } void SetPrintChecksum(FX_BOOL printChecksum) { m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM; @@ -93,29 +93,31 @@ class CFWL_Barcode : public CFWL_Edit { CFX_WideString& wsCaption) override; // IFWL_BarcodeDP - BC_CHAR_ENCODING GetCharEncoding() override; - int32_t GetModuleHeight() override; - int32_t GetModuleWidth() override; - int32_t GetDataLength() override; - int32_t GetCalChecksum() override; - FX_BOOL GetPrintChecksum() override; - BC_TEXT_LOC GetTextLocation() override; - int32_t GetWideNarrowRatio() override; - FX_CHAR GetStartChar() override; - FX_CHAR GetEndChar() override; - int32_t GetVersion() override; - int32_t GetErrorCorrectionLevel() override; - FX_BOOL GetTruncated() override; - uint32_t GetBarcodeAttributeMask() override; + BC_CHAR_ENCODING GetCharEncoding() const override; + int32_t GetModuleHeight() const override; + int32_t GetModuleWidth() const override; + int32_t GetDataLength() const override; + FX_BOOL GetCalChecksum() const override; + FX_BOOL GetPrintChecksum() const override; + BC_TEXT_LOC GetTextLocation() const override; + int32_t GetWideNarrowRatio() const override; + FX_CHAR GetStartChar() const override; + FX_CHAR GetEndChar() const override; + int32_t GetVersion() const override; + int32_t GetErrorCorrectionLevel() const override; + FX_BOOL GetTruncated() const override; + uint32_t GetBarcodeAttributeMask() const override; BC_CHAR_ENCODING m_eCharEncoding; - int32_t m_nModuleHeight, m_nModuleWidth; + int32_t m_nModuleHeight; + int32_t m_nModuleWidth; int32_t m_nDataLength; - int32_t m_nCalChecksum; + FX_BOOL m_bCalChecksum; FX_BOOL m_bPrintChecksum; BC_TEXT_LOC m_eTextLocation; int32_t m_nWideNarrowRatio; - FX_CHAR m_cStartChar, m_cEndChar; + FX_CHAR m_cStartChar; + FX_CHAR m_cEndChar; int32_t m_nVersion; int32_t m_nECLevel; FX_BOOL m_bTruncated; diff --git a/xfa/fwl/core/cfx_barcode.cpp b/xfa/fwl/core/cfx_barcode.cpp index 549f908229..f870833647 100644 --- a/xfa/fwl/core/cfx_barcode.cpp +++ b/xfa/fwl/core/cfx_barcode.cpp @@ -132,7 +132,7 @@ FX_BOOL CFX_Barcode::SetDataLength(int32_t length) { return FALSE; } } -FX_BOOL CFX_Barcode::SetCalChecksum(int32_t state) { +FX_BOOL CFX_Barcode::SetCalChecksum(FX_BOOL state) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: diff --git a/xfa/fwl/core/cfx_barcode.h b/xfa/fwl/core/cfx_barcode.h index 389ff52042..8a6a10adc2 100644 --- a/xfa/fwl/core/cfx_barcode.h +++ b/xfa/fwl/core/cfx_barcode.h @@ -40,7 +40,7 @@ class CFX_Barcode { FX_BOOL CheckContentValidity(const CFX_WideStringC& contents); FX_BOOL SetPrintChecksum(FX_BOOL checksum); FX_BOOL SetDataLength(int32_t length); - FX_BOOL SetCalChecksum(int32_t state); + FX_BOOL SetCalChecksum(FX_BOOL state); FX_BOOL SetFont(CFX_Font* pFont); FX_BOOL SetFontSize(FX_FLOAT size); FX_BOOL SetFontStyle(int32_t style); diff --git a/xfa/fwl/core/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h index 2313f86d36..5bc800d9a1 100644 --- a/xfa/fwl/core/ifwl_barcode.h +++ b/xfa/fwl/core/ifwl_barcode.h @@ -40,20 +40,20 @@ enum FWL_BCDAttribute { class IFWL_BarcodeDP : public IFWL_EditDP { public: - virtual BC_CHAR_ENCODING GetCharEncoding() = 0; - virtual int32_t GetModuleHeight() = 0; - virtual int32_t GetModuleWidth() = 0; - virtual int32_t GetDataLength() = 0; - virtual int32_t GetCalChecksum() = 0; - virtual FX_BOOL GetPrintChecksum() = 0; - virtual BC_TEXT_LOC GetTextLocation() = 0; - virtual int32_t GetWideNarrowRatio() = 0; - virtual FX_CHAR GetStartChar() = 0; - virtual FX_CHAR GetEndChar() = 0; - virtual int32_t GetVersion() = 0; - virtual int32_t GetErrorCorrectionLevel() = 0; - virtual FX_BOOL GetTruncated() = 0; - virtual uint32_t GetBarcodeAttributeMask() = 0; + virtual BC_CHAR_ENCODING GetCharEncoding() const = 0; + virtual int32_t GetModuleHeight() const = 0; + virtual int32_t GetModuleWidth() const = 0; + virtual int32_t GetDataLength() const = 0; + virtual FX_BOOL GetCalChecksum() const = 0; + virtual FX_BOOL GetPrintChecksum() const = 0; + virtual BC_TEXT_LOC GetTextLocation() const = 0; + virtual int32_t GetWideNarrowRatio() const = 0; + virtual FX_CHAR GetStartChar() const = 0; + virtual FX_CHAR GetEndChar() const = 0; + virtual int32_t GetVersion() const = 0; + virtual int32_t GetErrorCorrectionLevel() const = 0; + virtual FX_BOOL GetTruncated() const = 0; + virtual uint32_t GetBarcodeAttributeMask() const = 0; }; class IFWL_Barcode : public IFWL_Edit { -- cgit v1.2.3