From a25b4bca69ab26d174edb8cefbdcfc1a0353915a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Jul 2015 14:38:43 -0700 Subject: Fix FX_BOOL compilation errors under windows - Bool functions should not return -1 for error. - Bool variables should not be assigned 2 - Bool / int32_t prototypes should match. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1254973004 . --- core/include/fpdfapi/fpdf_parser.h | 15 +++++---------- core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 8 ++++---- core/src/fpdftext/fpdf_text_int.cpp | 2 +- core/src/fpdftext/text_int.h | 2 +- core/src/fxge/win32/fx_win32_device.cpp | 8 ++++---- core/src/fxge/win32/fx_win32_gdipext.cpp | 4 ++-- fpdfsdk/include/pdfwindow/PWL_IconList.h | 2 +- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index a856433a08..951085b33a 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -344,16 +344,11 @@ protected: #define PDFPARSE_TYPEONLY 1 #define PDFPARSE_NOSTREAM 2 struct PARSE_CONTEXT { - - FX_BOOL m_Flags; - - FX_FILESIZE m_DictStart; - - FX_FILESIZE m_DictEnd; - - FX_FILESIZE m_DataStart; - - FX_FILESIZE m_DataEnd; + uint32_t m_Flags; + FX_FILESIZE m_DictStart; + FX_FILESIZE m_DictEnd; + FX_FILESIZE m_DataStart; + FX_FILESIZE m_DataEnd; }; #define PDFPARSE_ERROR_SUCCESS 0 diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 22826a3609..7b7b61aa02 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -751,14 +751,14 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF offset += len + 7; if (m_PrevOffset > 0) { if (pFile->AppendString(FX_BSTRC("/Prev ")) < 0) { - return -1; + return FALSE; } FX_CHAR offset_buf[20]; FXSYS_memset(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(m_PrevOffset, offset_buf, 10); int32_t len = (int32_t)FXSYS_strlen(offset_buf); if (pFile->AppendBlock(offset_buf, len) < 0) { - return -1; + return FALSE; } offset += len + 6; } @@ -786,7 +786,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF offset += len + 8; if (bEOF) { if ((len = PDF_CreatorWriteTrailer(pCreator->m_pDocument, pFile, pCreator->m_pIDArray, pCreator->m_bCompress)) < 0) { - return -1; + return FALSE; } offset += len; if (pCreator->m_pEncryptDict) { @@ -795,7 +795,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF dwEncryptObjNum = pCreator->m_dwEnryptObjNum; } if ((len = PDF_CreatorWriteEncrypt(pCreator->m_pEncryptDict, dwEncryptObjNum, pFile)) < 0) { - return -1; + return FALSE; } offset += len; } diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index c1aaad8b5c..0e9c5ba0f4 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -712,7 +712,7 @@ int CPDF_TextPage::CountBoundedSegments(FX_FLOAT left, FX_FLOAT top, FX_FLOAT ri FPDF_SEGMENT segment; segment.m_Start = 0; segment.m_nCount = 0; - FX_BOOL segmentStatus = 0; + int segmentStatus = 0; FX_BOOL IsContainPreChar = FALSE; while (pos < nCount) { PAGECHAR_INFO charinfo = *(PAGECHAR_INFO*)m_charList.GetAt(pos); diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h index ce52371df0..7f15be1b0a 100644 --- a/core/src/fpdftext/text_int.h +++ b/core/src/fpdftext/text_int.h @@ -129,7 +129,7 @@ protected: SEGMENT_Array m_Segment; CFX_RectArray m_SelRects; LINEOBJ m_LineObj; - FX_BOOL m_TextlineDir; + int32_t m_TextlineDir; CFX_FloatRect m_CurlineRect; }; class CPDF_TextPageFind: public IPDF_TextPageFind diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 18bcc595a4..f05594e396 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -25,7 +25,7 @@ public: ~CWin32FontInfo(); 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* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* face, int& iExact); virtual void* GetFont(const FX_CHAR* face) { return NULL; @@ -285,7 +285,7 @@ void CWin32FontInfo::GetJapanesePreference(CFX_ByteString& face, int weight, int face = "MS PMincho"; } } -void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) +void* CWin32FontInfo::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; @@ -294,7 +294,7 @@ void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc face = Base14Substs[iBaseFont].m_pWinName; weight = Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL; bItalic = Base14Substs[iBaseFont].m_bItalic; - bExact = TRUE; + iExact = TRUE; break; } if (charset == ANSI_CHARSET || charset == SYMBOL_CHARSET) { @@ -594,7 +594,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int d return TRUE; } -BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) +FX_BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) { return ::GetClipBox(m_hDC, (RECT*)pRect); } diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index d76d52e50b..d90215a4ea 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -821,7 +821,7 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_Af CallFunc(GdipSetPenMiterLimit)(pPen, pGraphState->m_MiterLimit); return pPen; } -static BOOL IsSmallTriangle(PointF* points, const CFX_AffineMatrix* pMatrix, int& v1, int& v2) +static FX_BOOL IsSmallTriangle(PointF* points, const CFX_AffineMatrix* pMatrix, int& v1, int& v2) { int pairs[] = {1, 2, 0, 2, 0, 1}; for (int i = 0; i < 3; i ++) { @@ -844,7 +844,7 @@ static BOOL IsSmallTriangle(PointF* points, const CFX_AffineMatrix* pMatrix, int } return FALSE; } -BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, +FX_BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_argb, diff --git a/fpdfsdk/include/pdfwindow/PWL_IconList.h b/fpdfsdk/include/pdfwindow/PWL_IconList.h index f7e9adda7b..b8bc3d2957 100644 --- a/fpdfsdk/include/pdfwindow/PWL_IconList.h +++ b/fpdfsdk/include/pdfwindow/PWL_IconList.h @@ -87,7 +87,7 @@ private: void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); int32_t FindItemIndex(const CPDF_Point& point); - FX_BOOL m_nSelectIndex; + int32_t m_nSelectIndex; IPWL_IconList_Notify* m_pNotify; FX_BOOL m_bEnableNotify; FX_BOOL m_bMouseDown; -- cgit v1.2.3