Coverity issue fixes.
Fix Coverity issues 157138, 338547, and 338716.
This commit is contained in:
parent
a2c28b18a8
commit
3b16c38756
|
@ -1251,6 +1251,7 @@ CAIRO_GAL::CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
|
||||||
m_mainBuffer = 0;
|
m_mainBuffer = 0;
|
||||||
m_overlayBuffer = 0;
|
m_overlayBuffer = 0;
|
||||||
m_tempBuffer = 0;
|
m_tempBuffer = 0;
|
||||||
|
m_savedBuffer = 0;
|
||||||
m_validCompositor = false;
|
m_validCompositor = false;
|
||||||
SetTarget( TARGET_NONCACHED );
|
SetTarget( TARGET_NONCACHED );
|
||||||
|
|
||||||
|
@ -1324,7 +1325,6 @@ void CAIRO_GAL::endDrawing()
|
||||||
|
|
||||||
// Now translate the raw context data from the format stored
|
// Now translate the raw context data from the format stored
|
||||||
// by cairo into a format understood by wxImage.
|
// by cairo into a format understood by wxImage.
|
||||||
|
|
||||||
pixman_image_t* dstImg = pixman_image_create_bits(
|
pixman_image_t* dstImg = pixman_image_create_bits(
|
||||||
wxPlatformInfo::Get().GetEndianness() == wxENDIAN_LITTLE ? PIXMAN_b8g8r8
|
wxPlatformInfo::Get().GetEndianness() == wxENDIAN_LITTLE ? PIXMAN_b8g8r8
|
||||||
: PIXMAN_r8g8b8,
|
: PIXMAN_r8g8b8,
|
||||||
|
@ -1644,7 +1644,6 @@ void CAIRO_GAL_BASE::DrawGrid()
|
||||||
int gridEndY = KiROUND( ( worldEndPoint.y - m_gridOrigin.y ) / gridScreenSize.y );
|
int gridEndY = KiROUND( ( worldEndPoint.y - m_gridOrigin.y ) / gridScreenSize.y );
|
||||||
|
|
||||||
// Ensure start coordinate > end coordinate
|
// Ensure start coordinate > end coordinate
|
||||||
|
|
||||||
SWAP( gridStartX, >, gridEndX );
|
SWAP( gridStartX, >, gridEndX );
|
||||||
SWAP( gridStartY, >, gridEndY );
|
SWAP( gridStartY, >, gridEndY );
|
||||||
|
|
||||||
|
@ -1691,6 +1690,7 @@ void CAIRO_GAL_BASE::DrawGrid()
|
||||||
{
|
{
|
||||||
m_lineWidthIsOdd = true;
|
m_lineWidthIsOdd = true;
|
||||||
m_isStrokeEnabled = true;
|
m_isStrokeEnabled = true;
|
||||||
|
|
||||||
for( int j = gridStartY; j <= gridEndY; j++ )
|
for( int j = gridStartY; j <= gridEndY; j++ )
|
||||||
{
|
{
|
||||||
bool tickY = ( j % m_gridTick == 0 );
|
bool tickY = ( j % m_gridTick == 0 );
|
||||||
|
|
|
@ -435,9 +435,9 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( zoneTree->QueryColliding( itemBBox, itemShape.get(), aLayer,
|
if( zoneTree && zoneTree->QueryColliding( itemBBox, itemShape.get(), aLayer,
|
||||||
std::max( 0, clearance - m_drcEpsilon ),
|
std::max( 0, clearance - m_drcEpsilon ),
|
||||||
&actual, &pos ) )
|
&actual, &pos ) )
|
||||||
{
|
{
|
||||||
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_CLEARANCE );
|
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_CLEARANCE );
|
||||||
|
|
||||||
|
@ -480,9 +480,9 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem
|
||||||
aLayer );
|
aLayer );
|
||||||
clearance = constraint.GetValue().Min();
|
clearance = constraint.GetValue().Min();
|
||||||
|
|
||||||
if( zoneTree->QueryColliding( itemBBox, holeShape.get(), aLayer,
|
if( zoneTree && zoneTree->QueryColliding( itemBBox, holeShape.get(), aLayer,
|
||||||
std::max( 0, clearance - m_drcEpsilon ),
|
std::max( 0, clearance - m_drcEpsilon ),
|
||||||
&actual, &pos ) )
|
&actual, &pos ) )
|
||||||
{
|
{
|
||||||
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_HOLE_CLEARANCE );
|
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_HOLE_CLEARANCE );
|
||||||
|
|
||||||
|
@ -740,8 +740,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
|
||||||
otherShape.reset( new SHAPE_SEGMENT( pos, pos, otherVia->GetDrill() ) );
|
otherShape.reset( new SHAPE_SEGMENT( pos, pos, otherVia->GetDrill() ) );
|
||||||
|
|
||||||
if( clearance > 0 && padShape->Collide( otherShape.get(),
|
if( clearance > 0 && padShape->Collide( otherShape.get(),
|
||||||
std::max( 0, clearance - m_drcEpsilon ),
|
std::max( 0, clearance - m_drcEpsilon ),
|
||||||
&actual, &pos ) )
|
&actual, &pos ) )
|
||||||
{
|
{
|
||||||
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_HOLE_CLEARANCE );
|
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_HOLE_CLEARANCE );
|
||||||
|
|
||||||
|
@ -874,7 +874,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Test for same net
|
// Test for same net
|
||||||
if( zoneRef->GetNetCode() == zoneToTest->GetNetCode() && zoneRef->GetNetCode() >= 0 )
|
if( zoneRef->GetNetCode() == zoneToTest->GetNetCode()
|
||||||
|
&& zoneRef->GetNetCode() >= 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// test for different priorities
|
// test for different priorities
|
||||||
|
|
|
@ -995,7 +995,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
||||||
textpos.y = -textpos.y;
|
textpos.y = -textpos.y;
|
||||||
|
|
||||||
// approximate the size of the pad number text:
|
// approximate the size of the pad number text:
|
||||||
double tsize = 1.5 * padsize.x / PrintableCharCount( padNumber );
|
double tsize = 1.5 * padsize.x / std::max( PrintableCharCount( padNumber ), 1 );
|
||||||
tsize = std::min( tsize, size );
|
tsize = std::min( tsize, size );
|
||||||
|
|
||||||
// Use a smaller text size to handle interline, pen size...
|
// Use a smaller text size to handle interline, pen size...
|
||||||
|
|
Loading…
Reference in New Issue