kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #16985
[PATCH] coverity: silence floating point constant errors and SCH_TEXT::IsSelectStateChanged
Add the missing floating point specifier on three constants coverity notes.
SCH_TEXT::IsSelectStateChanged was doing SetFlags in both
cases.....change to ClearFlags in the else
--
Mark
From aedd39873f80ece462bb8bf3ba204d4e00d706b5 Mon Sep 17 00:00:00 2001
From: Mark Roszko <mark.roszko@xxxxxxxxx>
Date: Sat, 21 Feb 2015 00:11:18 -0500
Subject: [PATCH 1/2] coverity: fix constants to be specified as floating point
where noted
---
3d-viewer/3d_draw_helper_functions.cpp | 2 +-
common/gal/cairo/cairo_gal.cpp | 2 +-
pcbnew/magnetic_tracks_functions.cpp | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/3d-viewer/3d_draw_helper_functions.cpp b/3d-viewer/3d_draw_helper_functions.cpp
index b3c08aa..f74e700 100644
--- a/3d-viewer/3d_draw_helper_functions.cpp
+++ b/3d-viewer/3d_draw_helper_functions.cpp
@@ -304,7 +304,7 @@ void EDA_3D_CANVAS::Draw3DGrid( double aGriSizeMM )
glEnd();
}
- if( delta > xsize / 2 )
+ if( delta > xsize / 2.0f )
break;
}
diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp
index cd32934..07714ec 100644
--- a/common/gal/cairo/cairo_gal.cpp
+++ b/common/gal/cairo/cairo_gal.cpp
@@ -956,7 +956,7 @@ void CAIRO_GAL::blitCursor( wxBufferedDC& clientDC )
}
// Store pixels that are going to be overpainted
- VECTOR2D cursorScreen = ToScreen( cursorPosition ) - cursorSize / 2;
+ VECTOR2D cursorScreen = ToScreen( cursorPosition ) - cursorSize / 2.0f;
cursorSave.Blit( 0, 0, cursorSize, cursorSize, &clientDC, cursorScreen.x, cursorScreen.y );
// Draw the cursor
diff --git a/pcbnew/magnetic_tracks_functions.cpp b/pcbnew/magnetic_tracks_functions.cpp
index 884ad13..cc3f0c6 100644
--- a/pcbnew/magnetic_tracks_functions.cpp
+++ b/pcbnew/magnetic_tracks_functions.cpp
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -280,14 +280,14 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
if( currTrack->Type() != PCB_VIA_T
|| ( currTrack->GetStart() != track->GetStart() && currTrack->GetStart() != track->GetEnd() ))
{
- if( distStart <= currTrack->GetWidth()/2 )
+ if( distStart <= currTrack->GetWidth()/2.0f )
{
// D(printf("nearest end is start\n");)
*curpos = track->GetStart();
return true;
}
- if( distEnd <= currTrack->GetWidth()/2 )
+ if( distEnd <= currTrack->GetWidth()/2.0f )
{
// D(printf("nearest end is end\n");)
*curpos = track->GetEnd();
--
1.9.1
From a9dd520c4a7b2e73cad53494e59f97db8335ea92 Mon Sep 17 00:00:00 2001
From: Mark Roszko <mark.roszko@xxxxxxxxx>
Date: Sat, 21 Feb 2015 00:12:37 -0500
Subject: [PATCH 2/2] Clear Selected flags in SCH_TEXT::IsSelectStateChanged
properly
---
eeschema/sch_text.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index 3b1921d..b666938 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -558,7 +558,7 @@ bool SCH_TEXT::IsSelectStateChanged( const wxRect& aRect )
if( aRect.Contains( m_Pos ) )
SetFlags( SELECTED );
else
- SetFlags( SELECTED );
+ ClearFlags( SELECTED );
return previousState != IsSelected();
}
--
1.9.1
Follow ups