Fix a compil and Coverity warnings

This commit is contained in:
jean-pierre charras 2023-07-07 10:17:20 +02:00
parent 4f7e9bead5
commit 27072e52f7
3 changed files with 7 additions and 6 deletions

View File

@ -548,11 +548,11 @@ void CAIRO_GAL_BASE::DrawBitmap( const BITMAP_BASE& aBitmap, double alphaBlend )
a = bm_pix_buffer.GetAlpha( col, row ); a = bm_pix_buffer.GetAlpha( col, row );
// ARGB32 format needs pre-multiplied alpha // ARGB32 format needs pre-multiplied alpha
r = int32_t( r ) * a / 0xFF; r = uint32_t( r ) * a / 0xFF;
g = int32_t( g ) * a / 0xFF; g = uint32_t( g ) * a / 0xFF;
b = int32_t( b ) * a / 0xFF; b = uint32_t( b ) * a / 0xFF;
} }
else if( bm_pix_buffer.HasMask() && ( r << 16 | g << 8 | b ) == mask_color ) else if( bm_pix_buffer.HasMask() && (uint32_t)( r << 16 | g << 8 | b ) == mask_color )
{ {
a = wxALPHA_TRANSPARENT; a = wxALPHA_TRANSPARENT;
} }

View File

@ -609,7 +609,7 @@ wxString NETLIST_EXPORTER_ALLEGRO::formatFunction( wxString aName, LIB_PINS aPin
out_str.Printf( wxT( "PINORDER %s " ), TO_UTF8( aName ) ); out_str.Printf( wxT( "PINORDER %s " ), TO_UTF8( aName ) );
for( auto pinName : pinNameList ) for( wxString& pinName : pinNameList )
{ {
str.Printf( ",\n\t%s", TO_UTF8( pinName ) ); str.Printf( ",\n\t%s", TO_UTF8( pinName ) );
out_str += str; out_str += str;

View File

@ -1203,7 +1203,6 @@ bool PCB_CONTROL::placeBoardItems( BOARD_COMMIT* aCommit, std::vector<BOARD_ITEM
int PCB_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName ) int PCB_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
{ {
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame ); PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
BOARD_COMMIT commit( editFrame );
if( !editFrame ) if( !editFrame )
return 1; return 1;
@ -1213,6 +1212,8 @@ int PCB_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
if( !brd ) if( !brd )
return 1; return 1;
BOARD_COMMIT commit( editFrame );
// Mark existing items, in order to know what are the new items so we can select only // Mark existing items, in order to know what are the new items so we can select only
// the new items after loading // the new items after loading
for( PCB_TRACK* track : brd->Tracks() ) for( PCB_TRACK* track : brd->Tracks() )