Fixes 2 Bugs and 13 Compiler Warnings (#10670)

* fixes: %g directive writing between 1 and 13 bytes into a region of size between 6 and 18 [-Wformat-overflow=]

* fixes: %5s directive writing between 5 and 63 bytes into a region of size 58 [-Wformat-overflow=]

* fixes: catching polymorphic type by value [-Wcatch-value=]

* fixes: [-Wcomment]; removes whitespaces

* increases buffer size from 71B to 90B to avoid potential ovfl.
This commit is contained in:
Dipl.-Ing. Raoul Rubien, BSc
2026-08-05 21:41:04 +08:00
committed by GitHub
parent a10d9e77cf
commit 23bd320076
12 changed files with 30 additions and 31 deletions
+1 -1
View File
@@ -7054,7 +7054,7 @@ int CLI::run(int argc, char **argv)
gcode_viewer.render_calibration_thumbnail(*calibration_data, cali_thumbnail_width, cali_thumbnail_height, gcode_viewer.render_calibration_thumbnail(*calibration_data, cali_thumbnail_width, cali_thumbnail_height,
calibration_params, partplate_list, opengl_mgr); calibration_params, partplate_list, opengl_mgr);
//generate_calibration_thumbnail(*calibration_data, thumbnail_width, thumbnail_height, calibration_params); //generate_calibration_thumbnail(*calibration_data, thumbnail_width, thumbnail_height, calibration_params);
//*plate_bboxes[index] = p->generate_first_layer_bbox(); // *plate_bboxes[index] = p->generate_first_layer_bbox();
calibration_thumbnails.push_back(calibration_data);*/ calibration_thumbnails.push_back(calibration_data);*/
PlateBBoxData* plate_bbox = new PlateBBoxData(); PlateBBoxData* plate_bbox = new PlateBBoxData();
+1 -1
View File
@@ -883,7 +883,7 @@ std::string AppConfig::load()
} }
} }
} }
} catch(std::exception err) { } catch(const std::exception &err) {
BOOST_LOG_TRIVIAL(info) << format("parse app config \"%1%\", error: %2%", AppConfig::loading_path(), err.what()); BOOST_LOG_TRIVIAL(info) << format("parse app config \"%1%\", error: %2%", AppConfig::loading_path(), err.what());
return err.what(); return err.what();
+1 -1
View File
@@ -3576,7 +3576,7 @@ Polylines FillLateralHoneycomb::fill_surface(const Surface *surface, const FillP
// | // |
// | // |
// 0 --+-- // 0 --+--
// / \ // ⟋ ⟍
// why inverted? // why inverted?
// it makes determining some of the properties easier // it makes determining some of the properties easier
// and the two angled legs provide additional horizontal stiffness // and the two angled legs provide additional horizontal stiffness
+1 -1
View File
@@ -712,7 +712,7 @@ unsigned int Step::get_triangle_num(double linear_deflection, double angle_defle
return 0; return 0;
} }
} }
} catch(Exception e) { } catch(const Exception &e) {
return 0; return 0;
} }
+1 -1
View File
@@ -5511,7 +5511,7 @@ LayerResult GCode::process_layer(
// add tag for processor // add tag for processor
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Layer_Change) + "\n"; gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Layer_Change) + "\n";
// export layer z // export layer z
char buf[64]; char buf[80];
sprintf(buf, print.is_BBL_printer() ? "; Z_HEIGHT: %g\n" : ";Z:%g\n", print_z); sprintf(buf, print.is_BBL_printer() ? "; Z_HEIGHT: %g\n" : ";Z:%g\n", print_z);
gcode += buf; gcode += buf;
// export layer height // export layer height
@@ -1,9 +1,9 @@
//**********************************************************/ /**********************************************************
/* File: uiAmsHumidityPopup.cpp * File: uiAmsHumidityPopup.cpp
* Description: The popup with DevAms Humidity * Description: The popup with DevAms Humidity
* *
* \n class uiAmsHumidityPopup * \n class uiAmsHumidityPopup
//**********************************************************/ **********************************************************/
#include "uiAmsHumidityPopup.h" #include "uiAmsHumidityPopup.h"
@@ -1,9 +1,9 @@
//**********************************************************/ /**********************************************************
/* File: uiAmsHumidityPopup.h * File: uiAmsHumidityPopup.h
* Description: The popup with DevAms Humidity * Description: The popup with DevAms Humidity
* *
* \n class uiAmsHumidityPopup * \n class uiAmsHumidityPopup
//**********************************************************/ **********************************************************/
#pragma once #pragma once
#include "slic3r/GUI/Widgets/AMSItem.hpp" #include "slic3r/GUI/Widgets/AMSItem.hpp"
@@ -1,9 +1,9 @@
//**********************************************************/ /**********************************************************
/* File: uiDeviceUpdateVersion.cpp * File: uiDeviceUpdateVersion.cpp
* Description: The panel with firmware info * Description: The panel with firmware info
* *
* \n class uiDeviceUpdateVersion * \n class uiDeviceUpdateVersion
//**********************************************************/ **********************************************************/
#include "uiDeviceUpdateVersion.h" #include "uiDeviceUpdateVersion.h"
@@ -1,9 +1,9 @@
//**********************************************************/ /**********************************************************
/* File: uiDeviceUpdateVersion.h * File: uiDeviceUpdateVersion.h
* Description: The panel with firmware info * Description: The panel with firmware info
* *
* \n class uiDeviceUpdateVersion * \n class uiDeviceUpdateVersion
//**********************************************************/ **********************************************************/
#pragma once #pragma once
#include <wx/panel.h> #include <wx/panel.h>
+1 -1
View File
@@ -3213,7 +3213,7 @@ void ObjectList::merge(bool to_multipart_object)
//changed_object(obj_idx); //changed_object(obj_idx);
//remove(); //remove();
} }
/* wxGetApp().plater()->load_model_objects(objects); // wxGetApp().plater()->load_model_objects(objects);
Selection& selection = p->view3D->get_canvas3d()->get_selection(); Selection& selection = p->view3D->get_canvas3d()->get_selection();
size_t last_obj_idx = p->model.objects.size() - 1; size_t last_obj_idx = p->model.objects.size() - 1;
+1 -1
View File
@@ -1733,7 +1733,7 @@ std::string IMSlider::get_label(int tick, LabelType label_type)
::sprintf(layer_height, "%.2f", m_values.empty() ? m_label_koef * value : m_values[value]); ::sprintf(layer_height, "%.2f", m_values.empty() ? m_label_koef * value : m_values[value]);
if (label_type == ltHeight) return std::string(layer_height); if (label_type == ltHeight) return std::string(layer_height);
if (label_type == ltHeightWithLayer) { if (label_type == ltHeightWithLayer) {
char buffer[64]; char buffer[90];
size_t layer_number; size_t layer_number;
layer_number = m_draw_mode == dmSequentialFffPrint ? (m_values.empty() ? value : value + 1) : m_is_wipe_tower ? get_layer_number(value, label_type) + 1 : (m_values.empty() ? value : value + 1); layer_number = m_draw_mode == dmSequentialFffPrint ? (m_values.empty() ? value : value + 1) : m_is_wipe_tower ? get_layer_number(value, label_type) + 1 : (m_values.empty() ? value : value + 1);
::sprintf(buffer, "%5s\n%5s", std::to_string(layer_number).c_str(), layer_height); ::sprintf(buffer, "%5s\n%5s", std::to_string(layer_number).c_str(), layer_height);
+5 -6
View File
@@ -3868,12 +3868,11 @@ _compare_obj_names(MachineObject* obj1, MachineObject* obj2)
} }
/******************************************************************* /*******************************************************************
*@note _collect_machine_list * @note _collect_machine_list
*@param dev_manager -- the device manager * @param dev_manager -- the device manager
*@param sorted_machine_objs -- return the sorted machine objects * @param sorted_machine_objs -- return the sorted machine objects
*@param best_one -- return the best one * @param best_one -- return the best one
*/ *******************************************************************/
/*******************************************************************/
static void static void
_collect_sorted_machines(Slic3r::DeviceManager* dev_manager, _collect_sorted_machines(Slic3r::DeviceManager* dev_manager,
std::vector<MachineObject*>& sorted_machine_objs) std::vector<MachineObject*>& sorted_machine_objs)