kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #14782
Fix signed/unsigned warning in pcbnew/tools/drawing_tool.cpp:1022 [PATCH]
Just updated to latest bzr and saw a warning when compiling:
/nfs/home/azonenberg/Documents/local/programming/3rdparty/kicad/pcbnew/tools/drawing_tool.cpp: In member function ‘bool DRAWING_TOOL::drawSegment(int, DRAWSEGMENT*&, boost::optional<VECTOR2<double> >)’:
/nfs/home/azonenberg/Documents/local/programming/3rdparty/kicad/pcbnew/tools/drawing_tool.cpp:1022:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
This is caused by DRAWING_TOOL::WIDTH_STEP being a const int, rather
than an unsigned int.
The attached patch explicitly casts it to unsigned before comparing
against lineWidth, which is unsigned. Another possible fix is to change
WIDTH_STEP to an unsigned int but I'm not sure where else it's used;
this patch is less intrusive and easier to confirm safety of.
--
Andrew Zonenberg
PhD student, security group
Computer Science Department
Rensselaer Polytechnic Institute
http://colossus.cs.rpi.edu/~azonenberg/
=== modified file 'pcbnew/tools/drawing_tool.cpp'
--- pcbnew/tools/drawing_tool.cpp 2014-09-01 11:48:51 +0000
+++ pcbnew/tools/drawing_tool.cpp 2014-09-21 16:03:08 +0000
@@ -1019,7 +1019,7 @@
else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) )
{
- if( lineWidth > WIDTH_STEP )
+ if( lineWidth > (unsigned int)WIDTH_STEP )
{
lineWidth -= WIDTH_STEP;
aGraphic->SetWidth( lineWidth );
Attachment:
signature.asc
Description: This is a digitally signed message part