Fix FX_BOOL compilation errors under windows
authorTom Sepez <tsepez@chromium.org>
Mon, 27 Jul 2015 21:38:43 +0000 (14:38 -0700)
committerTom Sepez <tsepez@chromium.org>
Mon, 27 Jul 2015 21:38:43 +0000 (14:38 -0700)
 - 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
core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
core/src/fpdftext/fpdf_text_int.cpp
core/src/fpdftext/text_int.h
core/src/fxge/win32/fx_win32_device.cpp
core/src/fxge/win32/fx_win32_gdipext.cpp
fpdfsdk/include/pdfwindow/PWL_IconList.h

index a856433..951085b 100644 (file)
@@ -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
index 22826a3..7b7b61a 100644 (file)
@@ -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;
         }
index c1aaad8..0e9c5ba 100644 (file)
@@ -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);
index ce52371..7f15be1 100644 (file)
@@ -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
index 18bcc59..f05594e 100644 (file)
@@ -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);
 }
index d76d52e..d90215a 100644 (file)
@@ -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,
index f7e9add..b8bc3d2 100644 (file)
@@ -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;