Merge to XFA: FX_BOOL combo patch.

Original Review URL: https://codereview.chromium.org/1257503002
Original Review URL: https://codereview.chromium.org/1253603002

Manual merge for:
  core/include/fxge/fx_font.h
  core/src/fxcodec/codec/codec_int.h
  fpdfsdk/src/javascript/PublicMethods.cpp

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1248153004 .
diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h
index 7aed626..bd8b5c9 100644
--- a/core/include/fpdfapi/fpdf_page.h
+++ b/core/include/fpdfapi/fpdf_page.h
@@ -24,37 +24,20 @@
 #define PDFTRANS_GROUP			0x0100
 #define PDFTRANS_ISOLATED		0x0200
 #define PDFTRANS_KNOCKOUT		0x0400
-#define PDF_CONTENT_NOT_PARSED	0
-#define PDF_CONTENT_PARSING		1
-#define PDF_CONTENT_PARSED		2
+
 class CPDF_PageObjects
 {
 public:
-
     CPDF_PageObjects(FX_BOOL bReleaseMembers = TRUE);
-
     ~CPDF_PageObjects();
 
-
-
-
     void				ContinueParse(IFX_Pause* pPause);
 
-    int					GetParseState() const
-    {
-        return m_ParseState;
-    }
-
     FX_BOOL				IsParsed() const
     {
-        return m_ParseState == PDF_CONTENT_PARSED;
+        return m_ParseState == CONTENT_PARSED;
     }
 
-    int					EstimateParseProgress() const;
-
-
-
-
     FX_POSITION			GetFirstObjectPosition() const
     {
         return m_ObjectList.GetHeadPosition();
@@ -89,10 +72,6 @@
 
     CPDF_PageObject*	GetObjectByIndex(int index) const;
 
-
-
-
-
     FX_POSITION			InsertObject(FX_POSITION posInsertAfter, CPDF_PageObject* pNewObject);
 
     void				Transform(const CFX_AffineMatrix& matrix);
@@ -105,17 +84,11 @@
     CFX_FloatRect		CalcBoundingBox() const;
 
     CPDF_Dictionary*	m_pFormDict;
-
     CPDF_Stream*		m_pFormStream;
-
     CPDF_Document*		m_pDocument;
-
     CPDF_Dictionary*	m_pPageResources;
-
     CPDF_Dictionary*	m_pResources;
-
     CFX_FloatRect		m_BBox;
-
     int					m_Transparency;
 
 protected:
@@ -123,18 +96,22 @@
     friend class		CPDF_StreamContentParser;
     friend class		CPDF_AllStates;
 
-    CFX_PtrList			m_ObjectList;
+    enum ParseState {
+        CONTENT_NOT_PARSED,
+        CONTENT_PARSING,
+        CONTENT_PARSED
+    };
 
-    FX_BOOL				m_bBackgroundAlphaNeeded;
-
-    FX_BOOL				m_bReleaseMembers;
     void				LoadTransInfo();
     void                ClearCacheObjects();
 
+    CFX_PtrList			m_ObjectList;
+    FX_BOOL				m_bBackgroundAlphaNeeded;
+    FX_BOOL				m_bReleaseMembers;
     CPDF_ContentParser*	m_pParser;
-
-    FX_BOOL				m_ParseState;
+    ParseState			m_ParseState;
 };
+
 class CPDF_Page : public CPDF_PageObjects, public CFX_PrivateData
 {
 public:
diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h
index 2d7330e..27fc2f9 100644
--- a/core/include/fxge/fx_dib.h
+++ b/core/include/fxge/fx_dib.h
@@ -518,54 +518,51 @@
 class CFX_ImageStretcher
 {
 public:
-
     CFX_ImageStretcher();
-
     ~CFX_ImageStretcher();
 
-    int32_t		Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pBitmap,
-                          int dest_width, int dest_height, const FX_RECT& bitmap_rect, FX_DWORD flags);
+    FX_BOOL Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource* pBitmap,
+                  int dest_width, int dest_height, const FX_RECT& bitmap_rect,
+                  FX_DWORD flags);
 
+    FX_BOOL Continue(IFX_Pause* pPause);
+    FX_BOOL StartQuickStretch();
+    FX_BOOL StartStretch();
+    FX_BOOL ContinueQuickStretch(IFX_Pause* pPause);
+    FX_BOOL ContinueStretch(IFX_Pause* pPause);
 
-    int32_t		Continue(IFX_Pause* pPause);
     IFX_ScanlineComposer*	m_pDest;
     const CFX_DIBSource*	m_pSource;
     CStretchEngine*		m_pStretchEngine;
     FX_DWORD		m_Flags;
-    FX_BOOL			m_bFlipX,
-                    m_bFlipY;
-    int				m_DestWidth,
-                    m_DestHeight;
+    FX_BOOL			m_bFlipX;
+    FX_BOOL         m_bFlipY;
+    int				m_DestWidth;
+    int             m_DestHeight;
     FX_RECT			m_ClipRect;
     int				m_LineIndex;
     int				m_DestBPP;
     uint8_t*		m_pScanline;
     uint8_t*       m_pMaskScanline;
     FXDIB_Format	m_DestFormat;
-
-    int32_t		StartQuickStretch();
-
-    int32_t		StartStretch();
-
-    int32_t		ContinueQuickStretch(IFX_Pause* pPause);
-
-    int32_t		ContinueStretch(IFX_Pause* pPause);
 };
 class CFX_ImageTransformer
 {
 public:
-
     CFX_ImageTransformer();
-
     ~CFX_ImageTransformer();
 
-    int32_t	Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix, int flags, const FX_RECT* pClip);
+    FX_BOOL Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix,
+                  int flags, const FX_RECT* pClip);
 
+    FX_BOOL Continue(IFX_Pause* pPause);
 
-    int32_t	Continue(IFX_Pause* pPause);
     CFX_AffineMatrix* m_pMatrix;
     FX_RECT		m_StretchClip;
-    int			m_ResultLeft, m_ResultTop, m_ResultWidth, m_ResultHeight;
+    int			m_ResultLeft;
+    int			m_ResultTop;
+    int			m_ResultWidth;
+    int			m_ResultHeight;
     CFX_AffineMatrix	m_dest2stretch;
     CFX_ImageStretcher	m_Stretcher;
     CFX_BitmapStorer	m_Storer;
@@ -575,18 +572,18 @@
 class CFX_ImageRenderer
 {
 public:
-
     CFX_ImageRenderer();
-
     ~CFX_ImageRenderer();
 
-    int32_t			Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn,
-                              const CFX_DIBSource* pSource, int bitmap_alpha,
-                              FX_DWORD mask_color, const CFX_AffineMatrix* pMatrix, FX_DWORD dib_flags,
-                              FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL,
-                              int blend_type = FXDIB_BLEND_NORMAL);
+    FX_BOOL Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn,
+                  const CFX_DIBSource* pSource, int bitmap_alpha,
+                  FX_DWORD mask_color, const CFX_AffineMatrix* pMatrix,
+                  FX_DWORD dib_flags, FX_BOOL bRgbByteOrder = FALSE,
+                  int alpha_flag = 0, void* pIccTransform = NULL,
+                  int blend_type = FXDIB_BLEND_NORMAL);
 
-    int32_t			Continue(IFX_Pause* pPause);
+    FX_BOOL Continue(IFX_Pause* pPause);
+
 protected:
     CFX_DIBitmap*		m_pDevice;
     const CFX_ClipRgn*	m_pClipRgn;
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h
index 0d911c7..0f7c18e 100644
--- a/core/include/fxge/fx_font.h
+++ b/core/include/fxge/fx_font.h
@@ -336,7 +336,7 @@
     virtual void		Release() = 0;
 
     virtual	FX_BOOL		EnumFontList(CFX_FontMapper* pMapper) = 0;
-    virtual void*		MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact) = 0;
+    virtual void*		MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, int& iExact) = 0;
     virtual void*		MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BOOL bItalic, int pitch_family)
     {
         return NULL;
@@ -362,16 +362,23 @@
 public:
     CFX_FolderFontInfo();
     virtual ~CFX_FolderFontInfo();
-    void				AddPath(const CFX_ByteStringC& path);
-    virtual void		Release();
-    virtual	FX_BOOL		EnumFontList(CFX_FontMapper* pMapper);
-    virtual void*		MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact);
-    virtual void*		MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BOOL bItalic, int pitch_family);
-    virtual void*		GetFont(const FX_CHAR* face);
-    virtual FX_DWORD	GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size);
-    virtual void		DeleteFont(void* hFont);
-    virtual	FX_BOOL		GetFaceName(void* hFont, CFX_ByteString& name);
-    virtual FX_BOOL		GetFontCharset(void* hFont, int& charset);
+
+    void AddPath(const CFX_ByteStringC& path);
+
+    // IFX_SytemFontInfo:
+    void Release() override;
+    FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override;
+    void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family,
+                  const FX_CHAR* face, int& bExact) override;
+    void* MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BOOL bItalic,
+                           int pitch_family) override;
+    void* GetFont(const FX_CHAR* face) override;
+    FX_DWORD GetFontData(void* hFont, FX_DWORD table,
+                         uint8_t* buffer, FX_DWORD size) override;
+    void DeleteFont(void* hFont) override;
+    FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override;
+    FX_BOOL GetFontCharset(void* hFont, int& charset) override;
+
 protected:
     CFX_MapByteStringToPtr	m_FontList;
     CFX_ByteStringArray	m_PathList;
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index 2fbecad..dad7326 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -12,7 +12,11 @@
 #include "../fpdf_render/render_int.h"
 CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size)
 {
-    int32_t width, height, color_trans, num_comps, bits;
+    int32_t width;
+    int32_t height;
+    int32_t num_comps;
+    int32_t bits;
+    FX_BOOL color_trans;
     if (!CPDF_ModuleMgr::Get()->GetJpegModule()->
             LoadInfo(pData, size, width, height, num_comps, bits, color_trans)) {
         return NULL;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index c0cdb22..f404352 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -720,14 +720,19 @@
     m_Right = form_rect.right;
     m_Top = form_rect.top;
 }
-CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers) : m_ObjectList(128)
+CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers)
+    : m_pFormDict(nullptr),
+      m_pFormStream(nullptr),
+      m_pDocument(nullptr),
+      m_pPageResources(nullptr),
+      m_pResources(nullptr),
+      m_Transparency(0),
+      m_ObjectList(128),
+      m_bBackgroundAlphaNeeded(FALSE),
+      m_bReleaseMembers(bReleaseMembers),
+      m_pParser(nullptr),
+      m_ParseState(CONTENT_NOT_PARSED)
 {
-    m_bBackgroundAlphaNeeded = FALSE;
-    m_bReleaseMembers = bReleaseMembers;
-    m_ParseState = PDF_CONTENT_NOT_PARSED;
-    m_pParser = NULL;
-    m_pFormStream = NULL;
-    m_pResources = NULL;
 }
 CPDF_PageObjects::~CPDF_PageObjects()
 {
@@ -747,18 +752,11 @@
     }
     m_pParser->Continue(pPause);
     if (m_pParser->GetStatus() == CPDF_ContentParser::Done) {
-        m_ParseState = PDF_CONTENT_PARSED;
+        m_ParseState = CONTENT_PARSED;
         delete m_pParser;
         m_pParser = NULL;
     }
 }
-int CPDF_PageObjects::EstimateParseProgress() const
-{
-    if (!m_pParser) {
-        return m_ParseState == PDF_CONTENT_PARSED ? 100 : 0;
-    }
-    return m_pParser->EstimateProgress();
-}
 FX_POSITION CPDF_PageObjects::InsertObject(FX_POSITION posInsertAfter, CPDF_PageObject* pNewObject)
 {
     if (!posInsertAfter) {
@@ -843,7 +841,7 @@
 }
 void CPDF_PageObjects::ClearCacheObjects()
 {
-    m_ParseState = PDF_CONTENT_NOT_PARSED;
+    m_ParseState = CONTENT_NOT_PARSED;
     delete m_pParser;
     m_pParser = NULL;
     if (m_bReleaseMembers) {
@@ -930,12 +928,12 @@
     if (bReParse) {
         ClearCacheObjects();
     }
-    if (m_ParseState == PDF_CONTENT_PARSED || m_ParseState == PDF_CONTENT_PARSING) {
+    if (m_ParseState == CONTENT_PARSED || m_ParseState == CONTENT_PARSING) {
         return;
     }
     m_pParser = new CPDF_ContentParser;
     m_pParser->Start(this, pOptions);
-    m_ParseState = PDF_CONTENT_PARSING;
+    m_ParseState = CONTENT_PARSING;
 }
 void CPDF_Page::ParseContent(CPDF_ParseOptions* pOptions, FX_BOOL bReParse)
 {
@@ -994,12 +992,12 @@
 void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates, CFX_AffineMatrix* pParentMatrix,
                            CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOptions, int level)
 {
-    if (m_ParseState == PDF_CONTENT_PARSED || m_ParseState == PDF_CONTENT_PARSING) {
+    if (m_ParseState == CONTENT_PARSED || m_ParseState == CONTENT_PARSING) {
         return;
     }
     m_pParser = new CPDF_ContentParser;
     m_pParser->Start(this, pGraphicStates, pParentMatrix, pType3Char, pOptions, level);
-    m_ParseState = PDF_CONTENT_PARSING;
+    m_ParseState = CONTENT_PARSING;
 }
 void CPDF_Form::ParseContent(CPDF_AllStates* pGraphicStates, CFX_AffineMatrix* pParentMatrix,
                              CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOptions, int level)
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 37ffea9..b2cfce7 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -1133,19 +1133,3 @@
         }
     }
 }
-int CPDF_ContentParser::EstimateProgress()
-{
-    if (m_Status == Ready) {
-        return 0;
-    }
-    if (m_Status == Done) {
-        return 100;
-    }
-    if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) {
-        return 10;
-    }
-    if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) {
-        return 90;
-    }
-    return 10 + 80 * m_CurrentOffset / m_Size;
-}
diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h
index 5d8ded0..5f5d767 100644
--- a/core/src/fpdfapi/fpdf_page/pageint.h
+++ b/core/src/fpdfapi/fpdf_page/pageint.h
@@ -309,9 +309,15 @@
 class CPDF_ContentParser
 {
 public:
+    enum ParseStatus {
+        Ready,
+        ToBeContinued,
+        Done
+    };
+
     CPDF_ContentParser();
     ~CPDF_ContentParser();
-    typedef enum { Ready, ToBeContinued, Done } ParseStatus;
+
     ParseStatus			GetStatus()
     {
         return m_Status;
@@ -320,7 +326,7 @@
     void				Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, CFX_AffineMatrix* pParentMatrix,
                               CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOptions, int level);
     void				Continue(IFX_Pause* pPause);
-    int					EstimateProgress();
+
 protected:
     void				Clear();
     ParseStatus			m_Status;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index f630ea5..1958fab 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -62,7 +62,7 @@
             if (word != FX_BSTRC("obj")) {
                 break;
             }
-            CPDF_Object* pObj = parser.GetObject(this, objnum, 0, FALSE);
+            CPDF_Object* pObj = parser.GetObject(this, objnum, 0, 0);
             if (pObj == NULL) {
                 break;
             }
diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp
index f5ec28c..003af30 100644
--- a/core/src/fpdftext/fpdf_text.cpp
+++ b/core/src/fpdftext/fpdf_text.cpp
@@ -26,10 +26,10 @@
         }
         return CFX_ByteString(defchar, -1);
     }
-    FX_BOOL bDef = FALSE;
     char buf[10];
-    int ret = FXSYS_WideCharToMultiByte(destcp, 0, (wchar_t*)&unicode, 1, buf, 10, NULL, &bDef);
-    if (ret && !bDef) {
+    int iDef = 0;
+    int ret = FXSYS_WideCharToMultiByte(destcp, 0, (wchar_t*)&unicode, 1, buf, 10, NULL, &iDef);
+    if (ret && !iDef) {
         return CFX_ByteString(buf, ret);
     }
     const FX_CHAR* altstr = FCS_GetAltStr(unicode);
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h
index 244793b..a1445a5 100644
--- a/core/src/fxcodec/codec/codec_int.h
+++ b/core/src/fxcodec/codec/codec_int.h
@@ -152,7 +152,7 @@
     virtual void		Finish(void* pContext);
     virtual void		Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size);
     virtual int			ReadHeader(void* pContext, int* width, int* height, int* nComps, CFX_DIBAttribute* pAttribute = NULL);
-    virtual FX_BOOL		StartScanline(void* pContext, int down_scale);
+    virtual int			StartScanline(void* pContext, int down_scale);
     virtual FX_BOOL		ReadScanline(void* pContext, uint8_t* dest_buf);
     virtual FX_DWORD	GetAvailInput(void* pContext, uint8_t** avail_buf_ptr);
 protected:
diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp
index 6223b9c..d129e36 100644
--- a/core/src/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/src/fxcodec/codec/fx_codec_flate.cpp
@@ -84,19 +84,21 @@
 class CLZWDecoder
 {
 public:
-    FX_BOOL Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange);
+    int Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange);
+
 private:
+    void AddCode(FX_DWORD prefix_code, uint8_t append_char);
+    void DecodeString(FX_DWORD code);
+
     FX_DWORD	m_InPos;
     FX_DWORD	m_OutPos;
     uint8_t*	m_pOutput;
     const uint8_t*	m_pInput;
     FX_BOOL		m_Early;
-    void		AddCode(FX_DWORD prefix_code, uint8_t append_char);
     FX_DWORD	m_CodeArray[5021];
     FX_DWORD	m_nCodes;
     uint8_t		m_DecodeStack[4000];
     FX_DWORD	m_StackLen;
-    void		DecodeString(FX_DWORD code);
     int			m_CodeLen;
 };
 void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char)
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index e8e075e..6296364 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -715,14 +715,14 @@
     _JpegLoadAttribute(&p->m_Info, pAttribute);
     return 0;
 }
-FX_BOOL CCodec_JpegModule::StartScanline(void* pContext, int down_scale)
+int CCodec_JpegModule::StartScanline(void* pContext, int down_scale)
 {
     if (m_pExtProvider) {
         return m_pExtProvider->StartScanline(pContext, down_scale);
     }
     FXJPEG_Context* p = (FXJPEG_Context*)pContext;
     if (setjmp(p->m_JumpMark) == -1) {
-        return FALSE;
+        return 0;
     }
     p->m_Info.scale_denom = down_scale;
     return jpeg_start_decompress(&p->m_Info);
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp
index ed26ec6..68c9735 100644
--- a/core/src/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp
@@ -873,7 +873,7 @@
     return nRet;
 }
 
-FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
+int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
 {
     FX_DWORD dwTemp;
     FX_WORD wFlags;
@@ -1239,7 +1239,7 @@
     return nRet;
 }
 
-FX_BOOL CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause)
+int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause)
 {
     FX_DWORD dwTemp;
     uint8_t cFlags;
@@ -1293,7 +1293,7 @@
     delete pPDD;
     return nRet;
 }
-FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause)
+int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause)
 {
     FX_DWORD dwTemp;
     uint8_t cFlags;
@@ -1387,7 +1387,7 @@
     return nRet;
 }
 
-FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause)
+int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause)
 {
     FX_DWORD dwTemp;
     uint8_t cFlags;
@@ -1504,7 +1504,7 @@
     return nRet;
 }
 
-FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment)
+int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment)
 {
     FX_DWORD dwTemp;
     JBig2RegionInfo ri;
@@ -1591,7 +1591,7 @@
     delete pGRRD;
     return nRet;
 }
-FX_BOOL CJBig2_Context::parseTable(CJBig2_Segment *pSegment)
+int32_t CJBig2_Context::parseTable(CJBig2_Segment *pSegment)
 {
     pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER;
     JBIG2_ALLOC(pSegment->m_Result.ht, CJBig2_HuffmanTable(m_pStream));
@@ -1618,9 +1618,15 @@
         FX_DWORD SBNUMSYMS)
 {
     JBig2HuffmanCode *SBSYMCODES;
-    int32_t runcodes[35], runcodes_len[35], runcode;
-    int32_t i, j, nTemp, nVal, nBits;
+    int32_t runcodes[35];
+    int32_t runcodes_len[35];
+    int32_t runcode;
+    int32_t i;
+    int32_t j;
+    int32_t nVal;
+    int32_t nBits;
     int32_t run;
+    FX_DWORD nTemp;
     SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2(sizeof(JBig2HuffmanCode), SBNUMSYMS);
     for (i = 0; i < 35; i ++) {
         if(pStream->readNBits(4, &runcodes_len[i]) != 0) {
diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp
index 622f04b..cabcd4c 100644
--- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp
@@ -2101,7 +2101,7 @@
     CJBig2_Image *IBI;
     FX_DWORD WI, HI;
     int32_t IDS;
-    FX_BOOL RI;
+    int RI;
     int32_t RDWI, RDHI, RDXI, RDYI;
     CJBig2_Image *IBOI;
     FX_DWORD WOI, HOI;
diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
index dd820ae..ef84547 100644
--- a/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
@@ -14,9 +14,10 @@
 }
 int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable *pTable, int *nResult)
 {
-    int nVal, nTmp, i, nBits;
-    nVal = 0;
-    nBits = 0;
+    int i;
+    int nVal = 0;
+    int nBits = 0;
+    FX_DWORD nTmp;
     while(1) {
         if(m_pStream->read1Bit(&nTmp) == -1) {
             return -1;
diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp
index e4416e9..2497c74 100644
--- a/core/src/fxcrt/fx_basic_gcc.cpp
+++ b/core/src/fxcrt/fx_basic_gcc.cpp
@@ -208,7 +208,7 @@
 extern "C" {
 #endif
 int FXSYS_WideCharToMultiByte(FX_DWORD codepage, FX_DWORD dwFlags, const FX_WCHAR* wstr, int wlen,
-                              FX_CHAR* buf, int buflen, const FX_CHAR* default_str, FX_BOOL* pUseDefault)
+                              FX_CHAR* buf, int buflen, const FX_CHAR* default_str, int* pUseDefault)
 {
     int len = 0;
     for (int i = 0; i < wlen; i ++) {
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index e7281f3..fd96ff2 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -609,8 +609,8 @@
     if (bLocalized) {
         void* hFont = m_pFontInfo->GetFont(name);
         if (hFont == NULL) {
-            FX_BOOL bExact;
-            hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name, bExact);
+            int iExact;
+            hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name, iExact);
             if (hFont == NULL) {
                 return;
             }
@@ -1062,7 +1062,7 @@
         bItalic = TRUE;
     }
     FX_BOOL bCJK = FALSE;
-    FX_BOOL bExact = FALSE;
+    int iExact = 0;
     int Charset = FXFONT_ANSI_CHARSET;
     if (WindowCP) {
         Charset = _GetCharsetFromCodePage(WindowCP);
@@ -1143,9 +1143,9 @@
             bItalic = TRUE;
         }
     }
-    bExact = !match.IsEmpty();
-    void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, family, bExact);
-    if (bExact) {
+    iExact = !match.IsEmpty();
+    void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, family, iExact);
+    if (iExact) {
         pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT;
     }
     if (hFont == NULL) {
@@ -1551,7 +1551,7 @@
     }
     m_FontList.SetAt(facename, pInfo);
 }
-void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact)
+void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact)
 {
     return NULL;
 }
diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp
index 51c0e64..25ad49c 100644
--- a/core/src/fxge/ge/fx_ge_linux.cpp
+++ b/core/src/fxge/ge/fx_ge_linux.cpp
@@ -30,7 +30,7 @@
 class CFX_LinuxFontInfo : public CFX_FolderFontInfo
 {
 public:
-    virtual void*		MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact);
+    void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact) override;
     FX_BOOL				ParseFontCfg();
     void*				FindFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL bMatchName);
 };
@@ -77,14 +77,14 @@
     }
     return 2;
 }
-void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact)
+void* CFX_LinuxFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, int& iExact)
 {
     CFX_ByteString face = cstr_face;
     int iBaseFont;
     for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++)
         if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) {
             face = Base14Substs[iBaseFont].m_pSubstName;
-            bExact = TRUE;
+            iExact = 1;
             break;
         }
     if (iBaseFont < 12) {
diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h
index 6f89868..29d9e1c 100644
--- a/core/src/fxge/ge/text_int.h
+++ b/core/src/fxge/ge/text_int.h
@@ -32,7 +32,7 @@
         m_RefCount = 0;
     }
     ~CTTFontDesc();
-    FX_BOOL			ReleaseFace(FXFT_Face face);
+    int32_t			ReleaseFace(FXFT_Face face);
     int				m_Type;
     union {
         struct {
diff --git a/fpdfsdk/src/fpdf_sysfontinfo.cpp b/fpdfsdk/src/fpdf_sysfontinfo.cpp
index 85b83a6..18d0af0 100644
--- a/fpdfsdk/src/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/src/fpdf_sysfontinfo.cpp
@@ -29,10 +29,10 @@
 		return FALSE;
 	}
 
-	virtual void*		MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact)  override
+	virtual void*		MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact)  override
 	{
 		if (m_pInfo->MapFont)
-			return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family, family, &bExact);
+			return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family, family, &iExact);
 		return NULL;
 	}
 
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index ad6e042..e49d74e 100644
--- a/fpdfsdk/src/fpdf_transformpage.cpp
+++ b/fpdfsdk/src/fpdf_transformpage.cpp
@@ -44,7 +44,7 @@
 }
 
 
-DLLEXPORT FX_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top)
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top)
 {
 	if(!page)
 		return FALSE;
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index c5cc84c..abb95f0 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -1066,13 +1066,13 @@
 		dValue += DOUBLE_CORRECT;//
 
 	int iDec2;
-	FX_BOOL bNagative = FALSE;
+	int iNegative = 0;
 
-	strValue = fcvt(dValue,iDec,&iDec2,&bNagative);
+	strValue = fcvt(dValue, iDec, &iDec2, &iNegative);
 	if (strValue.IsEmpty())
 	{
 		dValue = 0;
-		strValue = fcvt(dValue,iDec,&iDec2,&bNagative);
+		strValue = fcvt(dValue, iDec, &iDec2, &iNegative);
 		if (strValue.IsEmpty())
 		{
 			strValue = "0";
@@ -1125,9 +1125,9 @@
 		else
 			cSeperator = '.';
 
-		int iDecPositive,iDecNagative;
+		int iDecPositive,iDecNegative;
 		iDecPositive = iDec2;
-		iDecNagative = iDec2;
+		iDecNegative = iDec2;
 
 		for (iDecPositive = iDec2 -3; iDecPositive > 0;iDecPositive -= 3)
 		{
@@ -1151,7 +1151,7 @@
 
 	/////////////////////////////////////////////////////////////////////////
 	//for processing negative style
-	if (bNagative)
+	if (iNegative)
 	{
 		if (iNegStyle == 0)
 		{
@@ -1394,12 +1394,12 @@
 		dValue += DOUBLE_CORRECT;//УÕý
 
 	int iDec2;
-	FX_BOOL bNagative = FALSE;
-	strValue = fcvt(dValue,iDec,&iDec2,&bNagative);
+	int iNegative = 0;
+	strValue = fcvt(dValue, iDec, &iDec2, &iNegative);
     if (strValue.IsEmpty())
 	{
 		dValue = 0;
-		strValue = fcvt(dValue,iDec,&iDec2,&bNagative);
+		strValue = fcvt(dValue, iDec, &iDec2, &iNegative);
 	}
 
 	if (iDec2 < 0)
@@ -1446,9 +1446,9 @@
 		else
 			cSeperator = '.';
 
-		int iDecPositive,iDecNagative;
+		int iDecPositive,iDecNegative;
 		iDecPositive = iDec2;
-		iDecNagative = iDec2;
+		iDecNegative = iDec2;
 
 		for (iDecPositive = iDec2 -3; iDecPositive > 0; iDecPositive -= 3)
 		{
@@ -1457,8 +1457,8 @@
 		}
 	}
 	////////////////////////////////////////////////////////////////////
-	//nagative mark
-	if(bNagative)
+	//negative mark
+	if (iNegative)
 		strValue = "-" + strValue;
 	strValue += "%";
 	Value = CFX_WideString::FromLocal(strValue);
diff --git a/public/fpdf_sysfontinfo.h b/public/fpdf_sysfontinfo.h
index dbadb89..61465f4 100644
--- a/public/fpdf_sysfontinfo.h
+++ b/public/fpdf_sysfontinfo.h
@@ -94,13 +94,13 @@
      *          charset     -   Character set identifier for the requested font. See above defined constants.
      *          pitch_family -  A combination of flags. See above defined constants.
      *          face        -   Typeface name. Currently use system local encoding only.
-     *          bExact      -   Pointer to an boolean value receiving the indicator whether mapper found the exact match.
+     *          bExact      -   Pointer to a boolean value receiving the indicator whether mapper found the exact match.
      *                          If mapper is not sure whether it's exact match, ignore this paramter.
      * Return Value:
      *          An opaque pointer for font handle, or NULL if system mapping is not supported.
      **/
-    void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, int weight, int bItalic, int charset, int pitch_family,
-                        const char* face, int* bExact);
+    void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, int weight, FPDF_BOOL bItalic, int charset, int pitch_family,
+                     const char* face, FPDF_BOOL* bExact);
 
     /**
      * Method: GetFont