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: default:
aText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); aText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
aText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); aText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
break;
} }
} }

View File

@ -217,6 +217,8 @@ void SCH_TEXT::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
{ {
default: default:
wxASSERT_MSG( 1, "Bad spin style" ); wxASSERT_MSG( 1, "Bad spin style" );
break;
case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation
// //
m_spin_style = LABEL_SPIN_STYLE::RIGHT; // Handle the error spin style by resetting 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: default:
wxASSERT_MSG( 1, "Bad spin style" ); wxASSERT_MSG( 1, "Bad spin style" );
break;
case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation case LABEL_SPIN_STYLE::RIGHT: // Horiz Normal Orientation
// //
m_spin_style = LABEL_SPIN_STYLE::RIGHT; // Handle the error spin style by resetting 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: default:
wxLogWarning( "SetLabelSpinStyle bad spin style" ); wxLogWarning( "SetLabelSpinStyle bad spin style" );
break;
case LABEL_SPIN_STYLE::LEFT: case LABEL_SPIN_STYLE::LEFT:
// //
m_spin_style = LABEL_SPIN_STYLE::LEFT; // Handle the error spin style by resetting 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 * 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 #ifndef CLASS_TEXT_LABEL_H
#define CLASS_TEXT_LABEL_H #define CLASS_TEXT_LABEL_H
@ -89,22 +84,14 @@ public:
LABEL_SPIN_STYLE RotateCW() LABEL_SPIN_STYLE RotateCW()
{ {
SPIN newSpin = m_spin; SPIN newSpin = m_spin;
switch( m_spin ) switch( m_spin )
{ {
default: case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::UP; break;
wxLogWarning( "RotateCCW encountered unknown current spin style" ); case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
case LABEL_SPIN_STYLE::LEFT: case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
newSpin = LABEL_SPIN_STYLE::UP; case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::LEFT; break;
break; default: wxLogWarning( "RotateCCW encountered unknown current spin style" ); 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;
} }
return LABEL_SPIN_STYLE( newSpin ); return LABEL_SPIN_STYLE( newSpin );
@ -114,22 +101,14 @@ public:
LABEL_SPIN_STYLE RotateCCW() LABEL_SPIN_STYLE RotateCCW()
{ {
SPIN newSpin = m_spin; SPIN newSpin = m_spin;
switch( m_spin ) switch( m_spin )
{ {
default: case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
wxLogWarning( "RotateCCW encountered unknown current spin style" ); case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
case LABEL_SPIN_STYLE::LEFT: case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::UP; break;
newSpin = LABEL_SPIN_STYLE::BOTTOM; case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::LEFT; break;
break; default: wxLogWarning( "RotateCCW encountered unknown current spin style" ); 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;
} }
return LABEL_SPIN_STYLE( newSpin ); return LABEL_SPIN_STYLE( newSpin );
@ -142,20 +121,14 @@ public:
LABEL_SPIN_STYLE MirrorX() LABEL_SPIN_STYLE MirrorX()
{ {
SPIN newSpin = m_spin; SPIN newSpin = m_spin;
switch( m_spin ) switch( m_spin )
{ {
default: case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::BOTTOM; break;
wxLogWarning( "MirrorX encountered unknown current spin style" ); case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::UP; break;
case LABEL_SPIN_STYLE::UP: case LABEL_SPIN_STYLE::LEFT: break;
newSpin = LABEL_SPIN_STYLE::BOTTOM; case LABEL_SPIN_STYLE::RIGHT: break;
break; default: wxLogWarning( "MirrorX encountered unknown current spin style" ); break;
case LABEL_SPIN_STYLE::BOTTOM:
newSpin = LABEL_SPIN_STYLE::UP;
break;
case LABEL_SPIN_STYLE::LEFT:
break;
case LABEL_SPIN_STYLE::RIGHT:
break;
} }
return LABEL_SPIN_STYLE( newSpin ); return LABEL_SPIN_STYLE( newSpin );
@ -168,20 +141,14 @@ public:
LABEL_SPIN_STYLE MirrorY() LABEL_SPIN_STYLE MirrorY()
{ {
SPIN newSpin = m_spin; SPIN newSpin = m_spin;
switch( m_spin ) switch( m_spin )
{ {
default: case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::RIGHT; break;
wxLogWarning( "MirrorY encountered unknown current spin style" ); case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::LEFT; break;
case LABEL_SPIN_STYLE::LEFT: case LABEL_SPIN_STYLE::UP: break;
newSpin = LABEL_SPIN_STYLE::RIGHT; case LABEL_SPIN_STYLE::BOTTOM: break;
break; default: wxLogWarning( "MirrorY encountered unknown current spin style" ); break;
case LABEL_SPIN_STYLE::RIGHT:
newSpin = LABEL_SPIN_STYLE::LEFT;
break;
case LABEL_SPIN_STYLE::UP:
break;
case LABEL_SPIN_STYLE::BOTTOM:
break;
} }
return LABEL_SPIN_STYLE( newSpin ); return LABEL_SPIN_STYLE( newSpin );
@ -231,8 +198,7 @@ protected:
LABEL_SPIN_STYLE m_spin_style; LABEL_SPIN_STYLE m_spin_style;
public: public:
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
const wxString& text = wxEmptyString,
KICAD_T aType = SCH_TEXT_T ); KICAD_T aType = SCH_TEXT_T );
/** /**