+ fix various warnings

This commit is contained in:
wmayer
2015-08-29 22:05:09 +02:00
parent 1a12d109e9
commit cb16fec6bb
25 changed files with 55 additions and 40 deletions

View File

@@ -92,7 +92,7 @@ void Toolpath::insertCommand(const Command &Cmd, int pos)
{
if (pos == -1) {
addCommand(Cmd);
} else if (pos <= vpcCommands.size()) {
} else if (pos <= static_cast<int>(vpcCommands.size())) {
Command *tmp = new Command(Cmd);
vpcCommands.insert(vpcCommands.begin()+pos,tmp);
} else {
@@ -106,7 +106,7 @@ void Toolpath::deleteCommand(int pos)
if (pos == -1) {
//delete(*vpcCommands.rbegin()); // causes crash
vpcCommands.pop_back();
} else if (pos <= vpcCommands.size()) {
} else if (pos <= static_cast<int>(vpcCommands.size())) {
vpcCommands.erase (vpcCommands.begin()+pos);
} else {
throw Base::Exception("Index not in range");

View File

@@ -134,7 +134,7 @@ bool TaskDlgPathCompound::accept()
Path::FeatureCompound* pcCompound = static_cast<Path::FeatureCompound*>(CompoundView->getObject());
App::Document* pcDoc = static_cast<App::Document*>(pcCompound->getDocument());
std::vector<std::string> names = parameter->getList();
for(int i = 0; i < names.size(); i++)
for(std::size_t i = 0; i < names.size(); i++)
{
App::DocumentObject* pcPath = static_cast<App::DocumentObject*>(pcDoc->getObject(names[i].c_str()));
paths.push_back(pcPath);

View File

@@ -274,7 +274,7 @@ void ViewProviderPath::updateData(const App::Property* prop)
else
norm.Set(0,0,1);
Base::Vector3d center = (last + cmd.getCenter());
double radius = (last - center).Length();
//double radius = (last - center).Length();
double angle = (next - center).GetAngle(last - center);
// BUGGY: not needed anyway?
//Base::Vector3d anorm = (last - center) % (next - center);
@@ -308,7 +308,7 @@ void ViewProviderPath::updateData(const App::Property* prop)
} else if ((name=="G81")||(name=="G82")||(name=="G83")||(name=="G84")||(name=="G85")||(name=="G86")||(name=="G89")){
// drill,tap,bore
double r;
double r = 0;
if (cmd.has("R"))
r = cmd.getValue("R");
Base::Vector3d p1(next.x,next.y,last.z);

View File

@@ -82,7 +82,7 @@ public:
void Offset(double inwards_value);
void Thicken(double value);
void FitArcs();
unsigned int num_curves(){return m_curves.size();}
unsigned int num_curves(){return static_cast<unsigned int>(m_curves.size());}
Point NearestPoint(const Point& p)const;
void GetBox(CBox2D &box);
void Reorder();

View File

@@ -428,17 +428,16 @@ void recur(std::list<CArea> &arealist, const CArea& a1, const CAreaPocketParams
static CArea make_obround(const Point& p0, const Point& p1, double radius)
{
Point dir = p1 - p0;
double d = dir.length();
dir.normalize();
Point right(dir.y, -dir.x);
CArea obround;
CCurve c;
if(fabs(radius) < 0.0000001)radius = (radius > 0.0) ? 0.002 : (-0.002);
if(fabs(radius) < 0.0000001)radius = (radius > 0.0) ? 0.002 : (-0.002);
Point vt0 = p0 + right * radius;
Point vt1 = p1 + right * radius;
Point vt2 = p1 - right * radius;
Point vt3 = p0 - right * radius;
c.append(vt0);
c.append(vt0);
c.append(vt1);
c.append(CVertex(1, vt2, p1));
c.append(vt3);
@@ -446,12 +445,12 @@ static CArea make_obround(const Point& p0, const Point& p1, double radius)
obround.append(c);
return obround;
}
static bool feed_possible(const CArea &area_for_feed_possible, const Point& p0, const Point& p1, double tool_radius)
{
CArea obround = make_obround(p0, p1, tool_radius);
obround.Subtract(area_for_feed_possible);
return obround.m_curves.size() == 0;
return obround.m_curves.empty();
}
void MarkOverlappingOffsetIslands(std::list<IslandAndOffset> &offset_islands)

View File

@@ -86,7 +86,7 @@ bool CCurve::CheckForArc(const CVertex& prev_vt, std::list<const CVertex*>& migh
if(might_be_an_arc.size() < 2)return false;
// find middle point
int num = might_be_an_arc.size();
int num = static_cast<int>(might_be_an_arc.size());
int i = 0;
const CVertex* mid_vt = NULL;
int mid_i = (num-1)/2;
@@ -465,7 +465,7 @@ void CCurve::ChangeStart(const Point &p) {
bool started = false;
bool finished = false;
int start_span;
int start_span = 0;
bool closed = IsClosed();
for(int i = 0; i < (closed ? 2:1); i++)
@@ -911,7 +911,6 @@ double CCurve::PointToPerim(const Point& p)const
{
double best_dist = 0.0;
double perim_at_best_dist = 0.0;
Point best_point = Point(0, 0);
bool best_dist_found = false;
double perim = 0.0;

View File

@@ -33,6 +33,13 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Point.h"
#include "kurve/geometry.h"
#if defined (_POSIX_C_SOURCE)
# undef _POSIX_C_SOURCE
#endif
#if defined (_XOPEN_SOURCE)
# undef _XOPEN_SOURCE
#endif
#if _DEBUG
#undef _DEBUG
#include <Python.h>
@@ -86,7 +93,7 @@ boost::python::tuple transformed_point(const geoff_geometry::Matrix &matrix, dou
static void print_curve(const CCurve& c)
{
unsigned int nvertices = c.m_vertices.size();
std::size_t nvertices = c.m_vertices.size();
printf("number of vertices = %d\n", nvertices);
int i = 0;
for(std::list<CVertex>::const_iterator It = c.m_vertices.begin(); It != c.m_vertices.end(); It++, i++)
@@ -109,7 +116,7 @@ static void print_area(const CArea &a)
static unsigned int num_vertices(const CCurve& curve)
{
return curve.m_vertices.size();
return static_cast<int>(curve.m_vertices.size());
}
static CVertex FirstVertex(const CCurve& curve)