From 7c1b07fde27dfbbf1d979d9dfd616b1a42591e5f Mon Sep 17 00:00:00 2001 From: npm Date: Wed, 5 Oct 2016 08:07:30 -0700 Subject: Remove FX_BOOL from core/fpdfapi/font FX_BOOL can be replaced by bool. Also replaced in a couple other places so that Winbots pass. Review-Url: https://codereview.chromium.org/2395803002 --- core/fpdfapi/font/cpdf_font.cpp | 24 ++++++++++++------------ core/fpdfapi/font/cpdf_fontencoding.cpp | 6 +++--- core/fpdfapi/font/cpdf_fontencoding.h | 2 +- core/fpdfapi/font/cpdf_truetypefont.cpp | 10 +++++----- core/fpdfapi/font/cpdf_type1font.cpp | 20 ++++++++++---------- core/fpdfapi/font/cpdf_type3char.cpp | 12 ++++++------ core/fpdfapi/font/cpdf_type3char.h | 4 ++-- core/fpdfapi/font/ttgsubtable.cpp | 12 ++++++------ core/fpdfapi/font/ttgsubtable.h | 4 ++-- core/fpdfapi/page/fpdf_page_parser.cpp | 6 +++--- core/fpdfapi/page/pageint.h | 4 ++-- core/fpdfapi/parser/cpdf_dictionary.cpp | 2 +- core/fpdfapi/parser/cpdf_dictionary.h | 2 +- 13 files changed, 54 insertions(+), 54 deletions(-) diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index caacc18a97..1cfecb8ded 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -166,33 +166,33 @@ uint32_t CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const { void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { m_Flags = pFontDesc->GetIntegerFor("Flags", PDFFONT_NONSYMBOLIC); int ItalicAngle = 0; - FX_BOOL bExistItalicAngle = FALSE; + bool bExistItalicAngle = false; if (pFontDesc->KeyExist("ItalicAngle")) { ItalicAngle = pFontDesc->GetIntegerFor("ItalicAngle"); - bExistItalicAngle = TRUE; + bExistItalicAngle = true; } if (ItalicAngle < 0) { m_Flags |= PDFFONT_ITALIC; m_ItalicAngle = ItalicAngle; } - FX_BOOL bExistStemV = FALSE; + bool bExistStemV = false; if (pFontDesc->KeyExist("StemV")) { m_StemV = pFontDesc->GetIntegerFor("StemV"); - bExistStemV = TRUE; + bExistStemV = true; } - FX_BOOL bExistAscent = FALSE; + bool bExistAscent = false; if (pFontDesc->KeyExist("Ascent")) { m_Ascent = pFontDesc->GetIntegerFor("Ascent"); - bExistAscent = TRUE; + bExistAscent = true; } - FX_BOOL bExistDescent = FALSE; + bool bExistDescent = false; if (pFontDesc->KeyExist("Descent")) { m_Descent = pFontDesc->GetIntegerFor("Descent"); - bExistDescent = TRUE; + bExistDescent = true; } - FX_BOOL bExistCapHeight = FALSE; + bool bExistCapHeight = false; if (pFontDesc->KeyExist("CapHeight")) { - bExistCapHeight = TRUE; + bExistCapHeight = true; } if (bExistItalicAngle && bExistAscent && bExistCapHeight && bExistDescent && bExistStemV) { @@ -242,7 +242,7 @@ void CPDF_Font::CheckFontMetrics() { m_Ascent = TT2PDF(FXFT_Get_Face_Ascender(face), face); m_Descent = TT2PDF(FXFT_Get_Face_Descender(face), face); } else { - FX_BOOL bFirst = TRUE; + bool bFirst = true; for (int i = 0; i < 256; i++) { FX_RECT rect = GetCharBBox(i); if (rect.left == rect.right) { @@ -250,7 +250,7 @@ void CPDF_Font::CheckFontMetrics() { } if (bFirst) { m_FontBBox = rect; - bFirst = FALSE; + bFirst = false; } else { if (m_FontBBox.top < rect.top) { m_FontBBox.top = rect.top; diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp index 38cc66411f..fba35a1062 100644 --- a/core/fpdfapi/font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/font/cpdf_fontencoding.cpp @@ -1665,7 +1665,7 @@ CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { } } -FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { +bool CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == 0; } @@ -1675,10 +1675,10 @@ CPDF_Object* CPDF_FontEncoding::Realize(CFX_WeakPtr pPool) { for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; cs++) { const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(cs); - FX_BOOL match = TRUE; + bool match = true; for (int i = 0; i < 256; ++i) { if (m_Unicodes[i] != pSrc[i]) { - match = FALSE; + match = false; break; } } diff --git a/core/fpdfapi/font/cpdf_fontencoding.h b/core/fpdfapi/font/cpdf_fontencoding.h index a81035c825..a497681e5e 100644 --- a/core/fpdfapi/font/cpdf_fontencoding.h +++ b/core/fpdfapi/font/cpdf_fontencoding.h @@ -41,7 +41,7 @@ class CPDF_FontEncoding { void LoadEncoding(CPDF_Object* pEncoding); - FX_BOOL IsIdentical(CPDF_FontEncoding* pAnother) const; + bool IsIdentical(CPDF_FontEncoding* pAnother) const; FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const { return m_Unicodes[charcode]; diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp index d94b3b908e..a395e47112 100644 --- a/core/fpdfapi/font/cpdf_truetypefont.cpp +++ b/core/fpdfapi/font/cpdf_truetypefont.cpp @@ -43,15 +43,15 @@ void CPDF_TrueTypeFont::LoadGlyphMap() { (baseEncoding == PDFFONT_ENCODING_MACROMAN || baseEncoding == PDFFONT_ENCODING_WINANSI) && (m_Flags & PDFFONT_SYMBOLIC)) { - FX_BOOL bSupportWin = FALSE; - FX_BOOL bSupportMac = FALSE; + bool bSupportWin = false; + bool bSupportMac = false; for (int i = 0; i < FXFT_Get_Face_CharmapCount(m_Font.GetFace()); i++) { int platform_id = FXFT_Get_Charmap_PlatformID( FXFT_Get_Face_Charmaps(m_Font.GetFace())[i]); if (platform_id == 0 || platform_id == 3) { - bSupportWin = TRUE; + bSupportWin = true; } else if (platform_id == 0 || platform_id == 1) { - bSupportMac = TRUE; + bSupportMac = true; } } if (baseEncoding == PDFFONT_ENCODING_WINANSI && !bSupportWin) { @@ -94,7 +94,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() { bMacRoman = !bMSSymbol && FT_UseTTCharmap(m_Font.GetFace(), 1, 0); } } - FX_BOOL bToUnicode = m_pFontDict->KeyExist("ToUnicode"); + bool bToUnicode = m_pFontDict->KeyExist("ToUnicode"); for (int charcode = 0; charcode < 256; charcode++) { const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_CharNames, charcode); diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp index b7ee717889..127ec281ec 100644 --- a/core/fpdfapi/font/cpdf_type1font.cpp +++ b/core/fpdfapi/font/cpdf_type1font.cpp @@ -43,14 +43,14 @@ const FX_CHAR* GlyphNameRemap(const FX_CHAR* pStrAdobe) { #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ -FX_BOOL FT_UseType1Charmap(FXFT_Face face) { +bool FT_UseType1Charmap(FXFT_Face face) { if (FXFT_Get_Face_CharmapCount(face) == 0) { - return FALSE; + return false; } if (FXFT_Get_Face_CharmapCount(face) == 1 && FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == FXFT_ENCODING_UNICODE) { - return FALSE; + return false; } if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == FXFT_ENCODING_UNICODE) { @@ -58,7 +58,7 @@ FX_BOOL FT_UseType1Charmap(FXFT_Face face) { } else { FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]); } - return TRUE; + return true; } } // namespace @@ -132,7 +132,7 @@ void CPDF_Type1Font::LoadGlyphMap() { #endif if (!IsEmbedded() && (m_Base14Font < 12) && m_Font.IsTTFont()) { if (FT_UseTTCharmap(m_Font.GetFace(), 3, 0)) { - FX_BOOL bGotOne = FALSE; + bool bGotOne = false; for (int charcode = 0; charcode < 256; charcode++) { const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2}; for (int j = 0; j < 4; j++) { @@ -154,7 +154,7 @@ void CPDF_Type1Font::LoadGlyphMap() { } #endif if (m_GlyphIndex[charcode]) { - bGotOne = TRUE; + bGotOne = true; break; } } @@ -267,9 +267,9 @@ void CPDF_Type1Font::LoadGlyphMap() { } return; } - FX_BOOL bUnicode = FALSE; + bool bUnicode = false; if (0 == FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE)) { - bUnicode = TRUE; + bUnicode = true; } for (int charcode = 0; charcode < 256; charcode++) { const FX_CHAR* name = @@ -367,9 +367,9 @@ void CPDF_Type1Font::LoadGlyphMap() { #endif return; } - FX_BOOL bUnicode = FALSE; + bool bUnicode = false; if (0 == FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE)) { - bUnicode = TRUE; + bUnicode = true; } for (int charcode = 0; charcode < 256; charcode++) { const FX_CHAR* name = diff --git a/core/fpdfapi/font/cpdf_type3char.cpp b/core/fpdfapi/font/cpdf_type3char.cpp index 332287f594..a4df2cc146 100644 --- a/core/fpdfapi/font/cpdf_type3char.cpp +++ b/core/fpdfapi/font/cpdf_type3char.cpp @@ -13,20 +13,20 @@ #include "core/fxge/fx_dib.h" CPDF_Type3Char::CPDF_Type3Char(CPDF_Form* pForm) - : m_pForm(pForm), m_bColored(FALSE) {} + : m_pForm(pForm), m_bColored(false) {} CPDF_Type3Char::~CPDF_Type3Char() {} -FX_BOOL CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) { +bool CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) { if (m_pBitmap || !m_pForm) - return TRUE; + return true; if (m_pForm->GetPageObjectList()->size() != 1 || m_bColored) - return FALSE; + return false; auto& pPageObj = m_pForm->GetPageObjectList()->front(); if (!pPageObj->IsImage()) - return FALSE; + return false; m_ImageMatrix = pPageObj->AsImage()->m_Matrix; std::unique_ptr pSource( @@ -34,5 +34,5 @@ FX_BOOL CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) { if (pSource) m_pBitmap.reset(pSource->Clone()); m_pForm.reset(); - return TRUE; + return true; } diff --git a/core/fpdfapi/font/cpdf_type3char.h b/core/fpdfapi/font/cpdf_type3char.h index ebb5ed440c..549f49e3da 100644 --- a/core/fpdfapi/font/cpdf_type3char.h +++ b/core/fpdfapi/font/cpdf_type3char.h @@ -22,11 +22,11 @@ class CPDF_Type3Char { explicit CPDF_Type3Char(CPDF_Form* pForm); ~CPDF_Type3Char(); - FX_BOOL LoadBitmap(CPDF_RenderContext* pContext); + bool LoadBitmap(CPDF_RenderContext* pContext); std::unique_ptr m_pForm; std::unique_ptr m_pBitmap; - FX_BOOL m_bColored; + bool m_bColored; int m_Width; CFX_Matrix m_ImageMatrix; FX_RECT m_BBox; diff --git a/core/fpdfapi/font/ttgsubtable.cpp b/core/fpdfapi/font/ttgsubtable.cpp index 51f533d7d1..c037746c1e 100644 --- a/core/fpdfapi/font/ttgsubtable.cpp +++ b/core/fpdfapi/font/ttgsubtable.cpp @@ -47,22 +47,22 @@ void CFX_GlyphMap::SetAt(int key, int value) { m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair)); } -FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) { +bool CFX_GlyphMap::Lookup(int key, int& value) { void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair), sizeof(_IntPair), _CompareInt); if (!pResult) { - return FALSE; + return false; } value = ((uint32_t*)pResult)[1]; - return TRUE; + return true; } CFX_CTTGSUBTable::CFX_CTTGSUBTable() - : m_bFeautureMapLoad(FALSE), loaded(false) {} + : m_bFeautureMapLoad(false), loaded(false) {} CFX_CTTGSUBTable::CFX_CTTGSUBTable(FT_Bytes gsub) - : m_bFeautureMapLoad(FALSE), loaded(false) { + : m_bFeautureMapLoad(false), loaded(false) { LoadGSUBTable(gsub); } @@ -115,7 +115,7 @@ bool CFX_CTTGSUBTable::GetVerticalGlyph(uint32_t glyphnum, } } } - m_bFeautureMapLoad = TRUE; + m_bFeautureMapLoad = true; } for (const auto& pair : m_featureMap) { if (GetVerticalGlyphSub(glyphnum, vglyphnum, diff --git a/core/fpdfapi/font/ttgsubtable.h b/core/fpdfapi/font/ttgsubtable.h index b3853912b2..e0e4bbbd05 100644 --- a/core/fpdfapi/font/ttgsubtable.h +++ b/core/fpdfapi/font/ttgsubtable.h @@ -22,7 +22,7 @@ class CFX_GlyphMap { ~CFX_GlyphMap(); void SetAt(int key, int value); - FX_BOOL Lookup(int key, int& value); + bool Lookup(int key, int& value); protected: CFX_BinaryBuf m_Buffer; @@ -290,7 +290,7 @@ class CFX_CTTGSUBTable { uint32_t GetUInt32(FT_Bytes& p) const; std::map m_featureMap; - FX_BOOL m_bFeautureMapLoad; + bool m_bFeautureMapLoad; bool loaded; tt_gsub_header header; TScriptList ScriptList; diff --git a/core/fpdfapi/page/fpdf_page_parser.cpp b/core/fpdfapi/page/fpdf_page_parser.cpp index 48a24da5c5..23d087304f 100644 --- a/core/fpdfapi/page/fpdf_page_parser.cpp +++ b/core/fpdfapi/page/fpdf_page_parser.cpp @@ -223,7 +223,7 @@ CPDF_StreamContentParser::CPDF_StreamContentParser( m_pLastImageDict(nullptr), m_pLastCloneImageDict(nullptr), m_bReleaseLastDict(TRUE), - m_bColored(FALSE), + m_bColored(false), m_bResourceMissing(FALSE) { if (pmtContentToUser) m_mtContentToUser = *pmtContentToUser; @@ -714,14 +714,14 @@ void CPDF_StreamContentParser::Handle_SetDash() { void CPDF_StreamContentParser::Handle_SetCharWidth() { m_Type3Data[0] = GetNumber(1); m_Type3Data[1] = GetNumber(0); - m_bColored = TRUE; + m_bColored = true; } void CPDF_StreamContentParser::Handle_SetCachedDevice() { for (int i = 0; i < 6; i++) { m_Type3Data[i] = GetNumber(5 - i); } - m_bColored = FALSE; + m_bColored = false; } void CPDF_StreamContentParser::Handle_ExecuteXObject() { diff --git a/core/fpdfapi/page/pageint.h b/core/fpdfapi/page/pageint.h index 2d3927d13d..8bbadf0cf0 100644 --- a/core/fpdfapi/page/pageint.h +++ b/core/fpdfapi/page/pageint.h @@ -120,7 +120,7 @@ class CPDF_StreamContentParser { CPDF_PageObjectHolder* GetPageObjectHolder() const { return m_pObjectHolder; } CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); } - FX_BOOL IsColored() const { return m_bColored; } + bool IsColored() const { return m_bColored; } const FX_FLOAT* GetType3Data() const { return m_Type3Data; } void AddNumberParam(const FX_CHAR* str, int len); @@ -276,7 +276,7 @@ class CPDF_StreamContentParser { CPDF_Dictionary* m_pLastCloneImageDict; FX_BOOL m_bReleaseLastDict; FX_BOOL m_bSameLastDict; - FX_BOOL m_bColored; + bool m_bColored; FX_FLOAT m_Type3Data[6]; FX_BOOL m_bResourceMissing; std::vector> m_StateStack; diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp index 7601c5b831..7ef5a53551 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/parser/cpdf_dictionary.cpp @@ -162,7 +162,7 @@ CFX_Matrix CPDF_Dictionary::GetMatrixFor(const CFX_ByteString& key) const { return matrix; } -FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteString& key) const { +bool CPDF_Dictionary::KeyExist(const CFX_ByteString& key) const { return pdfium::ContainsKey(m_Map, key); } diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h index 2da4409b71..23f2e0e3ca 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.h +++ b/core/fpdfapi/parser/cpdf_dictionary.h @@ -54,7 +54,7 @@ class CPDF_Dictionary : public CPDF_Object { return GetNumberFor(key); } - FX_BOOL KeyExist(const CFX_ByteString& key) const; + bool KeyExist(const CFX_ByteString& key) const; bool IsSignatureDict() const; // Set* functions invalidate iterators for the element with the key |key|. -- cgit v1.2.3