build: clear 5 warning categories across 19 sites (#15628)

This commit is contained in:
Kris Austin
2026-09-10 18:15:39 -03:00
committed by GitHub
parent 0a630738f1
commit d127db4d99
12 changed files with 40 additions and 23 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
#include <limits>
#include <nlohmann/json.hpp>
#include "DevMapping.h"
#include "DevFilaSystem.h"
@@ -270,7 +272,7 @@ namespace Slic3r
std::set<int> picked_tar;
for (int k = 0; k < distance_map.size(); k++)
{
float min_val = INT_MAX;
float min_val = std::numeric_limits<float>::max();
int picked_src_idx = -1;
int picked_tar_idx = -1;
for (int i = 0; i < distance_map.size(); i++)
+2 -2
View File
@@ -297,7 +297,7 @@ void MeshClipper::recalculate_triangles()
// it so it lies on our line. This will be the figure to subtract
// from the cut. The coordinates must not overflow after the transform,
// make the rectangle a bit smaller.
const coord_t size = (std::numeric_limits<coord_t>::max()/2 - scale_(std::max(std::abs(e * a), std::abs(e * b)))) / 4;
const coord_t size = (double(std::numeric_limits<coord_t>::max()/2) - scale_(std::max(std::abs(e * a), std::abs(e * b)))) / 4;
Polygons ep {Polygon({Point(-size, 0), Point(size, 0), Point(size, 2*size), Point(-size, 2*size)})};
ep.front().rotate(angle);
ep.front().translate(scale_(-e * a), scale_(-e * b));
@@ -352,7 +352,7 @@ void MeshClipper::recalculate_triangles()
// To prevent overflow after scaling, downscale the input if needed:
double extra_scale = 1.;
coord_t limit = coord_t(std::min(std::numeric_limits<coord_t>::max() / (2. * std::max(1., scale_x)), std::numeric_limits<coord_t>::max() / (2. * std::max(1., scale_y))));
coord_t limit = coord_t(std::min(double(std::numeric_limits<coord_t>::max()) / (2. * std::max(1., scale_x)), double(std::numeric_limits<coord_t>::max()) / (2. * std::max(1., scale_y))));
coord_t max_coord = 0;
for (const Point& pt : exp.contour)
max_coord = std::max(max_coord, std::max(std::abs(pt.x()), std::abs(pt.y())));
+1 -1
View File
@@ -1803,7 +1803,7 @@ static void* get_function(const char* name)
return function;
#if defined(_MSC_VER) || defined(_WIN32)
function = GetProcAddress(module, name);
function = reinterpret_cast<void*>(GetProcAddress(module, name));
#else
function = dlsym(module, name);
#endif
+1 -1
View File
@@ -349,7 +349,7 @@ void* BBLNetworkPlugin::get_function(const char* name)
return function;
#if defined(_MSC_VER) || defined(_WIN32)
function = GetProcAddress(m_networking_module, name);
function = reinterpret_cast<void*>(GetProcAddress(m_networking_module, name));
#else
function = dlsym(m_networking_module, name);
#endif
+16 -5
View File
@@ -8,6 +8,7 @@
#include <nlohmann/json.hpp>
using json = nlohmann::json;
#include <type_traits>
#include <unordered_map>
namespace Slic3r {
@@ -90,6 +91,16 @@ OnMessageFn to_orca_messages(OnMessageFn fn)
return [fn = std::move(fn)](std::string dev_id, std::string msg) { fn(std::move(dev_id), BBLPrinterAgent::to_orca_payload(std::move(msg))); };
}
// Retypes a plug-in entry point for an older plug-in generation. The detour through the
// generic function pointer marks the signature change as deliberate, which a direct cast
// between two signatures does not.
template <typename To, typename From>
To as_abi(From fn)
{
static_assert(std::is_function_v<std::remove_pointer_t<From>>, "as_abi retypes a function pointer");
return reinterpret_cast<To>(reinterpret_cast<void (*)()>(fn));
}
} // namespace
std::string BBLPrinterAgent::to_orca_filament_id(const std::string& printer_filament_id) const
@@ -141,7 +152,7 @@ int BBLPrinterAgent::send_message(std::string dev_id, std::string json_str, int
// series through the legacy form would silently drop MessageFlag sign/encrypt.
switch (plugin.network_abi()) {
case NetworkAbi::Legacy: {
auto legacy_func = reinterpret_cast<func_send_message_legacy>(func);
auto legacy_func = as_abi<func_send_message_legacy>(func);
return legacy_func(agent, std::move(dev_id), std::move(json_str), qos);
}
case NetworkAbi::V0203:
@@ -185,7 +196,7 @@ int BBLPrinterAgent::send_message_to_printer(std::string dev_id, std::string jso
if (func && agent) {
switch (plugin.network_abi()) {
case NetworkAbi::Legacy: {
auto legacy_func = reinterpret_cast<func_send_message_to_printer_legacy>(func);
auto legacy_func = as_abi<func_send_message_to_printer_legacy>(func);
return legacy_func(agent, std::move(dev_id), std::move(json_str), qos);
}
case NetworkAbi::V0203:
@@ -275,7 +286,7 @@ int BBLPrinterAgent::bind(std::string dev_ip, std::string dev_id, std::string de
switch (plugin.network_abi()) {
case NetworkAbi::Legacy:
case NetworkAbi::V0203: {
auto older_func = reinterpret_cast<func_bind_pre0208>(func);
auto older_func = as_abi<func_bind_pre0208>(func);
return older_func(agent, dev_ip, dev_id, sec_link, timezone, improved, update_fn);
}
case NetworkAbi::Current:
@@ -436,9 +447,9 @@ int dispatch_start(CurrentFn func, PrintParams& params, const CallbackFns&... ca
params.ams_mapping_info = BBLPrinterAgent::from_orca_payload(std::move(params.ams_mapping_info));
switch (plugin.network_abi()) {
case NetworkAbi::Legacy:
return reinterpret_cast<LegacyFn>(func)(agent, BBLNetworkPlugin::as_legacy(params), callbacks...);
return as_abi<LegacyFn>(func)(agent, BBLNetworkPlugin::as_legacy(params), callbacks...);
case NetworkAbi::V0203:
return reinterpret_cast<Fn0203>(func)(agent, BBLNetworkPlugin::as_0203(params), callbacks...);
return as_abi<Fn0203>(func)(agent, BBLNetworkPlugin::as_0203(params), callbacks...);
case NetworkAbi::Current:
return func(agent, std::move(params), callbacks...);
default:
+1 -1
View File
@@ -1620,7 +1620,7 @@ void PresetUpdater::priv::check_new_vendors(const std::set<std::string>& system_
Http::get(download_url_str)
.timeout_connect(5)
.on_progress(check_cancel)
.on_error([&vendor_id, &retry_count, max_retries](std::string body, std::string error, unsigned http_status) {
.on_error([&vendor_id, &retry_count](std::string body, std::string error, unsigned http_status) {
BOOST_LOG_TRIVIAL(warning) << "[Orca Updater] download failed for new vendor " << vendor_id
<< " (attempt " << retry_count << "/" << max_retries << "): " << error;
})