Commit 4def0958 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Fix some coverity warnings. Fix typo and errors in comments. Very minor other fixes.

parent be785d55
Loading
Loading
Loading
Loading
+26 −23
Original line number Original line Diff line number Diff line
@@ -61,7 +61,7 @@ static const int pin_orientation_codes[] =


// bitmaps to show pins orientations in dialog editor
// bitmaps to show pins orientations in dialog editor
// must have same order than pin_orientation_names
// must have same order than pin_orientation_names
static const BITMAP_DEF s_icons_Pins_Orientations[] =
static const BITMAP_DEF iconsPinsOrientations[] =
{
{
    pinorient_right_xpm,
    pinorient_right_xpm,
    pinorient_left_xpm,
    pinorient_left_xpm,
@@ -72,7 +72,7 @@ static const BITMAP_DEF s_icons_Pins_Orientations[] =


// bitmaps to show pins shapes in dialog editor
// bitmaps to show pins shapes in dialog editor
// must have same order than pin_style_names
// must have same order than pin_style_names
static BITMAP_DEF s_icons_Pins_Shapes[] =
static BITMAP_DEF iconsPinsShapes[] =
{
{
    pinshape_normal_xpm,
    pinshape_normal_xpm,
    pinshape_invert_xpm,
    pinshape_invert_xpm,
@@ -122,7 +122,7 @@ static const BITMAP_DEF iconsPinsElectricalType[] =
#define PIN_ELECTRICAL_TYPE_CNT DIM( iconsPinsElectricalType )
#define PIN_ELECTRICAL_TYPE_CNT DIM( iconsPinsElectricalType )




const wxString LIB_PIN::GetCanonicalElectricalTypeName( unsigned aType )
const wxString LIB_PIN::GetCanonicalElectricalTypeName( int aType )
{
{
    // These strings are the canonical name of the electrictal type
    // These strings are the canonical name of the electrictal type
    // Not translated, no space in name, only ASCII chars.
    // Not translated, no space in name, only ASCII chars.
@@ -144,7 +144,7 @@ const wxString LIB_PIN::GetCanonicalElectricalTypeName( unsigned aType )
        wxT( "???" )
        wxT( "???" )
    };
    };


    if( aType >= PIN_NMAX )
    if( aType < 0 || aType > int( PIN_NMAX ) )
        aType = PIN_NMAX;
        aType = PIN_NMAX;


    return msgPinElectricType[ aType ];
    return msgPinElectricType[ aType ];
@@ -155,7 +155,7 @@ const wxString LIB_PIN::GetCanonicalElectricalTypeName( unsigned aType )
// Note: the strings are *not* static because they are translated and must be built
// Note: the strings are *not* static because they are translated and must be built
// on the fly, to be properly translated
// on the fly, to be properly translated


static const wxString getPinOrientationName( unsigned aPinOrientationCode )
static const wxString getPinOrientationName( int aPinOrientationCode )
{
{
    /* Note: The following name lists are sentence capitalized per the GNOME UI
    /* Note: The following name lists are sentence capitalized per the GNOME UI
     *       standards for list controls.  Please do not change the capitalization
     *       standards for list controls.  Please do not change the capitalization
@@ -166,16 +166,17 @@ static const wxString getPinOrientationName( unsigned aPinOrientationCode )
        _( "Right" ),
        _( "Right" ),
        _( "Left" ),
        _( "Left" ),
        _( "Up" ),
        _( "Up" ),
        _( "Down" )
        _( "Down" ),
        wxT( "???" )
    };
    };


    if( aPinOrientationCode < PIN_ORIENTATION_CNT )
    if( aPinOrientationCode < 0 || aPinOrientationCode > int( PIN_ORIENTATION_CNT ) )
        aPinOrientationCode = PIN_ORIENTATION_CNT;

    return pin_orientation_names[ aPinOrientationCode ];
    return pin_orientation_names[ aPinOrientationCode ];
    else
        return wxT( "??" );
}
}


const wxString LIB_PIN::GetElectricalTypeName( unsigned aPinsElectricalType )
const wxString LIB_PIN::GetElectricalTypeName( int aPinsElectricalType )
{
{
    const wxString pin_electrical_type_names[] =
    const wxString pin_electrical_type_names[] =
    {   // Keep these translated strings not static
    {   // Keep these translated strings not static
@@ -189,16 +190,17 @@ const wxString LIB_PIN::GetElectricalTypeName( unsigned aPinsElectricalType )
        _( "Power output" ),
        _( "Power output" ),
        _( "Open collector" ),
        _( "Open collector" ),
        _( "Open emitter" ),
        _( "Open emitter" ),
        _( "Not connected" )
        _( "Not connected" ),
        wxT( "???" )
    };
    };


    if( aPinsElectricalType < PIN_ELECTRICAL_TYPE_CNT )
    if( aPinsElectricalType < 0 || aPinsElectricalType > int( PIN_ELECTRICAL_TYPE_CNT ) )
        return pin_electrical_type_names[ aPinsElectricalType ];
        aPinsElectricalType = PIN_ELECTRICAL_TYPE_CNT;


    return wxT( "??" );
    return pin_electrical_type_names[ aPinsElectricalType ];
}
}


const wxString getPinStyleName( unsigned aPinsStyle )
static const wxString getPinStyleName( int aPinsStyle )
{
{
    const wxString pin_style_names[] =
    const wxString pin_style_names[] =
    {   // Keep these translated strings not static
    {   // Keep these translated strings not static
@@ -210,13 +212,14 @@ const wxString getPinStyleName( unsigned aPinsStyle )
        _( "Clock low" ),
        _( "Clock low" ),
        _( "Output low" ),
        _( "Output low" ),
        _( "Falling edge clock" ),
        _( "Falling edge clock" ),
        _( "NonLogic" )
        _( "NonLogic" ),
        wxT( "???" )
    };
    };


    if( aPinsStyle < PIN_STYLE_CNT )
    if( aPinsStyle < 0 || aPinsStyle > int( PIN_STYLE_CNT ) )
        return pin_style_names[ aPinsStyle ];
        aPinsStyle = PIN_STYLE_CNT;


    return wxT( "??" );
    return pin_style_names[ aPinsStyle ];
}
}




@@ -2227,13 +2230,13 @@ const BITMAP_DEF* LIB_PIN::GetElectricalTypeSymbols()


const BITMAP_DEF* LIB_PIN::GetOrientationSymbols()
const BITMAP_DEF* LIB_PIN::GetOrientationSymbols()
{
{
    return s_icons_Pins_Orientations;
    return iconsPinsOrientations;
}
}




const BITMAP_DEF* LIB_PIN::GetStyleSymbols()
const BITMAP_DEF* LIB_PIN::GetStyleSymbols()
{
{
    return s_icons_Pins_Shapes;
    return iconsPinsShapes;
}
}




+2 −2
Original line number Original line Diff line number Diff line
@@ -272,7 +272,7 @@ public:
     * @param aType is the electrical type (see enum ElectricPinType )
     * @param aType is the electrical type (see enum ElectricPinType )
     * @return The electrical name for a pin type (see enun MsgPinElectricType for names).
     * @return The electrical name for a pin type (see enun MsgPinElectricType for names).
     */
     */
    static const wxString GetCanonicalElectricalTypeName( unsigned aType );
    static const wxString GetCanonicalElectricalTypeName( int aType );


    /**
    /**
     * return a string giving the electrical type of the pin.
     * return a string giving the electrical type of the pin.
@@ -289,7 +289,7 @@ public:
     * @param aType is the electrical type (see enum ElectricPinType )
     * @param aType is the electrical type (see enum ElectricPinType )
     * @return The electrical name of the pin (see enun MsgPinElectricType for names).
     * @return The electrical name of the pin (see enun MsgPinElectricType for names).
     */
     */
    static const wxString GetElectricalTypeName( unsigned aType );
    static const wxString GetElectricalTypeName( int aType );


    /**
    /**
     * return a translated string for messages giving the electrical type of the pin.
     * return a translated string for messages giving the electrical type of the pin.
+2 −2
Original line number Original line Diff line number Diff line
@@ -198,7 +198,7 @@ struct KIFACE
     * @param aCtlBits consists of bit flags from the set of KFCTL_* \#defines above.
     * @param aCtlBits consists of bit flags from the set of KFCTL_* \#defines above.
     *
     *
     * @return wxWindow* - and if not NULL, should be cast into the known type using
     * @return wxWindow* - and if not NULL, should be cast into the known type using
     *  and old school cast.  dynamic_cast is problemenatic since it needs typeinfo probably
     *  and old school cast.  dynamic_cast is problematic since it needs typeinfo probably
     *  not contained in the caller's link image.
     *  not contained in the caller's link image.
     */
     */
    VTBL_ENTRY  wxWindow* CreateWindow( wxWindow* aParent, int aClassId,
    VTBL_ENTRY  wxWindow* CreateWindow( wxWindow* aParent, int aClassId,
@@ -228,7 +228,7 @@ struct KIFACE
 * having to link to the top process module which houses the KIWAY(s).  More importantly
 * having to link to the top process module which houses the KIWAY(s).  More importantly
 * it makes it possible to send custom wxEvents between DSOs and from the top
 * it makes it possible to send custom wxEvents between DSOs and from the top
 * process module down into the DSOs.  The latter capability is thought useful
 * process module down into the DSOs.  The latter capability is thought useful
 * for driving the lower DSOs from a python test rig or for demo (automaton) purposes.
 * for driving the lower DSOs from a python test rig or for demo (automation) purposes.
 * <p>
 * <p>
 * Most all calls are via virtual functions, which means C++ vtables
 * Most all calls are via virtual functions, which means C++ vtables
 * are used to hold function pointers and eliminate the need to link to specific
 * are used to hold function pointers and eliminate the need to link to specific
+3 −0
Original line number Original line Diff line number Diff line
@@ -82,6 +82,9 @@ public:
        m_func( aEntry ), m_saved( NULL ), m_self( NULL ), m_stack( NULL ),
        m_func( aEntry ), m_saved( NULL ), m_self( NULL ), m_stack( NULL ),
        m_stackSize( c_defaultStackSize ), m_running( false )
        m_stackSize( c_defaultStackSize ), m_running( false )
    {
    {
        // Avoid not initialized members, and make static analysers quiet
        m_args = 0;
        m_retVal = 0;
    }
    }


    ~COROUTINE()
    ~COROUTINE()
+3 −1
Original line number Original line Diff line number Diff line
@@ -697,7 +697,9 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
    drawList.SetSheetNumber( screen->m_ScreenNumber );
    drawList.SetSheetNumber( screen->m_ScreenNumber );
    drawList.SetSheetCount( screen->m_NumberOfScreens );
    drawList.SetSheetCount( screen->m_NumberOfScreens );
    drawList.SetFileName( GetCurrFileName() );
    drawList.SetFileName( GetCurrFileName() );
    drawList.SetSheetName( GetScreenDesc() );
    // GetScreenDesc() returns a temporary string. Store it to avoid issues.
    wxString descr = GetScreenDesc();
    drawList.SetSheetName( descr );


    drawList.BuildWorkSheetGraphicList( pageInfo, t_block, color, color );
    drawList.BuildWorkSheetGraphicList( pageInfo, t_block, color, color );


Loading