From d903af5373a26c3acf891786128f43a258901039 Mon Sep 17 00:00:00 2001
From: eyal0 <eyalsoha@gmail.com>
Date: Mon, 11 Sep 2017 10:49:59 +0300
Subject: [PATCH] Many warnings fixed (#510)

Thanks
---
 xs/src/libslic3r/ExtrusionEntity.hpp | 8 ++++----
 xs/src/libslic3r/Geometry.hpp        | 6 +++---
 xs/src/libslic3r/Line.hpp            | 2 +-
 xs/src/libslic3r/Model.hpp           | 2 +-
 xs/src/libslic3r/Print.hpp           | 2 +-
 xs/src/slic3r/GUI/3DScene.cpp        | 6 ------
 xs/src/slic3r/GUI/3DScene.hpp        | 4 ++--
 7 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/xs/src/libslic3r/ExtrusionEntity.hpp b/xs/src/libslic3r/ExtrusionEntity.hpp
index 699821634..6e5b123dc 100644
--- a/xs/src/libslic3r/ExtrusionEntity.hpp
+++ b/xs/src/libslic3r/ExtrusionEntity.hpp
@@ -105,10 +105,10 @@ public:
     // Height of the extrusion, used for visualization purposed.
     float height;
     
-    ExtrusionPath(ExtrusionRole role) : m_role(role), mm3_per_mm(-1), width(-1), height(-1) {};
-    ExtrusionPath(ExtrusionRole role, double mm3_per_mm, float width, float height) : m_role(role), mm3_per_mm(mm3_per_mm), width(width), height(height) {};
-    ExtrusionPath(const ExtrusionPath &rhs) : m_role(rhs.m_role), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), polyline(rhs.polyline) {}
-    ExtrusionPath(ExtrusionPath &&rhs) : m_role(rhs.m_role), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), polyline(std::move(rhs.polyline)) {}
+    ExtrusionPath(ExtrusionRole role) : mm3_per_mm(-1), width(-1), height(-1), m_role(role) {};
+    ExtrusionPath(ExtrusionRole role, double mm3_per_mm, float width, float height) : mm3_per_mm(mm3_per_mm), width(width), height(height), m_role(role) {};
+    ExtrusionPath(const ExtrusionPath &rhs) : polyline(rhs.polyline), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), m_role(rhs.m_role) {}
+    ExtrusionPath(ExtrusionPath &&rhs) : polyline(std::move(rhs.polyline)), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), m_role(rhs.m_role) {}
 //    ExtrusionPath(ExtrusionRole role, const Flow &flow) : m_role(role), mm3_per_mm(flow.mm3_per_mm()), width(flow.width), height(flow.height) {};
 
     ExtrusionPath& operator=(const ExtrusionPath &rhs) { this->m_role = rhs.m_role; this->mm3_per_mm = rhs.mm3_per_mm; this->width = rhs.width; this->height = rhs.height; this->polyline = rhs.polyline; return *this; }
diff --git a/xs/src/libslic3r/Geometry.hpp b/xs/src/libslic3r/Geometry.hpp
index bb3fa1e75..c2c3dc8b7 100644
--- a/xs/src/libslic3r/Geometry.hpp
+++ b/xs/src/libslic3r/Geometry.hpp
@@ -48,8 +48,8 @@ static inline bool is_ccw(const Polygon &poly)
         return true;
 
     // 1) Find the lowest lexicographical point.
-    int     imin = 0;
-    for (int i = 1; i < poly.points.size(); ++ i) {
+    unsigned int imin = 0;
+    for (unsigned int i = 1; i < poly.points.size(); ++ i) {
         const Point &pmin = poly.points[imin];
         const Point &p    = poly.points[i];
         if (p.x < pmin.x || (p.x == pmin.x && p.y < pmin.y))
@@ -134,7 +134,7 @@ class MedialAxis {
     double max_width;
     double min_width;
     MedialAxis(double _max_width, double _min_width, const ExPolygon* _expolygon = NULL)
-        : max_width(_max_width), min_width(_min_width), expolygon(_expolygon) {};
+        : expolygon(_expolygon), max_width(_max_width), min_width(_min_width) {};
     void build(ThickPolylines* polylines);
     void build(Polylines* polylines);
     
diff --git a/xs/src/libslic3r/Line.hpp b/xs/src/libslic3r/Line.hpp
index 99e1f4070..1be508f11 100644
--- a/xs/src/libslic3r/Line.hpp
+++ b/xs/src/libslic3r/Line.hpp
@@ -53,7 +53,7 @@ class ThickLine : public Line
     coordf_t a_width, b_width;
     
     ThickLine() : a_width(0), b_width(0) {};
-    ThickLine(Point _a, Point _b) : a_width(0), b_width(0), Line(_a, _b) {};
+    ThickLine(Point _a, Point _b) : Line(_a, _b), a_width(0), b_width(0) {};
 };
 
 class Linef
diff --git a/xs/src/libslic3r/Model.hpp b/xs/src/libslic3r/Model.hpp
index d025f83c9..636dfa1f4 100644
--- a/xs/src/libslic3r/Model.hpp
+++ b/xs/src/libslic3r/Model.hpp
@@ -130,7 +130,7 @@ public:
     void print_info() const;
     
 private:        
-    ModelObject(Model *model) : m_model(model),  m_bounding_box_valid(false), layer_height_profile_valid(false) {}
+    ModelObject(Model *model) : layer_height_profile_valid(false), m_model(model), m_bounding_box_valid(false) {}
     ModelObject(Model *model, const ModelObject &other, bool copy_volumes = true);
     ModelObject& operator= (ModelObject other);
     void swap(ModelObject &other);
diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp
index bc8b17868..c4093b795 100644
--- a/xs/src/libslic3r/Print.hpp
+++ b/xs/src/libslic3r/Print.hpp
@@ -146,7 +146,7 @@ public:
     BoundingBox bounding_box() const { return BoundingBox(Point(0,0), this->size); }
 
     // adds region_id, too, if necessary
-    void add_region_volume(int region_id, int volume_id) {
+    void add_region_volume(unsigned int region_id, int volume_id) {
         if (region_id >= region_volumes.size())
             region_volumes.resize(region_id + 1);
         region_volumes[region_id].push_back(volume_id);
diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp
index 6285d90db..9e3e4cc7d 100644
--- a/xs/src/slic3r/GUI/3DScene.cpp
+++ b/xs/src/slic3r/GUI/3DScene.cpp
@@ -414,14 +414,12 @@ static void thick_lines_to_indexed_vertex_array(
     Line prev_line;
     // right, left, top, bottom
     int     idx_prev[4]      = { -1, -1, -1, -1 };
-    double  width_prev       = 0.;
     double  bottom_z_prev    = 0.;
     Pointf  b1_prev;
     Pointf  b2_prev;
     Vectorf v_prev;
     int     idx_initial[4]   = { -1, -1, -1, -1 };
     double  width_initial    = 0.;
-    double  bottom_z_initial = 0.;
 
     // loop once more in case of closed loops
     size_t lines_end = closed ? (lines.size() + 1) : lines.size();
@@ -459,9 +457,7 @@ static void thick_lines_to_indexed_vertex_array(
         int idx_b[4];
         int idx_last = int(volume.vertices_and_normals_interleaved.size() / 6);
 
-        bool width_different    = width_prev != width;
         bool bottom_z_different = bottom_z_prev != bottom_z;
-        width_prev    = width;
         bottom_z_prev = bottom_z;
 
         // Share top / bottom vertices if possible.
@@ -486,7 +482,6 @@ static void thick_lines_to_indexed_vertex_array(
         if (ii == 0) {
             // Start of the 1st line segment.
             width_initial    = width;
-            bottom_z_initial = bottom_z;
             memcpy(idx_initial, idx_a, sizeof(int) * 4);
         } else {
             // Continuing a previous segment.
@@ -579,7 +574,6 @@ static void thick_lines_to_indexed_vertex_array(
 
         prev_line = line;
         memcpy(idx_prev, idx_b, 4 * sizeof(int));
-        width_prev = width;
         bottom_z_prev = bottom_z;
         b1_prev = b1;
         b2_prev = b2;
diff --git a/xs/src/slic3r/GUI/3DScene.hpp b/xs/src/slic3r/GUI/3DScene.hpp
index 4bf64a676..850b72000 100644
--- a/xs/src/slic3r/GUI/3DScene.hpp
+++ b/xs/src/slic3r/GUI/3DScene.hpp
@@ -207,8 +207,8 @@ public:
         drag_group_id(-1),
         selected(false),
         hover(false),
-        qverts_range(0, size_t(-1)),
-        tverts_range(0, size_t(-1))
+        tverts_range(0, size_t(-1)),
+        qverts_range(0, size_t(-1))
     {
         color[0] = r;
         color[1] = g;