Don't use conditional operators to get results of bitwise operations

This commit is contained in:
Artur Wieczorek 2022-12-03 17:12:03 +02:00
parent b3feac2d0f
commit 0dc13131ed
6 changed files with 11 additions and 11 deletions

View file

@ -878,7 +878,7 @@ public:
// Returns true if editor's value was marked modified.
bool IsEditorsValueModified() const
{ return ( m_iFlags & wxPG_FL_VALUE_MODIFIED ) ? true : false; }
{ return ( m_iFlags & wxPG_FL_VALUE_MODIFIED ) != 0; }
// Returns information about arbitrary position in the grid.
// pt - Coordinates in the virtual grid space. You may need to use
@ -1136,7 +1136,7 @@ public:
/////////////////////////////////////////////////////////////////
bool HasVirtualWidth() const
{ return (m_iFlags & wxPG_FL_HAS_VIRTUAL_WIDTH) ? true : false; }
{ return (m_iFlags & wxPG_FL_HAS_VIRTUAL_WIDTH) != 0; }
const wxPGCommonValue* GetCommonValue( unsigned int i ) const
{
@ -1254,7 +1254,7 @@ public:
long GetInternalFlags() const { return m_iFlags; }
bool HasInternalFlag( long flag ) const
{ return (m_iFlags & flag) ? true : false; }
{ return (m_iFlags & flag) != 0; }
void SetInternalFlag( long flag ) { m_iFlags |= flag; }
void ClearInternalFlag( long flag ) { m_iFlags &= ~(flag); }
@ -1293,7 +1293,7 @@ public:
// wxPGProperty::OnEvent() is not even called in those cases).
bool WasValueChangedInEvent() const
{
return (m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT) ? true : false;
return (m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT) != 0;
}
// Returns true if given event is from first of an array of buttons

View file

@ -2187,7 +2187,7 @@ wxString wxDateProperty::ValueToString( wxVariant& value,
if ( ms_defaultDateFormat.empty() )
{
#if wxUSE_DATEPICKCTRL
bool showCentury = m_dpStyle & wxDP_SHOWCENTURY ? true : false;
bool showCentury = (m_dpStyle & wxDP_SHOWCENTURY) != 0;
#else
bool showCentury = true;
#endif

View file

@ -1114,7 +1114,7 @@ wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
wxS("wxPropertyGridManager currently only supports appending pages (due to wxToolBar limitation)."));
bool needInit = true;
bool isPageInserted = m_iFlags & wxPG_MAN_FL_PAGE_INSERTED ? true : false;
bool isPageInserted = (m_iFlags & wxPG_MAN_FL_PAGE_INSERTED) != 0;
wxASSERT( index == 0 || isPageInserted );

View file

@ -1699,7 +1699,7 @@ void wxPGProperty::SetBackgroundColour( const wxColour& colour,
int flags )
{
wxPGProperty* firstProp = this;
bool recursively = flags & wxPG_RECURSE ? true : false;
bool recursively = (flags & wxPG_RECURSE) != 0;
//
// If category is tried to set recursively, skip it and only
@ -1735,7 +1735,7 @@ void wxPGProperty::SetTextColour( const wxColour& colour,
int flags )
{
wxPGProperty* firstProp = this;
bool recursively = flags & wxPG_RECURSE ? true : false;
bool recursively = (flags & wxPG_RECURSE) != 0;
//
// If category is tried to set recursively, skip it and only
@ -1770,7 +1770,7 @@ void wxPGProperty::SetTextColour( const wxColour& colour,
void wxPGProperty::SetDefaultColours(int flags)
{
wxPGProperty* firstProp = this;
bool recursively = flags & wxPG_RECURSE ? true : false;
bool recursively = (flags & wxPG_RECURSE) != 0;
// If category is tried to set recursively, skip it and only
// affect the children.

View file

@ -2893,7 +2893,7 @@ bool wxPropertyGrid::CommitChangesFromEditor( wxUint32 flags )
wxWindow* oldFocus = m_curFocused;
bool validationFailure = false;
bool forceSuccess = (flags & (wxPG_SEL_NOVALIDATE|wxPG_SEL_FORCE)) ? true : false;
bool forceSuccess = (flags & (wxPG_SEL_NOVALIDATE | wxPG_SEL_FORCE)) != 0;
m_chgInfo_changedProperty = nullptr;

View file

@ -1141,7 +1141,7 @@ bool wxBoolProperty::StringToValue( wxVariant& variant, const wxString& text, in
bool wxBoolProperty::IntToValue( wxVariant& variant, int value, int ) const
{
bool boolValue = value ? true : false;
bool boolValue = (bool)value;
if ( variant != boolValue )
{