From 9c987e9d233c855951db2611433b9cbc4f1b648f Mon Sep 17 00:00:00 2001 From: jaepark Date: Fri, 29 Jul 2016 18:17:44 -0700 Subject: Use bool instead of FX_BOOL as return values in CPVT_GenerateAP. Review-Url: https://codereview.chromium.org/2196903002 --- core/fpdfdoc/cpvt_generateap.cpp | 46 ++++++++++++++++++++-------------------- core/fpdfdoc/cpvt_generateap.h | 14 ++++++------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index 7eb6188c94..fa69609e0e 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -20,14 +20,14 @@ namespace { -FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, - CPDF_Dictionary* pAnnotDict, - const int32_t& nWidgetType) { +bool GenerateWidgetAP(CPDF_Document* pDoc, + CPDF_Dictionary* pAnnotDict, + const int32_t& nWidgetType) { CPDF_Dictionary* pFormDict = nullptr; if (CPDF_Dictionary* pRootDict = pDoc->GetRoot()) pFormDict = pRootDict->GetDictBy("AcroForm"); if (!pFormDict) - return FALSE; + return false; CFX_ByteString DA; if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA")) @@ -35,14 +35,14 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (DA.IsEmpty()) DA = pFormDict->GetStringBy("DA"); if (DA.IsEmpty()) - return FALSE; + return false; CPDF_SimpleParser syntax(DA.AsStringC()); syntax.FindTagParamFromStart("Tf", 2); CFX_ByteString sFontName(syntax.GetWord()); sFontName = PDF_NameDecode(sFontName); if (sFontName.IsEmpty()) - return FALSE; + return false; FX_FLOAT fFontSize = FX_atof(syntax.GetWord()); CPVT_Color crText = CPVT_Color::ParseColor(DA); @@ -64,7 +64,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } } if (!pDRFontDict) - return FALSE; + return false; if (!pFontDict) { pFontDict = new CPDF_Dictionary; @@ -77,7 +77,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict); if (!pDefFont) - return FALSE; + return false; CFX_FloatRect rcAnnot = pAnnotDict->GetRectBy("Rect"); int32_t nRotate = 0; @@ -440,15 +440,15 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } } } - return TRUE; + return true; } } // namespace -FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { - if (!pAnnotDict || pAnnotDict->GetStringBy("Subtype") != "Widget") { - return FALSE; - } +bool FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { + if (!pAnnotDict || pAnnotDict->GetStringBy("Subtype") != "Widget") + return false; + CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString(); uint32_t flags = FPDF_GetFieldAttr(pAnnotDict, "Ff") ? FPDF_GetFieldAttr(pAnnotDict, "Ff")->GetInteger() @@ -472,25 +472,25 @@ FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { } } } - return FALSE; + return false; } // Static. -FX_BOOL CPVT_GenerateAP::GenerateTextFieldAP(CPDF_Document* pDoc, - CPDF_Dictionary* pAnnotDict) { - return GenerateWidgetAP(pDoc, pAnnotDict, 0); +bool CPVT_GenerateAP::GenerateComboBoxAP(CPDF_Document* pDoc, + CPDF_Dictionary* pAnnotDict) { + return GenerateWidgetAP(pDoc, pAnnotDict, 1); } // Static. -FX_BOOL CPVT_GenerateAP::GenerateComboBoxAP(CPDF_Document* pDoc, - CPDF_Dictionary* pAnnotDict) { - return GenerateWidgetAP(pDoc, pAnnotDict, 1); +bool CPVT_GenerateAP::GenerateListBoxAP(CPDF_Document* pDoc, + CPDF_Dictionary* pAnnotDict) { + return GenerateWidgetAP(pDoc, pAnnotDict, 2); } // Static. -FX_BOOL CPVT_GenerateAP::GenerateListBoxAP(CPDF_Document* pDoc, - CPDF_Dictionary* pAnnotDict) { - return GenerateWidgetAP(pDoc, pAnnotDict, 2); +bool CPVT_GenerateAP::GenerateTextFieldAP(CPDF_Document* pDoc, + CPDF_Dictionary* pAnnotDict) { + return GenerateWidgetAP(pDoc, pAnnotDict, 0); } // Static. diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h index fe120909da..3a984199a9 100644 --- a/core/fpdfdoc/cpvt_generateap.h +++ b/core/fpdfdoc/cpvt_generateap.h @@ -21,16 +21,16 @@ class IPVT_FontMap; struct CPVT_WordRange; -FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict); +bool FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict); class CPVT_GenerateAP { public: - static FX_BOOL GenerateTextFieldAP(CPDF_Document* pDoc, - CPDF_Dictionary* pAnnotDict); - static FX_BOOL GenerateComboBoxAP(CPDF_Document* pDoc, - CPDF_Dictionary* pAnnotDict); - static FX_BOOL GenerateListBoxAP(CPDF_Document* pDoc, - CPDF_Dictionary* pAnnotDict); + static bool GenerateComboBoxAP(CPDF_Document* pDoc, + CPDF_Dictionary* pAnnotDict); + static bool GenerateListBoxAP(CPDF_Document* pDoc, + CPDF_Dictionary* pAnnotDict); + static bool GenerateTextFieldAP(CPDF_Document* pDoc, + CPDF_Dictionary* pAnnotDict); static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap, CPDF_VariableText::Iterator* pIterator, const CFX_FloatPoint& ptOffset, -- cgit v1.2.3