From 007e6c0f9559412788b903bcb6a7601e220c3be8 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 26 Feb 2016 14:31:56 -0800 Subject: 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 . --- core/include/fxcrt/fx_basic.h | 10 ++-------- core/include/fxcrt/fx_coordinates.h | 9 ++++----- 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'core/include/fxcrt') 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; } -- cgit v1.2.3