Fixed few warnings

This commit is contained in:
Lukas Matena 2020-04-22 12:49:52 +02:00
parent 3e855d36dc
commit 32a353058f
11 changed files with 44 additions and 58 deletions

View file

@ -300,13 +300,13 @@ void AppConfig::set_mouse_device(const std::string& name, double translation_spe
std::vector<std::string> AppConfig::get_mouse_device_names() const
{
static constexpr char *prefix = "mouse_device:";
static constexpr size_t prefix_len = 13; // strlen(prefix); reports error C2131: expression did not evaluate to a constant on VS2019
std::vector<std::string> out;
static constexpr const char *prefix = "mouse_device:";
static const size_t prefix_len = strlen(prefix);
std::vector<std::string> out;
for (const std::pair<std::string, std::map<std::string, std::string>>& key_value_pair : m_storage)
if (boost::starts_with(key_value_pair.first, "mouse_device:") && key_value_pair.first.size() > prefix_len)
if (boost::starts_with(key_value_pair.first, prefix) && key_value_pair.first.size() > prefix_len)
out.emplace_back(key_value_pair.first.substr(prefix_len));
return out;
return out;
}
void AppConfig::update_config_dir(const std::string &dir)

View file

@ -425,9 +425,6 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double
if ((dx <= 0.0) || (dy <= 0.0))
return -1.0f;
double med_x = 0.5 * (max_x + min_x);
double med_y = 0.5 * (max_y + min_y);
dx *= margin_factor;
dy *= margin_factor;

View file

@ -22,7 +22,7 @@ namespace DoubleSlider {
/* For exporting GCode in GCodeWriter is used XYZF_NUM(val) = PRECISION(val, 3) for XYZ values.
* So, let use same value as a permissible error for layer height.
*/
static double epsilon() { return 0.0011;}
constexpr double epsilon() { return 0.0011; }
// custom message the slider sends to its parent to notify a tick-change:
wxDECLARE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);

View file

@ -26,7 +26,6 @@ std::string GLGizmoScale3D::get_tooltip() const
bool single_instance = selection.is_single_full_instance();
bool single_volume = selection.is_single_modifier() || selection.is_single_volume();
bool single_selection = single_instance || single_volume;
Vec3f scale = 100.0f * Vec3f::Ones();
if (single_instance)

View file

@ -25,15 +25,6 @@
#include <wx/choicebk.h>
#endif // BOOK_TYPE
#if ENABLE_SCROLLABLE
static wxSize get_screen_size(wxWindow* window)
{
const auto idx = wxDisplay::GetFromWindow(window);
wxDisplay display(idx != wxNOT_FOUND ? idx : 0u);
return display.GetClientArea().GetSize();
}
#endif // ENABLE_SCROLLABLE
namespace Slic3r {
namespace GUI {

View file

@ -962,7 +962,7 @@ void PresetCollection::load_bitmap_add(const std::string &file_name)
const Preset* PresetCollection::get_selected_preset_parent() const
{
if (this->get_selected_idx() == -1)
if (this->get_selected_idx() == size_t(-1))
// This preset collection has no preset activated yet. Only the get_edited_preset() is valid.
return nullptr;

View file

@ -296,9 +296,8 @@ std::string PresetHints::top_bottom_shell_thickness_explanation(const PresetBund
double bottom_solid_min_thickness = print_config.opt_float("bottom_solid_min_thickness");
double layer_height = print_config.opt_float("layer_height");
bool variable_layer_height = printer_config.opt_bool("variable_layer_height");
//FIXME the following lines take into account the 1st extruder only.
//FIXME the following line takes into account the 1st extruder only.
double min_layer_height = variable_layer_height ? Slicing::min_layer_height_from_nozzle(printer_config, 1) : layer_height;
double max_layer_height = variable_layer_height ? Slicing::max_layer_height_from_nozzle(printer_config, 1) : layer_height;
if (layer_height <= 0.f) {
out += _utf8(L("Top / bottom shell thickness hint: Not available due to invalid layer height."));

View file

@ -3297,28 +3297,28 @@ void Tab::save_preset(std::string name /*= ""*/, bool detach)
wxGetApp().plater()->force_filament_colors_update();
{
// Profile compatiblity is updated first when the profile is saved.
// Update profile selection combo boxes at the depending tabs to reflect modifications in profile compatibility.
std::vector<Preset::Type> dependent;
switch (m_type) {
case Preset::TYPE_PRINT:
dependent = { Preset::TYPE_FILAMENT };
break;
case Preset::TYPE_SLA_PRINT:
dependent = { Preset::TYPE_SLA_MATERIAL };
break;
case Preset::TYPE_PRINTER:
// Profile compatiblity is updated first when the profile is saved.
// Update profile selection combo boxes at the depending tabs to reflect modifications in profile compatibility.
std::vector<Preset::Type> dependent;
switch (m_type) {
case Preset::TYPE_PRINT:
dependent = { Preset::TYPE_FILAMENT };
break;
case Preset::TYPE_SLA_PRINT:
dependent = { Preset::TYPE_SLA_MATERIAL };
break;
case Preset::TYPE_PRINTER:
if (static_cast<const TabPrinter*>(this)->m_printer_technology == ptFFF)
dependent = { Preset::TYPE_PRINT, Preset::TYPE_FILAMENT };
else
dependent = { Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL };
break;
break;
default:
break;
}
for (Preset::Type preset_type : dependent)
wxGetApp().get_tab(preset_type)->update_tab_ui();
}
break;
}
for (Preset::Type preset_type : dependent)
wxGetApp().get_tab(preset_type)->update_tab_ui();
}
}
// Called for a currently selected preset.

View file

@ -120,7 +120,7 @@ namespace fts {
char *end = Slic3r::fold_to_ascii(*str, tmp);
char *c = tmp;
for (const wchar_t* d = pattern; c != end && *d != 0 && wchar_t(std::tolower(*c)) == std::tolower(*d); ++c, ++d);
if (c == end) {
if (c == end) {
folded_match = true;
num_matched = end - tmp;
}