From 065e9321b84fc0490f3da9099e8840c65e06868d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 23 Jul 2015 11:34:44 -0700 Subject: Fix FX_BOOL type mismatches. Extracted from https://codereview.chromium.org/1252613002/ R=thestig@chromium.org Review URL: https://codereview.chromium.org/1253603002 . --- core/include/fxge/fx_dib.h | 57 +++++++++++------------- core/include/fxge/fx_font.h | 25 ++++++----- core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 6 ++- core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp | 2 +- core/src/fpdftext/fpdf_text.cpp | 6 +-- core/src/fxcodec/codec/codec_int.h | 2 +- core/src/fxcodec/codec/fx_codec_flate.cpp | 8 ++-- core/src/fxcodec/codec/fx_codec_jpeg.cpp | 4 +- core/src/fxcodec/jbig2/JBig2_Context.cpp | 22 +++++---- core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp | 2 +- core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp | 7 +-- core/src/fxcrt/fx_basic_gcc.cpp | 2 +- core/src/fxge/ge/fx_ge_fontmap.cpp | 14 +++--- core/src/fxge/ge/fx_ge_linux.cpp | 6 +-- 14 files changed, 89 insertions(+), 74 deletions(-) (limited to 'core') diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h index 2d7330e0c3..27fc2f987d 100644 --- a/core/include/fxge/fx_dib.h +++ b/core/include/fxge/fx_dib.h @@ -518,54 +518,51 @@ class CStretchEngine; 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 @@ public: 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); + + FX_BOOL Continue(IFX_Pause* pPause); - int32_t 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 8c91c41c3f..2832fbfcbc 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -300,7 +300,7 @@ public: 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* GetFont(const FX_CHAR* face) = 0; virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer, FX_DWORD size) = 0; virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; @@ -322,15 +322,20 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo 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* 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* 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 2fbecad351..dad7326a5b 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_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp index f630ea52da..1958fab280 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 @@ void CFDF_Document::ParseStream(IFX_FileRead *pFile, FX_BOOL bOwnFile) 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 c5e064a60a..7203a694ab 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -26,10 +26,10 @@ CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, const FX_CHAR* d } 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 4c7eba08b3..7668f84a20 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -152,7 +152,7 @@ public: 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); - 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 6223b9c670..d129e36392 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -84,19 +84,21 @@ extern "C" 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 b7d9fbe512..6839d31509 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -641,14 +641,14 @@ int CCodec_JpegModule::ReadHeader(void* pContext, int* width, int* height, int* *nComps = p->m_Info.num_components; 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 ed26ec6833..68c973547c 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -873,7 +873,7 @@ failed: 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 @@ failed: 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 @@ failed: 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 @@ failed: 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 @@ failed: 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 @@ failed: 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 @@ JBig2HuffmanCode *CJBig2_Context::decodeSymbolIDHuffmanTable(CJBig2_BitStream *p 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 622f04b160..cabcd4c634 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp @@ -2101,7 +2101,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J 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 dd820ae4ca..ef84547992 100644 --- a/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp @@ -14,9 +14,10 @@ CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder() } 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 e4416e95b5..2497c74a8e 100644 --- a/core/src/fxcrt/fx_basic_gcc.cpp +++ b/core/src/fxcrt/fx_basic_gcc.cpp @@ -208,7 +208,7 @@ char* FXSYS_itoa(int value, char* string, int radix) 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 4674589911..14427a5e40 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -592,8 +592,8 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) 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; } @@ -1045,7 +1045,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru bItalic = TRUE; } FX_BOOL bCJK = FALSE; - FX_BOOL bExact = FALSE; + int iExact = 0; int Charset = FXFONT_ANSI_CHARSET; if (WindowCP) { Charset = _GetCharsetFromCodePage(WindowCP); @@ -1126,9 +1126,9 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru 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) { @@ -1451,7 +1451,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ } 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 4e7334596b..861afd259c 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -30,7 +30,7 @@ Base14Substs[] = { 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 @@ static int32_t GetJapanesePreference(const FX_CHAR* facearr, int weight, int pic } 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) { -- cgit v1.2.3