diff --git a/src/core/domains/interval/codac2_Interval_impl.h b/src/core/domains/interval/codac2_Interval_impl.h index 8e2bd0cfc..55e7c4cfc 100644 --- a/src/core/domains/interval/codac2_Interval_impl.h +++ b/src/core/domains/interval/codac2_Interval_impl.h @@ -624,7 +624,7 @@ namespace codac2 inline Interval operator""_i(long double x) { - return Interval(x); + return Interval(static_cast(x)); } inline double prev_float(double x) diff --git a/src/core/functions/analytic/codac2_analytic_constants.h b/src/core/functions/analytic/codac2_analytic_constants.h index ae446bfda..e4e943503 100644 --- a/src/core/functions/analytic/codac2_analytic_constants.h +++ b/src/core/functions/analytic/codac2_analytic_constants.h @@ -65,13 +65,16 @@ namespace codac2 if constexpr(std::is_same_v) return {1,1}; - if constexpr(std::is_same_v) + else if constexpr(std::is_same_v) return {_x.size(),1}; - if constexpr(std::is_same_v) + else if constexpr(std::is_same_v) return {_x.rows(),_x.cols()}; - assert_release_constexpr(false && "unknow output shape for constant"); + // In an else branch, discarded along with it for the types above: + // after their return, Visual C++ reported it as unreachable (C4702) + else + assert_release_constexpr(false && "unknow output shape for constant"); } void replace_arg([[maybe_unused]] const ExprID& old_arg_id, [[maybe_unused]] const std::shared_ptr& new_expr) diff --git a/src/core/operators/codac2_pow.h b/src/core/operators/codac2_pow.h index e797c2118..01c44aa0e 100644 --- a/src/core/operators/codac2_pow.h +++ b/src/core/operators/codac2_pow.h @@ -139,6 +139,6 @@ namespace codac2 { assert_release(x2.is_degenerated() && "PowOp::bwd(y,x1,x2) (with x1 and x2 intervals) not implemented yet with Gaol"); assert_release(x2 == (int)(x2.mid()) && "PowOp::bwd(y,x1,x2) (x2 not integer) not implemented yet with Gaol"); - PowOp::bwd(y, x1, x2.mid()); + PowOp::bwd(y, x1, (int)(x2.mid())); } } diff --git a/src/graphics/3rd/vibes/vibes.h b/src/graphics/3rd/vibes/vibes.h index 4c46b0f35..16fffd586 100644 --- a/src/graphics/3rd/vibes/vibes.h +++ b/src/graphics/3rd/vibes/vibes.h @@ -391,10 +391,10 @@ namespace vibes { /// The color used for transparency is throw the pen color VIBES_FUNC_COLOR_PARAM_5(drawRaster, const std::string&, rasterFilename, const double &,ulb, const double &, yub, - const double &,width, const double &, height); + const double &,width, const double &, height) VIBES_FUNC_COLOR_PARAM_6(drawRaster, const std::string&, rasterFilename, const double &,ulb, const double &, yub, - const double &,width, const double &, height, const double &, rot); + const double &,width, const double &, height, const double &, rot) /// Draw a Cake at position (cx,cy) VIBES_FUNC_COLOR_PARAM_4(drawCake,const double &,cx, const double &,cy, const double &,rot, const double &,length) diff --git a/src/graphics/figures/codac2_Figure2D.cpp b/src/graphics/figures/codac2_Figure2D.cpp index 2658e715b..1be37308e 100644 --- a/src/graphics/figures/codac2_Figure2D.cpp +++ b/src/graphics/figures/codac2_Figure2D.cpp @@ -517,7 +517,7 @@ void Figure2D::draw_tube(const SlicedTube& x, const StyleGradien { draw_tube_common(*this, x, max_nb_slices_to_display, [&style](const Interval& tube_t0tf, std::list::reverse_iterator it) { - auto c = style.cmap.color((it->mid()-tube_t0tf.lb())/tube_t0tf.diam()); + auto c = style.cmap.color(static_cast((it->mid()-tube_t0tf.lb())/tube_t0tf.diam())); return StyleProperties({c,c}, style.layer, style.line_style, "w:"+to_string(style.line_width), "z:"+to_string(style.z_value)); }); } diff --git a/src/graphics/figures/codac2_Figure3D.h b/src/graphics/figures/codac2_Figure3D.h index 442293832..8acc9de0b 100644 --- a/src/graphics/figures/codac2_Figure3D.h +++ b/src/graphics/figures/codac2_Figure3D.h @@ -206,7 +206,7 @@ namespace codac2 * \param style Style (color) */ void draw_plane(const Vector &c, const Matrix &A, bool yaw_is_up=true, - const StyleProperties& style = { Color::dark_gray(0.8) }); + const StyleProperties& style = { Color::dark_gray(0.8f) }); // Pavings @@ -228,7 +228,7 @@ namespace codac2 * \param in_style Style of the inside of the paving */ void draw_paving(const PavingInOut& p, - const StyleProperties& bound_style = { Color::yellow(0.3), "paving_bound" }, + const StyleProperties& bound_style = { Color::yellow(0.3f), "paving_bound" }, const StyleProperties& in_style = { Color::green(0.5) , "paving_in" }); /** diff --git a/src/graphics/styles/codac2_Color.cpp b/src/graphics/styles/codac2_Color.cpp index 9cbb508a3..be93f531f 100644 --- a/src/graphics/styles/codac2_Color.cpp +++ b/src/graphics/styles/codac2_Color.cpp @@ -67,9 +67,9 @@ Color Color::rgb() const float r = 0., g = 0., b = 0.; // Normalisation des valeurs - float h = (*this)[0] / 360.; // Hue normalisée (0 à 1) - float s = (*this)[1] / 100.; // Saturation normalisée (0 à 1) - float v = (*this)[2] / 100.; // Value normalisée (0 à 1) + float h = (*this)[0] / 360.f; // Hue normalisée (0 à 1) + float s = (*this)[1] / 100.f; // Saturation normalisée (0 à 1) + float v = (*this)[2] / 100.f; // Value normalisée (0 à 1) int i = static_cast(h * 6); float f = (h * 6) - i; @@ -93,7 +93,7 @@ Color Color::rgb() const g *= 255.; b *= 255.; - return Color({r, g, b,std::min(255.,((*this)[3]*2.55))},Model::RGB); + return Color({r, g, b,std::min(255.f,((*this)[3]*2.55f))},Model::RGB); } } @@ -103,9 +103,9 @@ Color Color::hsv() const return *this; else { - float r = (*this)[0]/255.; - float g = (*this)[1]/255.; - float b = (*this)[2]/255.; + float r = (*this)[0]/255.f; + float g = (*this)[1]/255.f; + float b = (*this)[2]/255.f; float c_max = std::max({r, g, b}); float c_min = std::min({r, g, b}); float delta = c_max - c_min; @@ -113,11 +113,11 @@ Color Color::hsv() const float h = 0.0; if (delta != 0) { if (c_max == r) { - h = fmod((g - b) / delta, 6.0); + h = std::fmod((g - b) / delta, 6.0f); } else if (c_max == g) { - h = (b - r) / delta + 2.0; + h = (b - r) / delta + 2.0f; } else if (c_max == b) { - h = (r - g) / delta + 4.0; + h = (r - g) / delta + 4.0f; } h /= 6.0; if (h < 0) { @@ -133,7 +133,7 @@ Color Color::hsv() const s*=100.; v*=100.; - return Color({h, s, v,std::min(100.,((*this)[3]/2.55))},Model::HSV); + return Color({h, s, v,std::min(100.f,((*this)[3]/2.55f))},Model::HSV); } } diff --git a/src/graphics/styles/codac2_ColorMap.cpp b/src/graphics/styles/codac2_ColorMap.cpp index 728264b9c..6567f6eba 100644 --- a/src/graphics/styles/codac2_ColorMap.cpp +++ b/src/graphics/styles/codac2_ColorMap.cpp @@ -24,7 +24,7 @@ Color ColorMap::color(float r) const assert(Interval(0.,1.).contains(r)); Interval map_domain = Interval(this->begin()->first,prev(this->end())->first); - float real_index = map_domain.lb() + r*map_domain.diam(); + float real_index = static_cast(map_domain.lb() + r*map_domain.diam()); if(this->find(real_index) == this->end()) // color interpolation { diff --git a/src/graphics/styles/codac2_ColorMap.h b/src/graphics/styles/codac2_ColorMap.h index 26525003d..fbf1b28b5 100644 --- a/src/graphics/styles/codac2_ColorMap.h +++ b/src/graphics/styles/codac2_ColorMap.h @@ -160,7 +160,7 @@ namespace codac2 int i = 0; for(int h = 300 ; h > 0 ; h-=10) { - cmap[i]=Color({(float)h,100.,100.,100.f*alpha},Model::HSV); + cmap[(float)i]=Color({(float)h,100.,100.,100.f*alpha},Model::HSV); i++; } return cmap;