fixes compiler warnings (#9619)

* compiler warnings: adds SYSTEM to [target_]include_directories to skip warnings originating from dependencies

* compiler warnings: uninitialized/unused variables, missing parenthesis, pragma

* compiler warnings: redundant template type, missing curly braces, pass 0 instead of NULL as int argument

* compiler warnings: removes fclose(fp) where fp==nullptr since fclose() has attribute __nonnull((1))

* compiler warnings: uninitialized variables, missing parentheses, missing curly braces

* compiler warnings: ? as lower precedence than <<

* compiler warnings: unused variable

* compiler warnings: unused result

* compiler warnings: undefined/unused variable

* compiler warnings: uninitialized variable
This commit is contained in:
Dipl.-Ing. Raoul Rubien, BSc 2025-06-14 15:05:25 +02:00 committed by GitHub
parent 9569841091
commit 3ecca6116d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 90 additions and 92 deletions

View file

@ -264,7 +264,7 @@ if(WIN32)
if(WIN10SDK_INCLUDE_PATH)
message("Building with Win10 Netfabb STL fixing service support")
add_definitions(-DHAS_WIN10SDK)
include_directories("${WIN10SDK_INCLUDE_PATH}")
include_directories(SYSTEM "${WIN10SDK_INCLUDE_PATH}")
else()
message("Building without Win10 Netfabb STL fixing service support")
endif()
@ -292,7 +292,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(Threads REQUIRED)
find_package(DBus REQUIRED)
include_directories(${DBUS_INCLUDE_DIRS})
include_directories(SYSTEM ${DBUS_INCLUDE_DIRS})
endif()
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
@ -401,11 +401,11 @@ message(STATUS "LIBDIR: ${LIBDIR}")
message(STATUS "LIBDIR_BIN: ${LIBDIR_BIN}")
# For the bundled boost libraries (boost::nowide)
include_directories(${LIBDIR})
include_directories(SYSTEM ${LIBDIR})
# For generated header files
include_directories(${LIBDIR_BIN}/platform)
include_directories(SYSTEM ${LIBDIR_BIN}/platform)
# For ligigl
include_directories(${LIBDIR}/libigl)
include_directories(SYSTEM ${LIBDIR}/libigl)
if(WIN32)
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
@ -501,7 +501,7 @@ function(slic3r_remap_configs targets from_Cfg to_Cfg)
endif()
endfunction()
target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS})
target_include_directories(boost_headeronly SYSTEM INTERFACE ${Boost_INCLUDE_DIRS})
target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES})
# Find and configure intel-tbb
@ -511,7 +511,7 @@ endif()
set(TBB_DEBUG 1)
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo Release "")
find_package(TBB REQUIRED)
# include_directories(${TBB_INCLUDE_DIRS})
# include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
# add_definitions(${TBB_DEFINITIONS})
# if(MSVC)
# # Suppress implicit linking of the TBB libraries by the Visual Studio compiler.
@ -553,7 +553,7 @@ if (SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_CURL)
find_package(OpenSSL REQUIRED)
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")
target_include_directories(libcurl INTERFACE ${OPENSSL_INCLUDE_DIR})
target_include_directories(libcurl SYSTEM INTERFACE ${OPENSSL_INCLUDE_DIR})
target_link_libraries(libcurl INTERFACE ${OPENSSL_LIBRARIES})
endif()
endif()

View file

@ -115,7 +115,6 @@ static FILE *stl_open_count_facets(stl_file *stl, const char *file, unsigned int
// do another null check to be safe
if (fp == nullptr) {
BOOST_LOG_TRIVIAL(error) << "stl_open_count_facets: Couldn't open " << file << " for reading";
fclose(fp);
return nullptr;
}
@ -228,8 +227,8 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor
// Read a single facet from an ASCII .STL file
// skip solid/endsolid
// (in this order, otherwise it won't work when they are paired in the middle of a file)
fscanf(fp, " endsolid%*[^\n]\n");
fscanf(fp, " solid%*[^\n]\n"); // name might contain spaces so %*s doesn't work and it also can be empty (just "solid")
[[maybe_unused]] auto unused_result = fscanf(fp, " endsolid%*[^\n]\n");
unused_result = fscanf(fp, " solid%*[^\n]\n"); // name might contain spaces so %*s doesn't work and it also can be empty (just "solid")
// Leading space in the fscanf format skips all leading white spaces including numerous new lines and tabs.
int res_normal = fscanf(fp, " facet normal %31s %31s %31s", normal_buf[0], normal_buf[1], normal_buf[2]);
assert(res_normal == 3);
@ -244,12 +243,12 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor
assert(res_vertex3 == 3);
// Some G-code generators tend to produce text after "endloop" and "endfacet". Just ignore it.
char buf[2048];
fgets(buf, 2047, fp);
[[maybe_unused]] auto unused_result2 = fgets(buf, 2047, fp);
bool endloop_ok = strncmp(buf, "endloop", 7) == 0 && (buf[7] == '\r' || buf[7] == '\n' || buf[7] == ' ' || buf[7] == '\t');
assert(endloop_ok);
// Skip the trailing whitespaces and empty lines.
fscanf(fp, " ");
fgets(buf, 2047, fp);
unused_result = fscanf(fp, " ");
unused_result2 = fgets(buf, 2047, fp);
bool endfacet_ok = strncmp(buf, "endfacet", 8) == 0 && (buf[8] == '\r' || buf[8] == '\n' || buf[8] == ' ' || buf[8] == '\t');
assert(endfacet_ok);
if (res_normal != 3 || res_outer_loop != 0 || res_vertex1 != 3 || res_vertex2 != 3 || res_vertex3 != 3 || ! endloop_ok || ! endfacet_ok) {

View file

@ -114,7 +114,7 @@ struct Point {
Point(const T2 x_, const T2 y_) { Init(x_, y_); }
template <typename T2>
explicit Point<T>(const Point<T2>& p) { Init(p.x, p.y); }
explicit Point(const Point<T2>& p) { Init(p.x, p.y); }
Point operator * (const double scale) const
{

View file

@ -43,7 +43,6 @@ Index of this file:
#include <locale.h>
#include <algorithm>
// System includes
#include <ctype.h> // toupper
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
#include <stddef.h> // intptr_t
#else
@ -6298,9 +6297,9 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
RenderFrameBorder(bb.Min, bb.Max, rounding);
else
#ifdef __APPLE__
window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,4.0f);; // Color button are often in need of some sort of border
window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2, 0, 4.0f); // Color button are often in need of some sort of border
#else
window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,3.0f); // Color button are often in need of some sort of border
window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2, 0, 3.0f); // Color button are often in need of some sort of border
#endif
}

View file

@ -200,7 +200,7 @@ SplittedLine do_split_line(const ClipperZUtils::ZPath& path, const ExPolygons& c
// Chain segment back to the original path
ClipperZUtils::ZPoint& front = segment.front();
const ClipperZUtils::ZPoint* previous_src_point;
const ClipperZUtils::ZPoint* previous_src_point = nullptr;
if (is_src(front)) {
// The segment starts with a point from src path, which means apart from the last point,
// all other points on this segment should come from the src path or the clip polygon

View file

@ -587,9 +587,9 @@ double getadhesionCoeff(const PrintObject* printObject)
}
double adhesionCoeff = 1;
for (const ModelVolume* modelVolume : objectVolumes) {
for (auto iter = extrudersFirstLayer.begin(); iter != extrudersFirstLayer.end(); iter++)
for (auto iter = extrudersFirstLayer.begin(); iter != extrudersFirstLayer.end(); iter++) {
if (modelVolume->extruder_id() == *iter) {
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end())
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) {
if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" ||
Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") {
adhesionCoeff = 2;
@ -597,11 +597,13 @@ double getadhesionCoeff(const PrintObject* printObject)
else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU") {
adhesionCoeff = 0.5;
}
}
}
}
}
return adhesionCoeff;
/*
/*
def->enum_values.push_back("PLA");
def->enum_values.push_back("PET");
def->enum_values.push_back("ABS");
@ -1653,7 +1655,7 @@ ExtrusionEntityCollection makeBrimInfill(const ExPolygons& singleBrimArea, const
Polylines loops_pl = to_polylines(loops);
loops_pl_by_levels.assign(loops_pl.size(), Polylines());
tbb::parallel_for(tbb::blocked_range<size_t>(0, loops_pl.size()),
[&loops_pl_by_levels, &loops_pl, &islands_area](const tbb::blocked_range<size_t>& range) {
[&loops_pl_by_levels, &loops_pl /*, &islands_area*/](const tbb::blocked_range<size_t>& range) {
for (size_t i = range.begin(); i < range.end(); ++i) {
loops_pl_by_levels[i] = chain_polylines({ std::move(loops_pl[i]) });
//loops_pl_by_levels[i] = chain_polylines(intersection_pl({ std::move(loops_pl[i]) }, islands_area));

View file

@ -513,7 +513,7 @@ encoding_check(libslic3r)
target_compile_definitions(libslic3r PUBLIC -DUSE_TBB -DTBB_USE_CAPTURED_EXCEPTION=0)
target_include_directories(libslic3r PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(libslic3r PUBLIC ${EXPAT_INCLUDE_DIRS})
target_include_directories(libslic3r SYSTEM PUBLIC ${EXPAT_INCLUDE_DIRS})
# Find the OCCT and related libraries
set(OpenCASCADE_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/occt")

View file

@ -94,10 +94,10 @@ template<typename PointType> inline void clip_clipper_polygon_with_subject_bbox_
}
// Never produce just a single point output polygon.
if (!out.empty())
if(get_entire_polygons){
if (!out.empty()) {
if (get_entire_polygons) {
out=src;
}else{
} else {
if (int sides_next = sides(out.front());
// The last point is inside. Take it.
sides_this == 0 ||
@ -106,7 +106,7 @@ template<typename PointType> inline void clip_clipper_polygon_with_subject_bbox_
(sides_prev & sides_this & sides_next) == 0)
out.emplace_back(src.back());
}
}
}
void clip_clipper_polygon_with_subject_bbox(const Points &src, const BoundingBox &bbox, Points &out, const bool get_entire_polygons) { clip_clipper_polygon_with_subject_bbox_templ(src, bbox, out, get_entire_polygons); }

View file

@ -257,7 +257,7 @@ ColorRGBA complementary(const ColorRGBA& color)
ColorRGB saturate(const ColorRGB& color, float factor)
{
float h, s, v;
float h = 0.0, s = 0.0, v = 0.0;
RGBtoHSV(color.r(), color.g(), color.b(), h, s, v);
s = std::clamp(s * factor, 0.0f, 1.0f);
float r, g, b;
@ -272,7 +272,7 @@ ColorRGBA saturate(const ColorRGBA& color, float factor)
ColorRGB opposite(const ColorRGB& color)
{
float h, s, v;
float h = 0.0, s = 0.0, v = 0.0;
RGBtoHSV(color.r(), color.g(), color.b(), h, s, v);
h += 65.0f; // 65 instead 60 to avoid circle values

View file

@ -61,8 +61,8 @@ void FillConcentric::_fill_surface_single(
size_t iPathFirst = polylines_out.size();
Point last_pos(0, 0);
double min_nozzle_diameter;
bool dir;
double min_nozzle_diameter = 0.0;
bool dir = false;
if (this->print_config != nullptr && params.density >= STAGGER_SEAM_THRESHOLD) {
min_nozzle_diameter = *std::min_element(print_config->nozzle_diameter.values.begin(), print_config->nozzle_diameter.values.end());
dir = rand() % 2;

View file

@ -421,11 +421,12 @@ void FanMover::_process_gcode_line(GCodeReader& reader, const GCodeReader::GCode
current_role = ExtrusionEntity::string_to_role(extrusion_string);
}
if (line.raw().size() > 16) {
if (line.raw().rfind("; custom gcode", 0) != std::string::npos)
if (line.raw().rfind("; custom gcode", 0) != std::string::npos) {
if (line.raw().rfind("; custom gcode end", 0) != std::string::npos)
m_is_custom_gcode = false;
else
m_is_custom_gcode = true;
}
}
}
}

View file

@ -3200,7 +3200,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes)
{
double adhesionCoeff = 1;
for (const ModelVolume* modelVolume : objectVolumes) {
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end())
if (Model::extruderParamsMap.find(modelVolume->extruder_id()) != Model::extruderParamsMap.end()) {
if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PETG" ||
Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "PCTG") {
adhesionCoeff = 2;
@ -3208,6 +3208,7 @@ double getadhesionCoeff(const ModelVolumePtrs objectVolumes)
else if (Model::extruderParamsMap.at(modelVolume->extruder_id()).materialName == "TPU") {
adhesionCoeff = 0.5;
}
}
}
return adhesionCoeff;
}

View file

@ -2474,7 +2474,7 @@ void cut_mesh(const indexed_triangle_set& mesh, float z, indexed_triangle_set* u
// intersect v0-v1 and v2-v0 with cutting plane and make new vertices
auto new_vertex = [upper, lower, &upper_slice_vertices, &lower_slice_vertices](const Vec3f &a, const int ia, const Vec3f &b, const int ib, const Vec3f &c,
const int ic, const Vec3f &new_pt, bool &is_new_vertex) {
int iupper, ilower;
int iupper = 0, ilower = 0;
is_new_vertex = false;
if (is_equal(new_pt, a))
iupper = ilower = ia;

View file

@ -2770,7 +2770,7 @@ REAL permanent;
REAL cxtaa[8], cxtbb[8], cytaa[8], cytbb[8];
int cxtaalen, cxtbblen, cytaalen, cytbblen;
REAL axtbc[8], aytbc[8], bxtca[8], bytca[8], cxtab[8], cytab[8];
int axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen;
int axtbclen = 0, aytbclen = 0, bxtcalen = 0, bytcalen = 0, cxtablen = 0, cytablen = 0;
REAL axtbct[16], aytbct[16], bxtcat[16], bytcat[16], cxtabt[16], cytabt[16];
int axtbctlen, aytbctlen, bxtcatlen, bytcatlen, cxtabtlen, cytabtlen;
REAL axtbctt[8], aytbctt[8], bxtcatt[8];
@ -8679,4 +8679,4 @@ REAL* pe;
}
#endif
#endif
#endif

View file

@ -1661,8 +1661,8 @@ static int nsvg__parseRotate(float* xform, const char* str)
static void nsvg__parseTransform(float* xform, const char* str)
{
float t[6];
int len;
float t[6] = {0.0};
int len;
nsvg__xformIdentity(xform);
while (*str)
{

View file

@ -145,7 +145,7 @@ endif(UNIX)
##################################################
# LIBDIR is defined in the main xs CMake file:
target_include_directories(${qhull_STATIC} BEFORE PUBLIC ${LIBDIR}/qhull/src)
target_include_directories(${qhull_STATIC} SYSTEM BEFORE PUBLIC ${LIBDIR}/qhull/src)
target_link_libraries(qhull INTERFACE ${qhull_STATIC})
endif()

View file

@ -623,7 +623,7 @@ add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES})
target_include_directories(libslic3r_gui PRIVATE Utils)
if (WIN32)
target_include_directories(libslic3r_gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../deps/WebView2/include)
target_include_directories(libslic3r_gui SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../deps/WebView2/include)
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SLIC3R_GUI_SOURCES})

View file

@ -320,7 +320,7 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent)
std::string decimal_point;
std::string expression = "^[-+]?[0-9]+([,.][0-9]+)?$";
std::regex decimalRegex(expression);
int decimal_number;
int decimal_number = 0;
if (std::regex_match(number, decimalRegex)) {
std::smatch match;
if (std::regex_search(number, match, decimalRegex)) {

View file

@ -160,7 +160,7 @@ void ConnectPrinterDialog::on_button_confirm(wxCommandEvent &event)
{
wxString code = m_textCtrl_code->GetTextCtrl()->GetValue();
for (char c : code) {
if (!('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z')) {
if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) {
show_error(this, _L("Invalid input."));
return;
}
@ -187,4 +187,4 @@ void ConnectPrinterDialog::on_dpi_changed(const wxRect &suggested_rect)
Layout();
this->Refresh();
}
}} // namespace Slic3r::GUI
}} // namespace Slic3r::GUI

View file

@ -778,7 +778,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
m_filament_custom_vendor_input->SetSize(NAME_OPTION_COMBOBOX_SIZE);
textInputSizer->Add(m_filament_custom_vendor_input, 0, wxEXPAND | wxALL, 0);
m_filament_custom_vendor_input->GetTextCtrl()->SetHint(_L("Input Custom Vendor"));
m_filament_custom_vendor_input->GetTextCtrl()->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
m_filament_custom_vendor_input->GetTextCtrl()->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
int key = event.GetKeyCode();
if (cannot_input_key.find(key) != cannot_input_key.end()) {
event.Skip(false);
@ -888,7 +888,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_serial_item()
m_filament_serial_input = new TextInput(this, "", "", "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE, wxTE_PROCESS_ENTER);
m_filament_serial_input->GetTextCtrl()->SetMaxLength(50);
comboBoxSizer->Add(m_filament_serial_input, 0, wxEXPAND | wxALL, 0);
m_filament_serial_input->GetTextCtrl()->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
m_filament_serial_input->GetTextCtrl()->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
int key = event.GetKeyCode();
if (cannot_input_key.find(key) != cannot_input_key.end()) {
event.Skip(false);
@ -1750,7 +1750,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
m_custom_vendor_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE);
m_custom_vendor_text_ctrl->SetHint(_L("Input Custom Vendor"));
m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
int key = event.GetKeyCode();
if (cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed
event.Skip(false);
@ -1762,7 +1762,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
m_custom_vendor_text_ctrl->Hide();
m_custom_model_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE);
m_custom_model_text_ctrl->SetHint(_L("Input Custom Model"));
m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [](wxKeyEvent &event) {
int key = event.GetKeyCode();
if (cannot_input_key.find(key) != cannot_input_key.end()) { // "@" can not be inputed
event.Skip(false);
@ -3242,8 +3242,8 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
horizontal_sizer->Add(success_bitmap_sizer, 0, wxEXPAND | wxALL, FromDIP(5));
wxBoxSizer *success_text_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *success_text;
wxStaticText *next_step_text;
wxStaticText *success_text = nullptr;
wxStaticText *next_step_text = nullptr;
bool sync_user_preset_need_enabled = wxGetApp().getAgent() && wxGetApp().app_config->get("sync_user_preset") == "false";
switch (create_success_type) {
case PRINTER:

View file

@ -15,16 +15,13 @@
#include "format.hpp"
#include "Tab.hpp"
#include "wxExtensions.hpp"
#include "BitmapCache.hpp"
#include "ExtraRenderers.hpp"
#include "MsgDialog.hpp"
#include "Plater.hpp"
#include "Widgets/DialogButtons.hpp"
#include "libslic3r/PlaceholderParser.hpp"
#include "libslic3r/Preset.hpp"
#include "libslic3r/Print.hpp"
#define BTN_GAP FromDIP(20)
#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24))
@ -61,7 +58,7 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const
m_search_bar->SetForegroundColour(*wxBLACK);
wxGetApp().UpdateDarkUI(m_search_bar);
m_search_bar->Bind(wxEVT_SET_FOCUS, [this](wxFocusEvent&) {
m_search_bar->Bind(wxEVT_SET_FOCUS, [](wxFocusEvent&) {
// this->on_search_update();
});
m_search_bar->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) {
@ -256,9 +253,9 @@ wxDataViewItem EditGCodeDialog::add_presets_placeholders()
const auto& full_config = wxGetApp().preset_bundle->full_config();
const auto& tab_list = wxGetApp().tabs_list;
Tab* tab_print;
Tab* tab_filament;
Tab* tab_printer;
Tab* tab_print = nullptr;
Tab* tab_filament = nullptr;
Tab* tab_printer = nullptr;
for (const auto tab : tab_list) {
if (tab->m_type == Preset::TYPE_PRINT)
tab_print = tab;

View file

@ -3511,7 +3511,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
m_dirty = true;
#endif
} else if ((evt.ShiftDown() && evt.ControlDown() && keyCode == WXK_RETURN) ||
evt.ShiftDown() && evt.AltDown() && keyCode == WXK_RETURN) {
(evt.ShiftDown() && evt.AltDown() && keyCode == WXK_RETURN)) {
wxGetApp().plater()->toggle_show_wireframe();
m_dirty = true;
}
@ -6640,8 +6640,8 @@ bool GLCanvas3D::_init_assemble_view_toolbar()
item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLVIEWTOOLBAR_ASSEMBLE)); };
item.left.render_callback = GLToolbarItem::Default_Render_Callback;
item.visible = true;
item.visibility_callback = [this]()->bool { return true; };
item.enabling_callback = [this]()->bool {
item.visibility_callback = []()->bool { return true; };
item.enabling_callback = []()->bool {
return wxGetApp().plater()->has_assmeble_view();
};
if (!m_assemble_view_toolbar.add_item(item))
@ -6690,7 +6690,7 @@ bool GLCanvas3D::_init_separator_toolbar()
sperate_item.name = "start_seperator";
sperate_item.icon_filename = "seperator.svg";
sperate_item.sprite_id = 0;
sperate_item.left.action_callback = [this]() {};
sperate_item.left.action_callback = []() {};
sperate_item.visibility_callback = []()->bool { return true; };
sperate_item.enabling_callback = []()->bool { return false; };
if (!m_separator_toolbar.add_item(sperate_item))
@ -7407,7 +7407,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
}*/
const Camera& camera = wxGetApp().plater()->get_camera();
//BBS:add assemble view related logic
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [this, canvas_type](const GLVolume& volume) {
m_volumes.render(type, false, camera.get_view_matrix(), camera.get_projection_matrix(), cvn_size, [canvas_type](const GLVolume& volume) {
if (canvas_type == ECanvasType::CanvasAssembleView) {
return !volume.is_modifier;
}
@ -7783,7 +7783,7 @@ void GLCanvas3D::_render_gizmos_overlay()
// m_gizmos.set_overlay_scale(wxGetApp().em_unit()*0.1f);
const float size = int(GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale());
m_gizmos.set_overlay_icon_size(size); //! #ys_FIXME_experiment
#endif /* __WXMSW__ */
#endif */ /* __WXMSW__ */
m_gizmos.render_overlay();
if (m_gizmo_highlighter.m_render_arrow)
@ -8474,7 +8474,7 @@ float GLCanvas3D::_show_assembly_tooltip_information(float caption_max, float x,
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip2(ImVec2(x, y));
auto draw_text_with_caption = [this, &imgui, & caption_max](const wxString &caption, const wxString &text) {
auto draw_text_with_caption = [&imgui, & caption_max](const wxString &caption, const wxString &text) {
imgui->text_colored(ImGuiWrapper::COL_ACTIVE, caption);
ImGui::SameLine(caption_max);
imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);

View file

@ -1975,7 +1975,7 @@ void GUI_App::init_app_config()
}
// Change current dirtory of application
chdir(encode_path((Slic3r::data_dir() + "/log").c_str()).c_str());
[[maybe_unused]] auto unused_result = chdir(encode_path((Slic3r::data_dir() + "/log").c_str()).c_str());
} else {
m_datadir_redefined = true;
}

View file

@ -204,8 +204,8 @@ bool GLGizmoBrimEars::unproject_on_mesh2(const Vec2d &mouse_pos, std::pair<Vec3f
double clp_dist = m_c->object_clipper()->get_position();
const ClippingPlane *clp = m_c->object_clipper()->get_clipping_plane();
bool mouse_on_object = false;
Vec3f position_on_model;
Vec3f normal_on_model;
Vec3f position_on_model {};
Vec3f normal_on_model {};
double closest_hit_distance = std::numeric_limits<double>::max();
for (auto item : m_mesh_raycaster_map) {

View file

@ -1817,7 +1817,7 @@ void GLGizmoMeasure::show_selection_ui()
return text;
};
float selection_cap_length;
float selection_cap_length = 0;
if (m_measure_mode == EMeasureMode::ONLY_ASSEMBLY) {
if (m_assembly_mode == AssemblyMode::FACE_FACE) {
selection_cap_length = ImGui::CalcTextSize((_u8L("Selection") + " 1" + _u8L(" (Moving)")).c_str()).x * 1.2;

View file

@ -395,7 +395,7 @@ void MediaFilePanel::SetSelecting(bool selecting)
m_image_grid->SetSelecting(selecting);
m_button_management->SetLabel(selecting ? _L("Cancel") : _L("Select"));
auto fs = m_image_grid->GetFileSystem();
bool download_support = fs && fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support;
bool download_support = (fs && fs->GetFileType() < PrinterFileSystem::F_MODEL) || m_model_download_support;
m_manage_panel->GetSizer()->Show(m_button_download, selecting && download_support);
m_manage_panel->GetSizer()->Show(m_button_delete, selecting);
m_manage_panel->GetSizer()->Show(m_button_refresh, !selecting);

View file

@ -640,7 +640,7 @@ void ObjColorPanel::draw_table()
m_color_cluster_icon_list.clear();
m_extruder_icon_list.clear();
float row_height ;
float row_height = 0;
for (size_t ii = 0; ii < row; ii++) {
wxPanel *row_panel = new wxPanel(m_scrolledWindow);
row_panel->SetBackgroundColour(ii % 2 == 0 ? *wxWHITE : wxColour(238, 238, 238));

View file

@ -576,7 +576,7 @@ void PartPlate::calc_vertex_for_plate_name_edit_icon(GLTexture *texture, int ind
float height = icon_sz;
float offset_y = factor * PARTPLATE_TEXT_OFFSET_Y;
float name_width;
float name_width = 0.0;
if (texture && texture->get_width() > 0 && texture->get_height())
// original width give correct ratio in here since rendering width can be much higher because of next_highest_power_of_2 for rendering
name_width = icon_sz * texture->m_original_width / texture->get_height();

View file

@ -55,8 +55,8 @@ LayerNumberTextInput::LayerNumberTextInput(wxWindow* parent, int layer_number, w
// value should not be less than MIN_LAYER_VALUE, and should not be greater than MAX_LAYER_VALUE
gui_value = std::clamp(gui_value, MIN_LAYER_VALUE, MAX_LAYER_VALUE);
int begin_value;
int end_value;
int begin_value = 0;
int end_value = 0;
LayerNumberTextInput* end_layer_input = nullptr;
if (this->m_type == Type::Begin) {
begin_value = gui_value;
@ -688,4 +688,4 @@ void PlateNameEditDialog::set_plate_name(const wxString &name) {
}
} // namespace Slic3r::GUI
} // namespace Slic3r::GUI

View file

@ -3668,7 +3668,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
bool dlg_cont = true;
bool is_user_cancel = false;
bool translate_old = false;
int current_width, current_depth, current_height;
int current_width = 0, current_depth = 0, current_height = 0;
if (input_files.empty()) { return std::vector<size_t>(); }
@ -9081,7 +9081,7 @@ void Plater::load_project(wxString const& filename2,
// if res is empty no data has been loaded
if (!res.empty() && (load_restore || !(strategy & LoadStrategy::Silence))) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << load_restore ? originfile : filename;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " call set_project_filename: " << (load_restore ? originfile : filename);
p->set_project_filename(load_restore ? originfile : filename);
if (load_restore && originfile.IsEmpty()) {
p->set_project_name(_L("Untitled"));

View file

@ -2091,7 +2091,7 @@ void InputIpAddressDialog::on_text(wxCommandEvent &evt)
bool invalid_access_code = true;
for (char c : str_access_code) {
if (!('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z')) {
if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) {
invalid_access_code = false;
return;
}

View file

@ -2285,7 +2285,7 @@ bool SelectMachineDialog::is_same_nozzle_diameters(std::string& tag_nozzle_type,
{
bool is_same_nozzle_diameters = true;
float preset_nozzle_diameters;
float preset_nozzle_diameters = 0.0;
std::string preset_nozzle_type;
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();

View file

@ -2523,7 +2523,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
}
bool light_on = obj->chamber_light != MachineObject::LIGHT_EFFECT::LIGHT_EFFECT_OFF;
BOOST_LOG_TRIVIAL(trace) << "light: " << light_on ? "on" : "off";
BOOST_LOG_TRIVIAL(trace) << "light: " << (light_on ? "on" : "off");
if (m_switch_lamp_timeout > 0)
m_switch_lamp_timeout--;
else {

View file

@ -1,4 +1,3 @@
#pragma once
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
@ -311,4 +310,4 @@ void MyScrollbar::OnMouseWheel(wxMouseEvent &event)
}
Refresh();
Update();
}
}

View file

@ -234,7 +234,7 @@ void StateColor::append(unsigned long color, int states)
{
if ((color & 0xff000000) == 0)
color |= 0xff000000;
wxColour cl; cl.SetRGBA(color & 0xff00ff00 | ((color & 0xff) << 16) | ((color >> 16) & 0xff));
wxColour cl; cl.SetRGBA((color & 0xff00ff00) | ((color & 0xff) << 16) | ((color >> 16) & 0xff));
append(cl, states);
}

View file

@ -51,7 +51,7 @@ void StateHandler::update_binds()
int diff = bind_states ^ bind_states_;
State states[] = {Enabled, Checked, Focused, Hovered, Pressed};
wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN};
wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
for (int i = 0; i < 5; ++i) {
int s = states[i];
if (diff & s) {
@ -74,7 +74,7 @@ void StateHandler::set_state(int state, int mask)
{
if ((states_ & mask) == (state & mask)) return;
int old = states_;
states_ = states_ & ~mask | state & mask;
states_ = (states_ & ~mask) | (state & mask);
if (old != states_ && (old | states2_) != (states_ | states2_)) {
if (parent_)
parent_->changed(states_ | states2_);
@ -94,7 +94,7 @@ void StateHandler::changed(wxEvent &event)
{
event.Skip();
wxEventType events[] = {EVT_ENABLE_CHANGED, wxEVT_CHECKBOX, wxEVT_SET_FOCUS, wxEVT_ENTER_WINDOW, wxEVT_LEFT_DOWN};
wxEventType events2[] = {{0}, {0}, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
wxEventType events2[] = {0, 0, wxEVT_KILL_FOCUS, wxEVT_LEAVE_WINDOW, wxEVT_LEFT_UP};
int old = states_;
// some events are from another window (ex: text_ctrl of TextInput), save state in states2_ to avoid conflicts
for (int i = 0; i < 5; ++i) {

View file

@ -348,7 +348,7 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat
Layout();
Fit();
auto validate_text = [this](TextInput* ti){
auto validate_text = [](TextInput* ti){
unsigned long t = 0;
if(!ti->GetTextCtrl()->GetValue().ToULong(&t))
return;
@ -395,7 +395,7 @@ void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) {
}
m_params.start = start;
m_params.end = end;
m_params.mode =CalibMode::Calib_Temp_Tower;
m_params.mode = CalibMode::Calib_Temp_Tower;
m_plater->calib_temp(m_params);
EndModal(wxID_OK);
@ -403,7 +403,7 @@ void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) {
void Temp_Calibration_Dlg::on_filament_type_changed(wxCommandEvent& event) {
int selection = event.GetSelection();
unsigned long start,end;
unsigned long start = 0, end = 0;
switch(selection)
{
case tABS_ASA:
@ -1112,4 +1112,4 @@ void Junction_Deviation_Test_Dlg::on_dpi_changed(const wxRect& suggested_rect) {
Fit();
}
}} // namespace Slic3r::GUI
}} // namespace Slic3r::GUI

View file

@ -1181,7 +1181,7 @@ std::string NetworkAgent::request_setting_id(std::string name, std::map<std::str
int NetworkAgent::put_setting(std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code)
{
int ret;
int ret = 0;
if (network_agent && put_setting_ptr) {
ret = put_setting_ptr(network_agent, setting_id, name, values_map, http_code);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, setting_id=%2%, name=%3%, http_code=%4%, ret=%5%")
@ -1341,7 +1341,7 @@ int NetworkAgent::get_subtask_info(std::string subtask_id, std::string* task_jso
int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json)
{
int ret;
int ret = 0;
if (network_agent && get_slice_info_ptr) {
ret = get_slice_info_ptr(network_agent, project_id, profile_id, plate_index, slice_json);
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" : network_agent=%1%, project_id=%2%, profile_id=%3%, plate_index=%4%, slice_json=%5%")
@ -1352,7 +1352,7 @@ int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id,
int NetworkAgent::query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body)
{
int ret;
int ret = 0;
if (network_agent && query_bind_status_ptr) {
ret = query_bind_status_ptr(network_agent, query_list, http_code, http_body);
if (ret)