Use conditional operators to simplify statements

This commit is contained in:
Artur Wieczorek
2022-05-27 19:01:16 +02:00
parent 1c49b89b89
commit 2b4135ba14

View File

@@ -2464,11 +2464,7 @@ wxPGProperty* wxPGProperty::GetPropertyByName( const wxString& name ) const
wxPGProperty* wxPGProperty::GetPropertyByNameWH( const wxString& name, unsigned int hintIndex ) const
{
unsigned int i = hintIndex;
if ( i >= GetChildCount() )
i = 0;
unsigned int i = hintIndex >= GetChildCount() ? 0 : hintIndex;
unsigned int lastIndex = i - 1;
if ( lastIndex >= GetChildCount() )
@@ -2491,26 +2487,22 @@ wxPGProperty* wxPGProperty::GetPropertyByNameWH( const wxString& name, unsigned
return NULL;
}
int wxPGProperty::GetChildrenHeight( int lh, int iMax_ ) const
int wxPGProperty::GetChildrenHeight( int lh, int iMax ) const
{
// Returns height of children, recursively, and
// by taking expanded/collapsed status into account.
//
// iMax is used when finding property y-positions.
//
int h = 0;
if ( iMax_ == -1 )
iMax_ = GetChildCount();
unsigned int iMax = iMax_;
wxASSERT( iMax <= GetChildCount() );
unsigned int _iMax = iMax == -1 ? GetChildCount() : iMax;
wxASSERT( _iMax <= GetChildCount() );
if ( !IsExpanded() && GetParent() )
return 0;
for ( unsigned int i = 0; i < iMax; i++ )
int h = 0;
for ( unsigned int i = 0; i < _iMax; i++ )
{
wxPGProperty* pwc = Item(i);