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 /core/src | |
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 .
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 16 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 6 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 20 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_annot.cpp | 6 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_progress.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcrt/fx_arabic.cpp | 2 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiafontmgr.cpp | 4 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_composite.cpp | 2 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_text.cpp | 4 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_device.cpp | 3 |
11 files changed, 34 insertions, 35 deletions
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) || |