diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-26 14:31:56 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-26 14:31:56 -0800 |
commit | 007e6c0f9559412788b903bcb6a7601e220c3be8 (patch) | |
tree | a2c6bb85eaa2b63fd24ed70fd3c6ddad54e219d5 | |
parent | 281a9eadff15b167e2ee3032e21b83190ad49125 (diff) | |
download | pdfium-007e6c0f9559412788b903bcb6a7601e220c3be8.tar.xz |
Remove some FX_BOOLs
Grepping for FX_BOOL and |==| on the same line gives
a very strong clue that the expression won't be out
of range of the |bool| type iteself.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1736323003 .
45 files changed, 159 insertions, 210 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index 129eebfcfc..5791b7e6b3 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -445,7 +445,7 @@ class CPDF_Stream : public CPDF_Object { uint8_t* pBuf, FX_DWORD buf_size) const; - FX_BOOL IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; } + bool IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; } protected: static const FX_DWORD kMemoryBasedGenNum = (FX_DWORD)-1; diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h index 3d98e34578..973a28030f 100644 --- a/core/include/fpdfapi/fpdf_page.h +++ b/core/include/fpdfapi/fpdf_page.h @@ -39,7 +39,7 @@ class CPDF_PageObjectHolder { CPDF_PageObjectHolder(); void ContinueParse(IFX_Pause* pPause); - FX_BOOL IsParsed() const { return m_ParseState == CONTENT_PARSED; } + bool IsParsed() const { return m_ParseState == CONTENT_PARSED; } CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; } const CPDF_PageObjectList* GetPageObjectList() const { diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h index b2e64cd2ed..8a2e7e93aa 100644 --- a/core/include/fpdfdoc/fpdf_vt.h +++ b/core/include/fpdfdoc/fpdf_vt.h @@ -32,15 +32,12 @@ struct CPVT_WordPlace { void Default() { nSecIndex = nLineIndex = nWordIndex = -1; } - FX_BOOL operator==(const CPVT_WordPlace& wp) const { + bool operator==(const CPVT_WordPlace& wp) const { return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex && wp.nWordIndex == nWordIndex; } - FX_BOOL operator!=(const CPVT_WordPlace& wp) const { - return wp.nSecIndex != nSecIndex || wp.nLineIndex != nLineIndex || - wp.nWordIndex != nWordIndex; - } + FX_BOOL operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); } inline int32_t WordCmp(const CPVT_WordPlace& wp) const { if (nSecIndex > wp.nSecIndex) { diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 01bb6e2c76..6e092dd540 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -601,20 +601,16 @@ class CFX_MapPtrToPtr { protected: struct CAssoc { CAssoc* pNext; - void* key; - void* value; }; public: CFX_MapPtrToPtr(int nBlockSize = 10); - ~CFX_MapPtrToPtr(); int GetCount() const { return m_nCount; } - - FX_BOOL IsEmpty() const { return m_nCount == 0; } + bool IsEmpty() const { return m_nCount == 0; } FX_BOOL Lookup(void* key, void*& rValue) const; @@ -961,9 +957,7 @@ class CFX_CountRef { m_pObject = NULL; } - FX_BOOL operator==(const Ref& ref) const { - return m_pObject == ref.m_pObject; - } + bool operator==(const Ref& ref) const { return m_pObject == ref.m_pObject; } protected: CountedObj* m_pObject; diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index 30770309a0..c6bf230014 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -333,13 +333,12 @@ class CFX_RTemplate { rect.Intersect(*this); return !rect.IsEmpty(fEpsilon); } - friend FX_BOOL operator==(const FXT_RECT& rc1, const FXT_RECT& rc2) { + friend bool operator==(const FXT_RECT& rc1, const FXT_RECT& rc2) { return rc1.left == rc2.left && rc1.top == rc2.top && rc1.width == rc2.width && rc1.height == rc2.height; } - friend FX_BOOL operator!=(const FXT_RECT& rc1, const FXT_RECT& rc2) { - return rc1.left != rc2.left || rc1.top != rc2.top || - rc1.width != rc2.width || rc1.height != rc2.height; + friend bool operator!=(const FXT_RECT& rc1, const FXT_RECT& rc2) { + return !(rc1 == rc2); } baseType left, top; baseType width, height; @@ -385,7 +384,7 @@ struct FX_RECT { void Union(const FX_RECT& other_rect); - FX_BOOL operator==(const FX_RECT& src) const { + bool operator==(const FX_RECT& src) const { return left == src.left && right == src.right && top == src.top && bottom == src.bottom; } diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h index 3043e7547c..e39bad2b87 100644 --- a/core/include/fxge/fx_dib.h +++ b/core/include/fxge/fx_dib.h @@ -199,13 +199,10 @@ class CFX_DIBSource { // TODO(thestig): Investigate this. Given the possible values of FXDIB_Format, // it feels as though this should be implemented as !!(m_AlphaFlag & 1) and // IsOpaqueImage() below should never be able to return TRUE. - FX_BOOL IsAlphaMask() const { return m_AlphaFlag == 1; } - - FX_BOOL HasAlpha() const { return !!(m_AlphaFlag & 2); } - - FX_BOOL IsOpaqueImage() const { return !(m_AlphaFlag & 3); } - - FX_BOOL IsCmykImage() const { return !!(m_AlphaFlag & 4); } + bool IsAlphaMask() const { return m_AlphaFlag == 1; } + bool HasAlpha() const { return !!(m_AlphaFlag & 2); } + bool IsOpaqueImage() const { return !(m_AlphaFlag & 3); } + bool IsCmykImage() const { return !!(m_AlphaFlag & 4); } int GetPaletteSize() const { return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index f103786350..878dc2ab2a 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -1270,7 +1270,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) { FX_BOOL bExistInMap = pdfium::ContainsKey(m_pDocument->m_IndirectObjs, objnum); const uint8_t object_type = m_pParser->GetObjectType(objnum); - FX_BOOL bObjStm = (object_type == 2) && m_pEncryptDict && !m_pXRefStream; + bool bObjStm = (object_type == 2) && m_pEncryptDict && !m_pXRefStream; if (m_pParser->IsVersionUpdated() || m_bSecurityChanged || bExistInMap || bObjStm) { CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum); @@ -1547,7 +1547,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { m_pParser->GetLastXRefOffset() == 0) { InitOldObjNumOffsets(); FX_DWORD dwEnd = m_pParser->GetLastObjNum(); - FX_BOOL bObjStm = (m_dwFlags & FPDFCREATE_OBJECTSTREAM) != 0; + bool bObjStm = (m_dwFlags & FPDFCREATE_OBJECTSTREAM) != 0; for (FX_DWORD objnum = 0; objnum <= dwEnd; objnum++) { if (m_pParser->IsObjectFreeOrNull(objnum)) continue; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 3595c99428..bcac9d87d4 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -263,10 +263,10 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, if ((pLogFont->lfPitchAndFamily & 0xf8) == FF_SCRIPT) { flags |= PDFFONT_SCRIPT; } - FX_BOOL bCJK = pLogFont->lfCharSet == CHINESEBIG5_CHARSET || - pLogFont->lfCharSet == GB2312_CHARSET || - pLogFont->lfCharSet == HANGEUL_CHARSET || - pLogFont->lfCharSet == SHIFTJIS_CHARSET; + bool bCJK = pLogFont->lfCharSet == CHINESEBIG5_CHARSET || + pLogFont->lfCharSet == GB2312_CHARSET || + pLogFont->lfCharSet == HANGEUL_CHARSET || + pLogFont->lfCharSet == SHIFTJIS_CHARSET; CFX_ByteString basefont; if (bTranslateName && bCJK) { basefont = _FPDF_GetPSNameFromTT(hDC); @@ -828,10 +828,10 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { if (!pFont) { return NULL; } - FX_BOOL bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || - charset == FXFONT_GB2312_CHARSET || - charset == FXFONT_HANGEUL_CHARSET || - charset == FXFONT_SHIFTJIS_CHARSET; + bool bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || + charset == FXFONT_GB2312_CHARSET || + charset == FXFONT_HANGEUL_CHARSET || + charset == FXFONT_SHIFTJIS_CHARSET; CFX_ByteString basefont = pFont->GetFamilyName(); basefont.Replace(" ", ""); int flags = 0; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index e6106441fe..d56e65c084 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -271,9 +271,9 @@ CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream, return CFX_FloatRect(0, 0, 0, 0); CFX_FloatRect rect; - FX_BOOL bStarted = FALSE; - FX_BOOL bGouraud = type == kFreeFormGouraudTriangleMeshShading || - type == kLatticeFormGouraudTriangleMeshShading; + bool bStarted = false; + bool bGouraud = type == kFreeFormGouraudTriangleMeshShading || + type == kLatticeFormGouraudTriangleMeshShading; int point_count = kSingleCoordinatePair; if (type == kTensorProductPatchMeshShading) diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index cc9a998e57..5998a9236c 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -723,18 +723,18 @@ struct CPDF_PatchDrawer { } }; -FX_BOOL _CheckCoonTensorPara(const CPDF_MeshStream& stream) { - FX_BOOL bCoorBits = (stream.m_nCoordBits == 1 || stream.m_nCoordBits == 2 || - stream.m_nCoordBits == 4 || stream.m_nCoordBits == 8 || - stream.m_nCoordBits == 12 || stream.m_nCoordBits == 16 || - stream.m_nCoordBits == 24 || stream.m_nCoordBits == 32); +bool _CheckCoonTensorPara(const CPDF_MeshStream& stream) { + bool bCoorBits = (stream.m_nCoordBits == 1 || stream.m_nCoordBits == 2 || + stream.m_nCoordBits == 4 || stream.m_nCoordBits == 8 || + stream.m_nCoordBits == 12 || stream.m_nCoordBits == 16 || + stream.m_nCoordBits == 24 || stream.m_nCoordBits == 32); - FX_BOOL bCompBits = (stream.m_nCompBits == 1 || stream.m_nCompBits == 2 || - stream.m_nCompBits == 4 || stream.m_nCompBits == 8 || - stream.m_nCompBits == 12 || stream.m_nCompBits == 16); + bool bCompBits = (stream.m_nCompBits == 1 || stream.m_nCompBits == 2 || + stream.m_nCompBits == 4 || stream.m_nCompBits == 8 || + stream.m_nCompBits == 12 || stream.m_nCompBits == 16); - FX_BOOL bFlagBits = (stream.m_nFlagBits == 2 || stream.m_nFlagBits == 4 || - stream.m_nFlagBits == 8); + bool bFlagBits = (stream.m_nFlagBits == 2 || stream.m_nFlagBits == 4 || + stream.m_nFlagBits == 8); return bCoorBits && bCompBits && bFlagBits; } diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index dcd21be66e..09b6e8d673 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -55,7 +55,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect) { for (CPDF_Annot* pAnnot : m_AnnotList) { - FX_BOOL bWidget = pAnnot->GetSubType() == "Widget"; + bool bWidget = pAnnot->GetSubType() == "Widget"; if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget)) continue; @@ -255,8 +255,8 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, if (annot_flags & ANNOTFLAG_HIDDEN) { return; } - FX_BOOL bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || - (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW)); + bool bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || + (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW)); if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) { return; } diff --git a/core/src/fxcodec/codec/fx_codec_progress.cpp b/core/src/fxcodec/codec/fx_codec_progress.cpp index fbbfaaf0fa..5d8502a87a 100644 --- a/core/src/fxcodec/codec/fx_codec_progress.cpp +++ b/core/src/fxcodec/codec/fx_codec_progress.cpp @@ -710,7 +710,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, pal_index = pCodec->m_GifTransIndex; } FXSYS_memset(pCodec->m_pDecodeBuf, pal_index, pCodec->m_SrcWidth); - FX_BOOL bLastPass = (row_num % 2) == 1; + bool bLastPass = (row_num % 2) == 1; int32_t line = row_num + pCodec->m_GifFrameRect.top; int32_t left = pCodec->m_GifFrameRect.left; FXSYS_memcpy(pCodec->m_pDecodeBuf + left, row_buf, img_width); diff --git a/core/src/fxcrt/fx_arabic.cpp b/core/src/fxcrt/fx_arabic.cpp index 953e74ca76..e611be0c52 100644 --- a/core/src/fxcrt/fx_arabic.cpp +++ b/core/src/fxcrt/fx_arabic.cpp @@ -276,7 +276,7 @@ FX_WCHAR CFX_ArabicChar::GetFormChar(const CFX_Char* cur, FX_CHARTYPE eNext; FX_WCHAR wNext; ParseChar(next, wNext, eNext); - FX_BOOL bAlef = (eNext == FX_CHARTYPE_ArabicAlef && wCur == 0x644); + bool bAlef = (eNext == FX_CHARTYPE_ArabicAlef && wCur == 0x644); if (ePrev < FX_CHARTYPE_ArabicAlef) { if (bAlef) { return FX_GetArabicFromAlefTable(wNext); diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index 2d4a2c726b..b37343b9e5 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -280,7 +280,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, if (dwFaceName == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME1; } - FX_BOOL bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1); + bool bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1); if ((dwStyle & FXFONT_BOLD) == (pFontDes->m_dwStyle & FXFONT_BOLD)) { nFind += FPF_SKIAMATCHWEIGHT_1; } @@ -299,7 +299,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, } if (dwSubst == dwSysFontName || dwSubstSans == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME2; - bMatchedName = TRUE; + bMatchedName = true; } if (uCharset == FXFONT_DEFAULT_CHARSET || bMaybeSymbol) { if (nFind > nMax && bMatchedName) { diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index 6068dffe75..8bf36e523a 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -4907,7 +4907,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, } int Bpp = m_bpp / 8; FX_BOOL bAlpha = HasAlpha(); - FX_BOOL bArgb = GetFormat() == FXDIB_Argb; + bool bArgb = GetFormat() == FXDIB_Argb; if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row++) { uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index ae426b093c..8d54363d14 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -1173,7 +1173,7 @@ CFX_FontCache::~CFX_FontCache() { CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) { FXFT_Face internal_face = pFont->GetFace(); - const FX_BOOL bExternal = internal_face == nullptr; + const bool bExternal = !internal_face; FXFT_Face face = bExternal ? (FXFT_Face)pFont->GetSubstFont()->m_ExtHandle : internal_face; CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap; @@ -1194,7 +1194,7 @@ CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) { void CFX_FontCache::ReleaseCachedFace(CFX_Font* pFont) { FXFT_Face internal_face = pFont->GetFace(); - const FX_BOOL bExternal = internal_face == nullptr; + const bool bExternal = !internal_face; FXFT_Face face = bExternal ? (FXFT_Face)pFont->GetSubstFont()->m_ExtHandle : internal_face; CFX_FTCacheMap& map = bExternal ? m_ExtFaceMap : m_FTFaceMap; diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 58f8769ac7..e9fee082b9 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -1103,8 +1103,7 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, int alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); - FX_BOOL bGDI = pSource->GetBPP() == 1 && alpha == 255; - if (!bGDI) { + if (pSource->GetBPP() != 1 || alpha != 255) { CFX_DIBitmap background; if (!background.Create(width, height, FXDIB_Rgb32) || !GetDIBits(&background, left, top, NULL) || diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index c0ed529782..8cee331f64 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -36,19 +36,19 @@ class CPDFSDK_DateTime { CPDFSDK_DateTime& operator=(const CPDFSDK_DateTime& datetime); CPDFSDK_DateTime& operator=(const FX_SYSTEMTIME& st); - FX_BOOL operator==(CPDFSDK_DateTime& datetime); - FX_BOOL operator!=(CPDFSDK_DateTime& datetime); - FX_BOOL operator>(CPDFSDK_DateTime& datetime); - FX_BOOL operator>=(CPDFSDK_DateTime& datetime); - FX_BOOL operator<(CPDFSDK_DateTime& datetime); - FX_BOOL operator<=(CPDFSDK_DateTime& datetime); + bool operator==(const CPDFSDK_DateTime& datetime) const; + bool operator!=(const CPDFSDK_DateTime& datetime) const; + bool operator>(const CPDFSDK_DateTime& datetime) const; + bool operator>=(const CPDFSDK_DateTime& datetime) const; + bool operator<(const CPDFSDK_DateTime& datetime) const; + bool operator<=(const CPDFSDK_DateTime& datetime) const; operator time_t(); CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr); CFX_ByteString ToCommonDateTimeString(); CFX_ByteString ToPDFDateTimeString(); void ToSystemTime(FX_SYSTEMTIME& st); - CPDFSDK_DateTime ToGMT(); + CPDFSDK_DateTime ToGMT() const; CPDFSDK_DateTime& AddDays(short days); CPDFSDK_DateTime& AddSeconds(int seconds); diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h index 88d57c4928..a02cd8a45e 100644 --- a/fpdfsdk/include/fxedit/fxet_list.h +++ b/fpdfsdk/include/fxedit/fxet_list.h @@ -67,13 +67,11 @@ class CLST_Rect : public CFX_FloatRect { return *this; } - FX_BOOL operator==(const CLST_Rect& rect) const { + bool operator==(const CLST_Rect& rect) const { return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0; } - FX_BOOL operator!=(const CLST_Rect& rect) const { - return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0; - } + bool operator!=(const CLST_Rect& rect) const { return !(*this == rect); } FX_FLOAT Width() const { return right - left; } diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h index 19046e6c9c..493cdc0874 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h @@ -134,7 +134,7 @@ struct CPWL_Color { FX_FLOAT fColor1, fColor2, fColor3, fColor4; }; -inline FX_BOOL operator==(const CPWL_Color& c1, const CPWL_Color& c2) { +inline bool operator==(const CPWL_Color& c1, const CPWL_Color& c2) { return c1.nColorType == c2.nColorType && c1.fColor1 - c2.fColor1 < 0.0001 && c1.fColor1 - c2.fColor1 > -0.0001 && c1.fColor2 - c2.fColor2 < 0.0001 && @@ -144,8 +144,8 @@ inline FX_BOOL operator==(const CPWL_Color& c1, const CPWL_Color& c2) { c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001; } -inline FX_BOOL operator!=(const CPWL_Color& c1, const CPWL_Color& c2) { - return !operator==(c1, c2); +inline bool operator!=(const CPWL_Color& c1, const CPWL_Color& c2) { + return !(c1 == c2); } #define PWL_SCROLLBAR_WIDTH 12.0f diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp index bba44ab639..b28cdf7749 100644 --- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp @@ -196,9 +196,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) { CPDF_Dictionary* pAcroFormDict = NULL; - - FX_BOOL bWidget = (m_pAnnotDict->GetStringBy("Subtype") == "Widget"); - + const bool bWidget = (m_pAnnotDict->GetStringBy("Subtype") == "Widget"); if (bWidget) { if (CPDF_Dictionary* pRootDict = m_pDocument->GetRoot()) pAcroFormDict = pRootDict->GetDictBy("AcroForm"); diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index 705205f1e2..132d30b857 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -85,9 +85,7 @@ void CPDFSDK_DateTime::ResetDateTime() { time_t curTime; time(&curTime); - struct tm* newtime; - // newtime = gmtime(&curTime); - newtime = localtime(&curTime); + struct tm* newtime = localtime(&curTime); dt.year = newtime->tm_year + 1900; dt.month = newtime->tm_mon + 1; @@ -95,8 +93,6 @@ void CPDFSDK_DateTime::ResetDateTime() { dt.hour = newtime->tm_hour; dt.minute = newtime->tm_min; dt.second = newtime->tm_sec; - // dt.tzHour = _timezone / 3600 * -1; - // dt.tzMinute = (abs(_timezone) % 3600) / 60; } CPDFSDK_DateTime& CPDFSDK_DateTime::operator=( @@ -114,20 +110,18 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::operator=(const FX_SYSTEMTIME& st) { dt.hour = (uint8_t)st.wHour; dt.minute = (uint8_t)st.wMinute; dt.second = (uint8_t)st.wSecond; - // dt.tzHour = _timezone / 3600 * -1; - // dt.tzMinute = (abs(_timezone) % 3600) / 60; return *this; } -FX_BOOL CPDFSDK_DateTime::operator==(CPDFSDK_DateTime& datetime) { +bool CPDFSDK_DateTime::operator==(const CPDFSDK_DateTime& datetime) const { return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0); } -FX_BOOL CPDFSDK_DateTime::operator!=(CPDFSDK_DateTime& datetime) { - return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) != 0); +bool CPDFSDK_DateTime::operator!=(const CPDFSDK_DateTime& datetime) const { + return !(*this == datetime); } -FX_BOOL CPDFSDK_DateTime::operator>(CPDFSDK_DateTime& datetime) { +bool CPDFSDK_DateTime::operator>(const CPDFSDK_DateTime& datetime) const { CPDFSDK_DateTime dt1 = ToGMT(); CPDFSDK_DateTime dt2 = datetime.ToGMT(); int d1 = @@ -139,14 +133,10 @@ FX_BOOL CPDFSDK_DateTime::operator>(CPDFSDK_DateTime& datetime) { int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2.dt.second; - if (d1 > d3) - return TRUE; - if (d2 > d4) - return TRUE; - return FALSE; + return d1 > d3 || d2 > d4; } -FX_BOOL CPDFSDK_DateTime::operator>=(CPDFSDK_DateTime& datetime) { +bool CPDFSDK_DateTime::operator>=(const CPDFSDK_DateTime& datetime) const { CPDFSDK_DateTime dt1 = ToGMT(); CPDFSDK_DateTime dt2 = datetime.ToGMT(); int d1 = @@ -158,14 +148,10 @@ FX_BOOL CPDFSDK_DateTime::operator>=(CPDFSDK_DateTime& datetime) { int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2.dt.second; - if (d1 >= d3) - return TRUE; - if (d2 >= d4) - return TRUE; - return FALSE; + return d1 >= d3 || d2 >= d4; } -FX_BOOL CPDFSDK_DateTime::operator<(CPDFSDK_DateTime& datetime) { +bool CPDFSDK_DateTime::operator<(const CPDFSDK_DateTime& datetime) const { CPDFSDK_DateTime dt1 = ToGMT(); CPDFSDK_DateTime dt2 = datetime.ToGMT(); int d1 = @@ -177,14 +163,10 @@ FX_BOOL CPDFSDK_DateTime::operator<(CPDFSDK_DateTime& datetime) { int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2.dt.second; - if (d1 < d3) - return TRUE; - if (d2 < d4) - return TRUE; - return FALSE; + return d1 < d3 || d2 < d4; } -FX_BOOL CPDFSDK_DateTime::operator<=(CPDFSDK_DateTime& datetime) { +bool CPDFSDK_DateTime::operator<=(const CPDFSDK_DateTime& datetime) const { CPDFSDK_DateTime dt1 = ToGMT(); CPDFSDK_DateTime dt2 = datetime.ToGMT(); int d1 = @@ -196,11 +178,7 @@ FX_BOOL CPDFSDK_DateTime::operator<=(CPDFSDK_DateTime& datetime) { int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2.dt.second; - if (d1 <= d3) - return TRUE; - if (d2 <= d4) - return TRUE; - return FALSE; + return d1 <= d3 || d2 <= d4; } CPDFSDK_DateTime::operator time_t() { @@ -402,7 +380,7 @@ void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { } } -CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() { +CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() const { CPDFSDK_DateTime dt = *this; dt.AddSeconds(-gAfxGetTimeZoneInSeconds(dt.dt.tzHour, dt.dt.tzMinute)); dt.dt.tzHour = 0; diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 0359c0bc9f..79180324f7 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -662,10 +662,8 @@ FX_BOOL CPDFSDK_Widget::IsChecked() const { #ifdef PDF_ENABLE_XFA if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { if (IXFA_Widget* hWidget = GetMixXFAWidget()) { - if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { - FX_BOOL bChecked = pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On; - return bChecked; - } + if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) + return pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On; } } #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp index 752e537099..d7803311a5 100644 --- a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp @@ -151,10 +151,8 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData) { - FX_BOOL bContinuous = pEdit->GetCharArray() == 0; - if (pEdit->GetCharSpace() > 0.0f) - bContinuous = FALSE; - + const bool bContinuous = + pEdit->GetCharArray() == 0 && pEdit->GetCharSpace() <= 0.0f; FX_WORD SubWord = pEdit->GetPasswordChar(); FX_FLOAT fFontSize = pEdit->GetFontSize(); CPVT_WordRange wrSelect = pEdit->GetSelectWordRange(); diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 8b2b315ae8..4d774426f0 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -622,8 +622,7 @@ FX_BOOL Document::submitForm(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); - FX_BOOL bAll = (aFields.GetLength() == 0); - if (bAll && bEmpty) { + if (aFields.GetLength() == 0 && bEmpty) { if (pPDFInterForm->CheckRequiredFields(nullptr, true)) { pRuntime->BeginBlock(); pInterForm->SubmitForm(strURL, FALSE); diff --git a/xfa/include/fxfa/fxfa_objectacc.h b/xfa/include/fxfa/fxfa_objectacc.h index b471b5707b..f5cc5abf35 100644 --- a/xfa/include/fxfa/fxfa_objectacc.h +++ b/xfa/include/fxfa/fxfa_objectacc.h @@ -458,13 +458,10 @@ class CXFA_Stroke : public CXFA_Data { public: explicit CXFA_Stroke(CXFA_Node* pNode) : CXFA_Data(pNode) {} - FX_BOOL IsCorner() const { return GetClassID() == XFA_ELEMENT_Corner; } - FX_BOOL IsEdge() const { return GetClassID() == XFA_ELEMENT_Edge; } + bool IsCorner() const { return GetClassID() == XFA_ELEMENT_Corner; } + bool IsEdge() const { return GetClassID() == XFA_ELEMENT_Edge; } + bool IsVisible() const { return GetPresence() == XFA_ATTRIBUTEENUM_Visible; } int32_t GetPresence() const; - FX_BOOL IsVisible() const { - return GetPresence() == XFA_ATTRIBUTEENUM_Visible; - } - int32_t GetCapType() const; int32_t GetStrokeType() const; FX_FLOAT GetThickness() const; @@ -497,9 +494,9 @@ class CXFA_Box : public CXFA_Data { public: explicit CXFA_Box(CXFA_Node* pNode) : CXFA_Data(pNode) {} - FX_BOOL IsArc() const { return GetClassID() == XFA_ELEMENT_Arc; } - FX_BOOL IsBorder() const { return GetClassID() == XFA_ELEMENT_Border; } - FX_BOOL IsRectangle() const { return GetClassID() == XFA_ELEMENT_Rectangle; } + bool IsArc() const { return GetClassID() == XFA_ELEMENT_Arc; } + bool IsBorder() const { return GetClassID() == XFA_ELEMENT_Border; } + bool IsRectangle() const { return GetClassID() == XFA_ELEMENT_Rectangle; } int32_t GetBreak() const; int32_t GetHand() const; int32_t GetPresence() const; diff --git a/xfa/src/fgas/include/fx_datetime.h b/xfa/src/fgas/include/fx_datetime.h index 89b8a92d13..fa1ff6e16a 100644 --- a/xfa/src/fgas/include/fx_datetime.h +++ b/xfa/src/fgas/include/fx_datetime.h @@ -102,58 +102,58 @@ class CFX_Unitime { friend CFX_Unitime operator-(FX_UNITIME t1, const CFX_Unitime& t2) { return CFX_Unitime(t1 + t2.m_iUnitime); } - friend FX_BOOL operator==(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator==(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime == t2.m_iUnitime; } - friend FX_BOOL operator==(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator==(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime == t2; } - friend FX_BOOL operator==(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator==(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 == t2.m_iUnitime; } - friend FX_BOOL operator!=(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator!=(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime != t2.m_iUnitime; } - friend FX_BOOL operator!=(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator!=(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime != t2; } - friend FX_BOOL operator!=(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator!=(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 != t2.m_iUnitime; } - friend FX_BOOL operator>(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator>(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime > t2.m_iUnitime; } - friend FX_BOOL operator>(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator>(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime > t2; } - friend FX_BOOL operator>(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator>(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 > t2.m_iUnitime; } - friend FX_BOOL operator>=(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator>=(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime >= t2.m_iUnitime; } - friend FX_BOOL operator>=(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator>=(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime >= t2; } - friend FX_BOOL operator>=(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator>=(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 >= t2.m_iUnitime; } - friend FX_BOOL operator<(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator<(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime < t2.m_iUnitime; } - friend FX_BOOL operator<(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator<(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime < t2; } - friend FX_BOOL operator<(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator<(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 < t2.m_iUnitime; } - friend FX_BOOL operator<=(const CFX_Unitime& t1, const CFX_Unitime& t2) { + friend bool operator<=(const CFX_Unitime& t1, const CFX_Unitime& t2) { return t1.m_iUnitime <= t2.m_iUnitime; } - friend FX_BOOL operator<=(const CFX_Unitime& t1, FX_UNITIME t2) { + friend bool operator<=(const CFX_Unitime& t1, FX_UNITIME t2) { return t1.m_iUnitime <= t2; } - friend FX_BOOL operator<=(FX_UNITIME t1, const CFX_Unitime& t2) { + friend bool operator<=(FX_UNITIME t1, const CFX_Unitime& t2) { return t1 <= t2.m_iUnitime; } diff --git a/xfa/src/fgas/include/fx_fnt.h b/xfa/src/fgas/include/fx_fnt.h index 78c9b5ee13..efb1b03b33 100644 --- a/xfa/src/fgas/include/fx_fnt.h +++ b/xfa/src/fgas/include/fx_fnt.h @@ -123,8 +123,8 @@ typedef struct _FX_FONTDESCRIPTOR : public CFX_Target { } FX_FONTDESCRIPTOR, *FX_LPFONTDESCRIPTOR; typedef FX_FONTDESCRIPTOR const* FX_LPCFONTDESCRIPTOR; typedef CFX_MassArrayTemplate<FX_FONTDESCRIPTOR> CFX_FontDescriptors; -inline FX_BOOL operator==(const FX_FONTDESCRIPTOR& left, - const FX_FONTDESCRIPTOR& right) { +inline bool operator==(const FX_FONTDESCRIPTOR& left, + const FX_FONTDESCRIPTOR& right) { return left.uCharSet == right.uCharSet && left.dwFontStyles == right.dwFontStyles && FXSYS_wcscmp(left.wsFontFace, right.wsFontFace) == 0 && diff --git a/xfa/src/fgas/include/fx_locale.h b/xfa/src/fgas/include/fx_locale.h index cf35491f9b..c558af62d0 100644 --- a/xfa/src/fgas/include/fx_locale.h +++ b/xfa/src/fgas/include/fx_locale.h @@ -164,12 +164,12 @@ class CFX_Decimal { CFX_Decimal(const CFX_ByteStringC& str); operator CFX_WideString() const; operator double() const; - FX_BOOL operator==(const CFX_Decimal& val) const; - FX_BOOL operator<=(const CFX_Decimal& val) const; - FX_BOOL operator>=(const CFX_Decimal& val) const; - FX_BOOL operator!=(const CFX_Decimal& val) const; - FX_BOOL operator<(const CFX_Decimal& val) const; - FX_BOOL operator>(const CFX_Decimal& val) const; + bool operator==(const CFX_Decimal& val) const; + bool operator<=(const CFX_Decimal& val) const; + bool operator>=(const CFX_Decimal& val) const; + bool operator!=(const CFX_Decimal& val) const; + bool operator<(const CFX_Decimal& val) const; + bool operator>(const CFX_Decimal& val) const; CFX_Decimal operator+(const CFX_Decimal& val) const; CFX_Decimal operator-(const CFX_Decimal& val) const; CFX_Decimal operator*(const CFX_Decimal& val) const; diff --git a/xfa/src/fgas/include/fx_utl.h b/xfa/src/fgas/include/fx_utl.h index e95d82005a..8ce736569d 100644 --- a/xfa/src/fgas/include/fx_utl.h +++ b/xfa/src/fgas/include/fx_utl.h @@ -664,7 +664,7 @@ class CFX_CPLTreeNode : public CFX_Target { } return iLevel; } - FX_BOOL IsRootNode() const { return m_pParentNode == NULL; } + bool IsRootNode() const { return !m_pParentNode; } baseType GetData() const { return m_Data; } void SetData(baseType data) { m_Data = data; } diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.h b/xfa/src/fgas/src/font/fx_stdfontmgr.h index 55359de829..de0291e2ef 100644 --- a/xfa/src/fgas/src/font/fx_stdfontmgr.h +++ b/xfa/src/fgas/src/font/fx_stdfontmgr.h @@ -102,13 +102,13 @@ struct FX_FontDescriptorInfo { public: CFX_FontDescriptor* pFont; int32_t nPenalty; - FX_BOOL operator>(const FX_FontDescriptorInfo& x) { + bool operator>(const FX_FontDescriptorInfo& x) { return nPenalty > x.nPenalty; }; - FX_BOOL operator<(const FX_FontDescriptorInfo& x) { + bool operator<(const FX_FontDescriptorInfo& x) { return nPenalty < x.nPenalty; }; - FX_BOOL operator==(const FX_FontDescriptorInfo& x) { + bool operator==(const FX_FontDescriptorInfo& x) { return nPenalty == x.nPenalty; }; }; diff --git a/xfa/src/fgas/src/localization/fx_locale.cpp b/xfa/src/fgas/src/localization/fx_locale.cpp index ca12dbb69e..fe9ec3f8dd 100644 --- a/xfa/src/fgas/src/localization/fx_locale.cpp +++ b/xfa/src/fgas/src/localization/fx_locale.cpp @@ -4980,9 +4980,8 @@ CFX_Decimal CFX_Decimal::AddOrMinus(const CFX_Decimal& val, if (!isAdding) { rhs.SetNegate(); } - FX_BOOL doRawAdd = (FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags) == - FXMATH_DECIMAL_FLAGS2NEG(rhs.m_uFlags)); - if (doRawAdd) { + if (FXMATH_DECIMAL_FLAGS2NEG(lhs.m_uFlags) == + FXMATH_DECIMAL_FLAGS2NEG(rhs.m_uFlags)) { uint64_t phi = lhs.m_uHi, pmid = lhs.m_uMid, plo = lhs.m_uLo; phi += rhs.m_uHi; pmid += rhs.m_uMid; @@ -5087,22 +5086,22 @@ CFX_Decimal CFX_Decimal::Modulus(const CFX_Decimal& val) const { } return lhs; } -FX_BOOL CFX_Decimal::operator==(const CFX_Decimal& val) const { +bool CFX_Decimal::operator==(const CFX_Decimal& val) const { return Compare(val) == 0; } -FX_BOOL CFX_Decimal::operator<=(const CFX_Decimal& val) const { +bool CFX_Decimal::operator<=(const CFX_Decimal& val) const { return Compare(val) <= 0; } -FX_BOOL CFX_Decimal::operator>=(const CFX_Decimal& val) const { +bool CFX_Decimal::operator>=(const CFX_Decimal& val) const { return Compare(val) >= 0; } -FX_BOOL CFX_Decimal::operator!=(const CFX_Decimal& val) const { +bool CFX_Decimal::operator!=(const CFX_Decimal& val) const { return Compare(val) != 0; } -FX_BOOL CFX_Decimal::operator<(const CFX_Decimal& val) const { +bool CFX_Decimal::operator<(const CFX_Decimal& val) const { return Compare(val) < 0; } -FX_BOOL CFX_Decimal::operator>(const CFX_Decimal& val) const { +bool CFX_Decimal::operator>(const CFX_Decimal& val) const { return Compare(val) > 0; } CFX_Decimal CFX_Decimal::operator+(const CFX_Decimal& val) const { diff --git a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp index b963e1daf8..88add897b7 100644 --- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp @@ -1526,15 +1526,13 @@ void CFWL_ComboBoxImpDelegate::OnKey(CFWL_MsgKey* pMsg) { m_pOwner->DispatchKeyEvent(pMsg); return; } - FX_BOOL bSubCtrlKey = pMsg->m_pDstTarget == m_pOwner->m_pInterface; - if (bSubCtrlKey) { + if (pMsg->m_pDstTarget == m_pOwner->m_pInterface) DoSubCtrlKey(pMsg); - } } void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; if (bUp || bDown) { int32_t iCount = static_cast<CFWL_ComboListImp*>( m_pOwner->m_pListBox->GetImpl())->CountItems(); @@ -1684,8 +1682,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, } void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; if (bUp || bDown) { CFWL_ComboListImp* pComboList = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()); diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp index e924b8b791..1f77f7ad94 100644 --- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp @@ -332,9 +332,9 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, case FWL_VKEY_Down: case FWL_VKEY_Home: case FWL_VKEY_End: { - FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up; - FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down; - FX_BOOL bHome = dwKeyCode == FWL_VKEY_Home; + const bool bUp = dwKeyCode == FWL_VKEY_Up; + const bool bDown = dwKeyCode == FWL_VKEY_Down; + const bool bHome = dwKeyCode == FWL_VKEY_Home; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); int32_t iDstItem = -1; diff --git a/xfa/src/fwl/src/theme/checkboxtp.cpp b/xfa/src/fwl/src/theme/checkboxtp.cpp index 85dd01f85f..b288e5f19f 100644 --- a/xfa/src/fwl/src/theme/checkboxtp.cpp +++ b/xfa/src/fwl/src/theme/checkboxtp.cpp @@ -49,11 +49,10 @@ FX_DWORD CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { if (!m_pTextOut) return FALSE; - FX_BOOL bDisable = (pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled; - FX_ARGB argText = - bDisable ? FWLTHEME_CAPACITY_TextDisColor : FWLTHEME_CAPACITY_TextColor; - m_pTextOut->SetTextColor(argText); + m_pTextOut->SetTextColor((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == + FWL_PARTSTATE_CKB_Disabled + ? FWLTHEME_CAPACITY_TextDisColor + : FWLTHEME_CAPACITY_TextColor); return CFWL_WidgetTP::DrawText(pParams); } FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp index 6ccb2f75d9..fbd0ea1c9e 100644 --- a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp +++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp @@ -76,7 +76,7 @@ CFX_PtrArray* CBC_DataMatrixDataBlock::GetDataBlocks( } } } - FX_BOOL specialVersion = version->GetVersionNumber() == 24; + const bool specialVersion = version->GetVersionNumber() == 24; int32_t numLongerBlocks = specialVersion ? 8 : numResultBlocks; for (j = 0; j < numLongerBlocks; j++) { if (rawCodewordsOffset < rawCodewords->GetSize()) { diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp index 7cb8ba51fa..76d05042da 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp @@ -61,7 +61,7 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap* image, } for (int32_t x = 0; x < maxLines; x++) { int32_t rowStepsAboveOrBelow = (x + 1) >> 1; - FX_BOOL isAbove = (x & 0x01) == 0; + const bool isAbove = (x & 0x01) == 0; int32_t rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow); diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp index 218e9e3548..05b78ecca4 100644 --- a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp @@ -783,10 +783,10 @@ void CXFA_FFDocView::RunBindItems() { CFX_WideStringC wsValueRef, wsLabelRef; binditems.GetValueRef(wsValueRef); binditems.GetLabelRef(wsLabelRef); - FX_BOOL bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; - FX_BOOL bLabelUseContent = + const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; + const bool bLabelUseContent = wsLabelRef.IsEmpty() || wsLabelRef == FX_WSTRC(L"$"); - FX_BOOL bValueUseContent = + const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == FX_WSTRC(L"$"); CFX_WideString wsValue, wsLabel; FX_DWORD uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef), diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp index e35b14f88f..7d646ca297 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp @@ -374,7 +374,7 @@ int32_t CXFA_WidgetAcc::ProcessCalculate() { int32_t iRet = ExecuteScript(script, &EventParam); if (iRet == XFA_EVENTERROR_Sucess) { if (GetRawValue() != EventParam.m_wsResult) { - FX_BOOL bNotify = GetDoc()->GetDocType() == XFA_DOCTYPE_Static; + const bool bNotify = GetDoc()->GetDocType() == XFA_DOCTYPE_Static; SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw); UpdateUIDisplay(); if (bNotify) { @@ -770,9 +770,9 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { XFA_ELEMENT eUIType = (XFA_ELEMENT)GetUIType(); int32_t iCapPlacement = caption.GetPlacementType(); FX_FLOAT fCapReserve = caption.GetReserve(); - FX_BOOL bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top || - iCapPlacement == XFA_ATTRIBUTEENUM_Bottom; - FX_BOOL bReserveExit = fCapReserve > 0.01; + const bool bVert = iCapPlacement == XFA_ATTRIBUTEENUM_Top || + iCapPlacement == XFA_ATTRIBUTEENUM_Bottom; + const bool bReserveExit = fCapReserve > 0.01; CXFA_TextLayout* pCapTextLayout = ((CXFA_FieldLayoutData*)m_pLayoutData)->m_pCapTextLayout; if (pCapTextLayout) { diff --git a/xfa/src/fxfa/src/common/fxfa_localevalue.h b/xfa/src/fxfa/src/common/fxfa_localevalue.h index a876d6968e..0ac76c8aed 100644 --- a/xfa/src/fxfa/src/common/fxfa_localevalue.h +++ b/xfa/src/fxfa/src/common/fxfa_localevalue.h @@ -95,9 +95,9 @@ class CXFA_LocaleValue { FX_BOOL SetDateTime(const CFX_WideString& wsDateTime, const CFX_WideString& wsFormat, IFX_Locale* pLocale); - inline FX_BOOL IsNull() const { return m_dwType == XFA_VT_NULL; } - inline FX_BOOL IsEmpty() const { return m_wsValue.IsEmpty(); } - inline FX_BOOL IsValid() const { return m_bValid; } + bool IsNull() const { return m_dwType == XFA_VT_NULL; } + FX_BOOL IsEmpty() const { return m_wsValue.IsEmpty(); } + FX_BOOL IsValid() const { return m_bValid; } protected: FX_BOOL ParsePatternValue(const CFX_WideString& wsValue, diff --git a/xfa/src/fxfa/src/common/xfa_document.h b/xfa/src/fxfa/src/common/xfa_document.h index 1e70791748..60706ade98 100644 --- a/xfa/src/fxfa/src/common/xfa_document.h +++ b/xfa/src/fxfa/src/common/xfa_document.h @@ -151,7 +151,7 @@ class CXFA_Document : public IXFA_ObjFactory { void AddPurgeNode(CXFA_Node* pNode); FX_BOOL RemovePurgeNode(CXFA_Node* pNode); void PurgeNodes(); - FX_BOOL HasFlag(FX_DWORD dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } + bool HasFlag(FX_DWORD dwFlag) { return (m_dwDocFlags & dwFlag) == dwFlag; } void SetFlag(FX_DWORD dwFlag, FX_BOOL bOn = TRUE); FX_BOOL IsInteractive(); XFA_VERSION GetCurVersionMode() { return m_eCurVersionMode; } diff --git a/xfa/src/fxfa/src/common/xfa_object.h b/xfa/src/fxfa/src/common/xfa_object.h index be2b604c7f..7819c5f6ba 100644 --- a/xfa/src/fxfa/src/common/xfa_object.h +++ b/xfa/src/fxfa/src/common/xfa_object.h @@ -141,8 +141,8 @@ class CXFA_Node : public CXFA_Object { IFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; } IFDE_XMLNode* CreateXMLMappingNode(); FX_BOOL IsNeedSavingXMLNode(); - inline FX_DWORD GetNameHash() const { return m_dwNameHash; } - inline FX_BOOL IsUnnamed() const { return m_dwNameHash == 0; } + FX_DWORD GetNameHash() const { return m_dwNameHash; } + bool IsUnnamed() const { return m_dwNameHash == 0; } CXFA_Node* GetModelNode(); void UpdateNameHash(); FX_BOOL HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit = FALSE); diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp index 819a5e121b..719c9dcf78 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp @@ -817,12 +817,12 @@ FX_BOOL CXFA_ItemLayoutProcessor::ProcessKeepNodesForCheckNext( XFA_ItemLayoutProcessorStages& nCurStage, CXFA_Node*& pNextContainer, FX_BOOL& bLastKeepNode) { - FX_BOOL bCanSplite = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; + const bool bCanSplit = pNextContainer->GetIntact() == XFA_ATTRIBUTEENUM_None; FX_BOOL bNextKeep = FALSE; if (XFA_ExistContainerKeep(pNextContainer, FALSE)) { bNextKeep = TRUE; } - if (bNextKeep && !bCanSplite) { + if (bNextKeep && !bCanSplit) { if (!m_bIsProcessKeep && !m_bKeepBreakFinish) { m_pKeepHeadNode = pNextContainer; m_bIsProcessKeep = TRUE; diff --git a/xfa/src/fxfa/src/parser/xfa_localevalue.cpp b/xfa/src/fxfa/src/parser/xfa_localevalue.cpp index 2222d0cf9c..838634d1e9 100644 --- a/xfa/src/fxfa/src/parser/xfa_localevalue.cpp +++ b/xfa/src/fxfa/src/parser/xfa_localevalue.cpp @@ -597,8 +597,10 @@ FX_BOOL CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) { return FALSE; } - FX_BOOL bSymbol = (wsDate.Find(0x2D) == -1) ? FALSE : TRUE; - FX_WORD wYear = 0, wMonth = 0, wDay = 0; + const bool bSymbol = wsDate.Find(0x2D) != -1; + FX_WORD wYear = 0; + FX_WORD wMonth = 0; + FX_WORD wDay = 0; const FX_WCHAR* pDate = (const FX_WCHAR*)wsDate; int nIndex = 0, nStart = 0; while (pDate[nIndex] != '\0' && nIndex < wCountY) { @@ -680,7 +682,7 @@ FX_BOOL CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { const FX_WORD wCountM = 2; const FX_WORD wCountS = 2; const FX_WORD wCountF = 3; - FX_BOOL bSymbol = (wsTime.Find(':') == -1) ? FALSE : TRUE; + const bool bSymbol = wsTime.Find(':') != -1; FX_WORD wHour = 0; FX_WORD wMinute = 0; FX_WORD wSecond = 0; diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index 67028ee3cd..65992c4201 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -2319,8 +2319,7 @@ void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { return; } int32_t iIndex = pArguments->GetInt32(0); - FX_BOOL bAdd = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; - if (bAdd) { + if (pArguments->GetInt32(1) != 0) { pWidgetData->SetItemState(iIndex, TRUE, TRUE, TRUE); } else { if (pWidgetData->GetItemState(iIndex)) { @@ -3431,7 +3430,7 @@ void CXFA_Node::Script_Form_Recalculate(CFXJSE_Arguments* pArguments) { } int32_t argc = pArguments->GetLength(); if (argc == 1) { - FX_BOOL bScriptFlags = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; + const bool bScriptFlags = pArguments->GetInt32(0) != 0; IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; |