From 007e6c0f9559412788b903bcb6a7601e220c3be8 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 26 Feb 2016 14:31:56 -0800 Subject: 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 . --- core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 4 ++-- core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 16 ++++++++-------- core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 6 +++--- core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 20 ++++++++++---------- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'core/src/fpdfapi') 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; } -- cgit v1.2.3