mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-10 02:37:04 +00:00
Fix: resolve 23 MSVC compiler warnings (#15280)
* fix: resolve MSVC compiler warnings and build error
C4101 - unreferenced local variables:
- STEP.cpp, FilamentGroup.cpp: remove unused catch variable 'e'
- GLGizmoMeasure.cpp: remove unused 'direction_on_model'
- PartPlate.cpp: remove unused 'origin1, origin2'
- DevStatus.cpp: suppress unused 'e' via (void)e
C4005 - macro redefinition:
- Wrap NOMINMAX defines in #ifndef guards (OrcaSlicer.cpp, Preset.cpp,
SupportTreeBuilder.cpp, OpenVDBUtils.cpp, GUI.cpp)
- Remove conflicting DESIGN_INPUT_SIZE redefine in DownloadProgressDialog.cpp
C4172 - return address of local/temporary:
- Config.cpp: return static const double instead of temporary 0
C4996 - deprecated API usage:
- ImGuiWrapper.cpp: use GetText().Length() instead of GetTextLength()
- OrcaCloudServiceAgent.cpp: replace deprecated wxPATH_NORM_ALL with
explicit flags matching old default behavior
- ASCIIFolding.cpp: replace deprecated std::wstring_convert/codecvt_utf8
with boost::locale::conv::utf_to_utf (already used in same function)
C2440 - build error from deprecated wxTipWindow constructor:
- Button.hpp/cpp: replace raw wxTipWindow* with wxTipWindow::Ref (weak
reference). Ref auto-nulls when the tip window closes, eliminating
the manual Bind(wxEVT_DESTROY) handler. delete uses operator->() to
access the raw pointer since Ref is non-owning
* fix: avoid duplicate GetText() call in ImGuiWrapper clipboard handler
Capture wxTextDataObject::GetText() result in a local variable instead
of calling it twice (for .Length() check and into_u8()). GetText()
returns wxString by value, so this avoids an extra allocation/copy.
* fix: resolve MSVC compiler warnings (code review fixes)
* fix: resolve MSVC compiler warnings (code review fixes)
This commit is contained in:
@@ -2031,7 +2031,8 @@ const double& DynamicConfig::opt_float(const t_config_option_key &opt_key, unsig
|
||||
return opt_floats_nullable->get_at(idx);
|
||||
} else {
|
||||
assert(false);
|
||||
return 0;
|
||||
static const double zero = 0.0;
|
||||
return zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1021,7 +1021,7 @@ namespace Slic3r
|
||||
if (FGMode::MatchMode == ctx.group_info.mode)
|
||||
return calc_filament_group_for_match(cost);
|
||||
}
|
||||
catch (const FilamentGroupException& e) {
|
||||
catch (const FilamentGroupException&) {
|
||||
}
|
||||
|
||||
return calc_filament_group_for_flush(cost);
|
||||
|
||||
@@ -712,7 +712,7 @@ unsigned int Step::get_triangle_num(double linear_deflection, double angle_defle
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} catch(const Exception &e) {
|
||||
} catch(const Exception &) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include "OpenVDBUtils.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <libslic3r/SLA/SupportTreeBuilder.hpp>
|
||||
#include <libslic3r/SLA/SupportTreeBuildsteps.hpp>
|
||||
|
||||
Reference in New Issue
Block a user