quiet warnings, add Clamp()
This commit is contained in:
parent
b5cac30abd
commit
87aa22f13f
|
@ -1,8 +1,8 @@
|
|||
/********************/
|
||||
/* System includes. */
|
||||
/********************/
|
||||
#ifndef FCTSYS_H
|
||||
#define FCTSYS_H
|
||||
#ifndef FCTSYS_H_
|
||||
#define FCTSYS_H_
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
|
@ -46,6 +46,25 @@
|
|||
#define D(x) // nothing
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Function Clamp
|
||||
* limits @a value within the range @a lower <= @a value <= @a upper. It will work
|
||||
* on temporary expressions, since they are evaluated only once, and it should work
|
||||
* on most if not all numeric types. The arguments are accepted in this order so you
|
||||
* can remember the expression as a memory aid:
|
||||
* <p>
|
||||
* result is: lower <= value <= upper
|
||||
*/
|
||||
template <typename T> inline const T& Clamp( const T& lower, const T& value, const T& upper )
|
||||
{
|
||||
wxASSERT( lower <= upper );
|
||||
if( value < lower )
|
||||
return lower;
|
||||
else if( value > upper )
|
||||
return upper;
|
||||
return value;
|
||||
}
|
||||
|
||||
#define UNIX_STRING_DIR_SEP wxT( "/" )
|
||||
#define WIN_STRING_DIR_SEP wxT( "\\" )
|
||||
|
||||
|
@ -64,4 +83,4 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
#endif /* FCTSYS_H */
|
||||
#endif // FCTSYS_H__
|
||||
|
|
|
@ -438,7 +438,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
// Type of pad selection
|
||||
m_PadType->SetSelection( 0 );
|
||||
|
||||
for( int ii = 0; ii < NBTYPES; ii++ )
|
||||
for( unsigned ii = 0; ii < NBTYPES; ii++ )
|
||||
{
|
||||
if( CodeType[ii] == m_dummyPad->GetAttribute() )
|
||||
{
|
||||
|
@ -574,10 +574,9 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
|
|||
void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
|
||||
{
|
||||
long layer_mask;
|
||||
int ii;
|
||||
unsigned ii = m_PadType->GetSelection();
|
||||
|
||||
ii = m_PadType->GetSelection();
|
||||
if( ii < 0 || ii >= NBTYPES )
|
||||
if( ii >= NBTYPES ) // catches < 0 also
|
||||
ii = 0;
|
||||
|
||||
layer_mask = Std_Pad_Layers[ii];
|
||||
|
|
Loading…
Reference in New Issue