Repair Coverity scan defects.

This commit is contained in:
Jeff Young 2020-01-10 23:14:37 +00:00
parent b54a42ba53
commit 33da81cd27
3 changed files with 32 additions and 59 deletions

View File

@ -327,6 +327,7 @@ static void eagleToKicadAlignment( EDA_TEXT* aText, int aEagleAlignment, int aRe
default:
aText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
aText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
break;
}
}

View File

@ -217,6 +217,8 @@ void SCH_TEXT::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
{
default:
wxASSERT_MSG( 1, "Bad spin style" );
break;
case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation
//
m_spin_style = LABEL_SPIN_STYLE::RIGHT; // Handle the error spin style by resetting
@ -798,6 +800,8 @@ void SCH_GLOBALLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
{
default:
wxASSERT_MSG( 1, "Bad spin style" );
break;
case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation
//
m_spin_style = LABEL_SPIN_STYLE::RIGHT; // Handle the error spin style by resetting
@ -1041,6 +1045,8 @@ void SCH_HIERLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
{
default:
wxLogWarning( "SetLabelSpinStyle bad spin style" );
break;
case LABEL_SPIN_STYLE::LEFT:
//
m_spin_style = LABEL_SPIN_STYLE::LEFT; // Handle the error spin style by resetting

View File

@ -22,11 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_text.h
* @brief Definitions of the SCH_TEXT class and derivatives for Eeschema.
*/
#ifndef CLASS_TEXT_LABEL_H
#define CLASS_TEXT_LABEL_H
@ -89,22 +84,14 @@ public:
LABEL_SPIN_STYLE RotateCW()
{
SPIN newSpin = m_spin;
switch( m_spin )
{
default:
wxLogWarning( "RotateCCW encountered unknown current spin style" );
case LABEL_SPIN_STYLE::LEFT:
newSpin = LABEL_SPIN_STYLE::UP;
break;
case LABEL_SPIN_STYLE::UP:
newSpin = LABEL_SPIN_STYLE::RIGHT;
break;
case LABEL_SPIN_STYLE::RIGHT:
newSpin = LABEL_SPIN_STYLE::BOTTOM;
break;
case LABEL_SPIN_STYLE::BOTTOM:
newSpin = LABEL_SPIN_STYLE::LEFT;
break;
case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::UP; break;
case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::LEFT; break;
default: wxLogWarning( "RotateCCW encountered unknown current spin style" ); break;
}
return LABEL_SPIN_STYLE( newSpin );
@ -114,22 +101,14 @@ public:
LABEL_SPIN_STYLE RotateCCW()
{
SPIN newSpin = m_spin;
switch( m_spin )
{
default:
wxLogWarning( "RotateCCW encountered unknown current spin style" );
case LABEL_SPIN_STYLE::LEFT:
newSpin = LABEL_SPIN_STYLE::BOTTOM;
break;
case LABEL_SPIN_STYLE::BOTTOM:
newSpin = LABEL_SPIN_STYLE::RIGHT;
break;
case LABEL_SPIN_STYLE::RIGHT:
newSpin = LABEL_SPIN_STYLE::UP;
break;
case LABEL_SPIN_STYLE::UP:
newSpin = LABEL_SPIN_STYLE::LEFT;
break;
case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::UP; break;
case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::LEFT; break;
default: wxLogWarning( "RotateCCW encountered unknown current spin style" ); break;
}
return LABEL_SPIN_STYLE( newSpin );
@ -142,20 +121,14 @@ public:
LABEL_SPIN_STYLE MirrorX()
{
SPIN newSpin = m_spin;
switch( m_spin )
{
default:
wxLogWarning( "MirrorX encountered unknown current spin style" );
case LABEL_SPIN_STYLE::UP:
newSpin = LABEL_SPIN_STYLE::BOTTOM;
break;
case LABEL_SPIN_STYLE::BOTTOM:
newSpin = LABEL_SPIN_STYLE::UP;
break;
case LABEL_SPIN_STYLE::LEFT:
break;
case LABEL_SPIN_STYLE::RIGHT:
break;
case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::UP; break;
case LABEL_SPIN_STYLE::LEFT: break;
case LABEL_SPIN_STYLE::RIGHT: break;
default: wxLogWarning( "MirrorX encountered unknown current spin style" ); break;
}
return LABEL_SPIN_STYLE( newSpin );
@ -168,20 +141,14 @@ public:
LABEL_SPIN_STYLE MirrorY()
{
SPIN newSpin = m_spin;
switch( m_spin )
{
default:
wxLogWarning( "MirrorY encountered unknown current spin style" );
case LABEL_SPIN_STYLE::LEFT:
newSpin = LABEL_SPIN_STYLE::RIGHT;
break;
case LABEL_SPIN_STYLE::RIGHT:
newSpin = LABEL_SPIN_STYLE::LEFT;
break;
case LABEL_SPIN_STYLE::UP:
break;
case LABEL_SPIN_STYLE::BOTTOM:
break;
case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::LEFT; break;
case LABEL_SPIN_STYLE::UP: break;
case LABEL_SPIN_STYLE::BOTTOM: break;
default: wxLogWarning( "MirrorY encountered unknown current spin style" ); break;
}
return LABEL_SPIN_STYLE( newSpin );
@ -231,8 +198,7 @@ protected:
LABEL_SPIN_STYLE m_spin_style;
public:
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString,
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = SCH_TEXT_T );
/**