summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-26 14:31:56 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-26 14:31:56 -0800
commit007e6c0f9559412788b903bcb6a7601e220c3be8 (patch)
treea2c6bb85eaa2b63fd24ed70fd3c6ddad54e219d5 /core/include
parent281a9eadff15b167e2ee3032e21b83190ad49125 (diff)
downloadpdfium-007e6c0f9559412788b903bcb6a7601e220c3be8.tar.xz
Remove some FX_BOOLs
Grepping for FX_BOOL and |==| on the same line gives a very strong clue that the expression won't be out of range of the |bool| type iteself. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1736323003 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdfapi/fpdf_objects.h2
-rw-r--r--core/include/fpdfapi/fpdf_page.h2
-rw-r--r--core/include/fpdfdoc/fpdf_vt.h7
-rw-r--r--core/include/fxcrt/fx_basic.h10
-rw-r--r--core/include/fxcrt/fx_coordinates.h9
-rw-r--r--core/include/fxge/fx_dib.h11
6 files changed, 14 insertions, 27 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index 129eebfcfc..5791b7e6b3 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -445,7 +445,7 @@ class CPDF_Stream : public CPDF_Object {
uint8_t* pBuf,
FX_DWORD buf_size) const;
- FX_BOOL IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; }
+ bool IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; }
protected:
static const FX_DWORD kMemoryBasedGenNum = (FX_DWORD)-1;
diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h
index 3d98e34578..973a28030f 100644
--- a/core/include/fpdfapi/fpdf_page.h
+++ b/core/include/fpdfapi/fpdf_page.h
@@ -39,7 +39,7 @@ class CPDF_PageObjectHolder {
CPDF_PageObjectHolder();
void ContinueParse(IFX_Pause* pPause);
- FX_BOOL IsParsed() const { return m_ParseState == CONTENT_PARSED; }
+ bool IsParsed() const { return m_ParseState == CONTENT_PARSED; }
CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; }
const CPDF_PageObjectList* GetPageObjectList() const {
diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h
index b2e64cd2ed..8a2e7e93aa 100644
--- a/core/include/fpdfdoc/fpdf_vt.h
+++ b/core/include/fpdfdoc/fpdf_vt.h
@@ -32,15 +32,12 @@ struct CPVT_WordPlace {
void Default() { nSecIndex = nLineIndex = nWordIndex = -1; }
- FX_BOOL operator==(const CPVT_WordPlace& wp) const {
+ bool operator==(const CPVT_WordPlace& wp) const {
return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex &&
wp.nWordIndex == nWordIndex;
}
- FX_BOOL operator!=(const CPVT_WordPlace& wp) const {
- return wp.nSecIndex != nSecIndex || wp.nLineIndex != nLineIndex ||
- wp.nWordIndex != nWordIndex;
- }
+ FX_BOOL operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); }
inline int32_t WordCmp(const CPVT_WordPlace& wp) const {
if (nSecIndex > wp.nSecIndex) {
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 01bb6e2c76..6e092dd540 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -601,20 +601,16 @@ class CFX_MapPtrToPtr {
protected:
struct CAssoc {
CAssoc* pNext;
-
void* key;
-
void* value;
};
public:
CFX_MapPtrToPtr(int nBlockSize = 10);
-
~CFX_MapPtrToPtr();
int GetCount() const { return m_nCount; }
-
- FX_BOOL IsEmpty() const { return m_nCount == 0; }
+ bool IsEmpty() const { return m_nCount == 0; }
FX_BOOL Lookup(void* key, void*& rValue) const;
@@ -961,9 +957,7 @@ class CFX_CountRef {
m_pObject = NULL;
}
- FX_BOOL operator==(const Ref& ref) const {
- return m_pObject == ref.m_pObject;
- }
+ bool operator==(const Ref& ref) const { return m_pObject == ref.m_pObject; }
protected:
CountedObj* m_pObject;
diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h
index 30770309a0..c6bf230014 100644
--- a/core/include/fxcrt/fx_coordinates.h
+++ b/core/include/fxcrt/fx_coordinates.h
@@ -333,13 +333,12 @@ class CFX_RTemplate {
rect.Intersect(*this);
return !rect.IsEmpty(fEpsilon);
}
- friend FX_BOOL operator==(const FXT_RECT& rc1, const FXT_RECT& rc2) {
+ friend bool operator==(const FXT_RECT& rc1, const FXT_RECT& rc2) {
return rc1.left == rc2.left && rc1.top == rc2.top &&
rc1.width == rc2.width && rc1.height == rc2.height;
}
- friend FX_BOOL operator!=(const FXT_RECT& rc1, const FXT_RECT& rc2) {
- return rc1.left != rc2.left || rc1.top != rc2.top ||
- rc1.width != rc2.width || rc1.height != rc2.height;
+ friend bool operator!=(const FXT_RECT& rc1, const FXT_RECT& rc2) {
+ return !(rc1 == rc2);
}
baseType left, top;
baseType width, height;
@@ -385,7 +384,7 @@ struct FX_RECT {
void Union(const FX_RECT& other_rect);
- FX_BOOL operator==(const FX_RECT& src) const {
+ bool operator==(const FX_RECT& src) const {
return left == src.left && right == src.right && top == src.top &&
bottom == src.bottom;
}
diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h
index 3043e7547c..e39bad2b87 100644
--- a/core/include/fxge/fx_dib.h
+++ b/core/include/fxge/fx_dib.h
@@ -199,13 +199,10 @@ class CFX_DIBSource {
// TODO(thestig): Investigate this. Given the possible values of FXDIB_Format,
// it feels as though this should be implemented as !!(m_AlphaFlag & 1) and
// IsOpaqueImage() below should never be able to return TRUE.
- FX_BOOL IsAlphaMask() const { return m_AlphaFlag == 1; }
-
- FX_BOOL HasAlpha() const { return !!(m_AlphaFlag & 2); }
-
- FX_BOOL IsOpaqueImage() const { return !(m_AlphaFlag & 3); }
-
- FX_BOOL IsCmykImage() const { return !!(m_AlphaFlag & 4); }
+ bool IsAlphaMask() const { return m_AlphaFlag == 1; }
+ bool HasAlpha() const { return !!(m_AlphaFlag & 2); }
+ bool IsOpaqueImage() const { return !(m_AlphaFlag & 3); }
+ bool IsCmykImage() const { return !!(m_AlphaFlag & 4); }
int GetPaletteSize() const {
return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0));