From d112a0af290671599490678ef2a5cf7601209a16 Mon Sep 17 00:00:00 2001 From: MAVProxyUser Date: Wed, 9 Sep 2026 06:39:08 -0400 Subject: [PATCH 01/10] Fix two stack buffer overflows in ADMesh stl_read (unbounded solid name + MW metadata parse) (#15594) Fix two stack buffer overflows in ADMesh stl_read (solid name + MW parse) Bound the ASCII-STL solid-name fscanf scanset to the buffer size, and bound the OrcaSlicer-specific "MW" metadata sscanf %s conversions to their buffers: - fscanf(fp, " solid %[^\n]", solid_name) -> %255[^\n] (solid_name[256]) - sscanf(mw_position+3, "%s %s %s", ...) -> %15s %127s %15s (version_str[16], model_id_str[128], country_code_str[16]) Both are reachable by opening a crafted .stl and overwrite saved stack state (instruction-pointer control on the no-PAC arm64 macOS build). The solid-name defect is inherited from the shared ADMesh loader (bambulab/BambuStudio#12153); the MW parse is OrcaSlicer-specific. Co-authored-by: Kevin Finisterre Co-authored-by: Claude Opus 4.8 --- deps_src/admesh/stlinit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps_src/admesh/stlinit.cpp b/deps_src/admesh/stlinit.cpp index a69bd5497a..9d44cdf266 100644 --- a/deps_src/admesh/stlinit.cpp +++ b/deps_src/admesh/stlinit.cpp @@ -162,7 +162,7 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor rewind(fp); try{ char solid_name[256]; - int res_solid = fscanf(fp, " solid %[^\n]", solid_name); + int res_solid = fscanf(fp, " solid %255[^\n]", solid_name); if (res_solid == 1) { char* mw_position = strstr(solid_name, "MW"); if (mw_position != NULL) { @@ -170,7 +170,7 @@ static bool stl_read(stl_file *stl, FILE *fp, int first_facet, bool first, Impor char version_str[16]; char model_id_str[128]; char country_code_str[16]; - int num_values = sscanf(mw_position + 3, "%s %s %s", version_str, model_id_str, country_code_str); + int num_values = sscanf(mw_position + 3, "%15s %127s %15s", version_str, model_id_str, country_code_str); if (num_values == 3) { if (strcmp(version_str, "1.0") == 0) { model_id = model_id_str; From 10c123f2aa4b815116e9f8f5c74708b04d096469 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 05:41:51 -0500 Subject: [PATCH 02/10] build: clear 6 warnings - data passed as ImGui format strings (#15585) ImGui::Text and ImGui::TextColored take a printf format, so these six sites passed data where a literal belonged. A % in that data reads a vararg that was never supplied. Three sites in GLCanvas3D's paint toolbar passed filament text, which comes from the filament preset config and is user-editable. Two more passed translated strings, where a % in any of the 23 catalogs does the same. GLGizmoSimplify passed its progress label. That label had been built with an escaped %% because it was being used as a format string. Passing it as an argument instead needs a single %, so it still renders as "42%". ToUTF8() returns a buffer class, which converts to const char* for a named parameter but not through varargs, so those two sites need .data(). GLGizmoSimplify.cpp:335 is unchanged, because _u8L("%d triangles") is passed with a real argument and has to stay a format string. --- src/slic3r/GUI/GLCanvas3D.cpp | 10 +++++----- src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 8d72405cdd..6921a72271 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -9780,18 +9780,18 @@ void GLCanvas3D::_render_paint_toolbar() const ImVec2 number_label_size = ImGui::CalcTextSize(std::to_string(i + 1).c_str()); ImGui::SetCursorPosY(cursor_y + text_offset_y); ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - number_label_size.x) / 2); - ImGui::TextColored(text_color, std::to_string(i + 1).c_str()); + ImGui::TextColored(text_color, "%s", std::to_string(i + 1).c_str()); imgui.pop_bold_font(); ImVec2 filament_first_line_label_size = ImGui::CalcTextSize(filament_text_first_line[i].c_str()); ImGui::SetCursorPosY(cursor_y + text_offset_y + number_label_size.y); ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - filament_first_line_label_size.x) / 2); - ImGui::TextColored(text_color, filament_text_first_line[i].c_str()); + ImGui::TextColored(text_color, "%s", filament_text_first_line[i].c_str()); ImVec2 filament_second_line_label_size = ImGui::CalcTextSize(filament_text_second_line[i].c_str()); ImGui::SetCursorPosY(cursor_y + text_offset_y + number_label_size.y + filament_first_line_label_size.y); ImGui::SetCursorPosX(spacing + i * (spacing + button_size.x) + (button_size.x - filament_second_line_label_size.x) / 2); - ImGui::TextColored(text_color, filament_text_second_line[i].c_str()); + ImGui::TextColored(text_color, "%s", filament_text_second_line[i].c_str()); } if (ImGui::GetWindowWidth() == constraint_window_width) { @@ -10018,9 +10018,9 @@ void GLCanvas3D::_render_assemble_info() const double size1 = m_selection.get_bounding_box().size()(1); double size2 = m_selection.get_bounding_box().size()(2); if (!m_selection.is_empty()) { - ImGui::Text(_L("Volume:").ToUTF8()); ImGui::SameLine(caption_max); + ImGui::Text("%s", _L("Volume:").ToUTF8().data()); ImGui::SameLine(caption_max); ImGui::Text("%.2f", size0 * size1 * size2); - ImGui::Text(_L("Size:").ToUTF8()); ImGui::SameLine(caption_max); + ImGui::Text("%s", _L("Size:").ToUTF8().data()); ImGui::SameLine(caption_max); ImGui::Text("%.2f x %.2f x %.2f", size0, size1, size2); } imgui->end(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp index f4fa1fbbb9..6a08d5eff4 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp @@ -343,12 +343,12 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(10,20)); if (is_worker_running) { // apply or preview // draw progress bar - std::string progress_text = GUI::format("%1%", std::to_string(progress)) + "%%"; + std::string progress_text = GUI::format("%1%", std::to_string(progress)) + "%"; ImVec2 progress_size(bottom_left_width - space_size, 0.0f); ImGui::BBLProgressBar2(progress / 100., progress_size); ImGui::SameLine(); ImGui::AlignTextToFramePadding(); - ImGui::TextColored(ImVec4(0.42f, 0.42f, 0.42f, 1.00f), progress_text.c_str()); + ImGui::TextColored(ImVec4(0.42f, 0.42f, 0.42f, 1.00f), "%s", progress_text.c_str()); ImGui::SameLine(bottom_left_width + slider_width + m_imgui->scaled(1.0f)); } else { ImGui::Dummy(ImVec2(bottom_left_width - space_size, -1)); From c70a6135483f2e54826dbc4f2bb64b2b40a868c7 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 05:43:08 -0500 Subject: [PATCH 03/10] build: clear 8 warnings - && inside || without parentheses (#15587) Every edit makes the precedence the compiler already applies explicit. None of them regroups an expression, so behavior is unchanged at all eight sites. Strip parentheses and whitespace from the diff and the token stream matches. GCodeProcessor.cpp:1472 tests == where the symmetric clause below tests !=, which reads like a typo and is not one. A comment now explains why. OrcaSlicer.cpp:4760 was the only judgment call. Its leading !is_seq_print is bare while both operands are parenthesized, so the written form matches what the compiler does. Kept rather than guessed at. --- src/OrcaSlicer.cpp | 2 +- src/libslic3r/GCode/GCodeProcessor.cpp | 8 +++++--- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 4 ++-- src/slic3r/GUI/SelectMachine.cpp | 2 +- src/slic3r/GUI/UnsavedChangesDialog.cpp | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 1f85cf7358..15e7f85c46 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -4826,7 +4826,7 @@ int CLI::run(int argc, char **argv) } } - if (!arrange_cfg.is_seq_print && (assemble_plate.filaments_count > 1)||(enable_wrapping_detect && !current_wrapping_exclude_area.empty())) + if ((!arrange_cfg.is_seq_print && (assemble_plate.filaments_count > 1))||(enable_wrapping_detect && !current_wrapping_exclude_area.empty())) { //prepare the wipe tower int plate_count = partplate_list.get_plate_count(); diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index cd6c494f33..0b3db0323b 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1468,9 +1468,11 @@ void GCodeProcessor::run_post_process() // Append a per-filament usage block at a filament change. auto handle_filament_change = [&](int filament_id, int cur_line_id, int nozzle_id) { - // skip filament changes emitted inside the machine start / end gcode - if (m_machine_start_gcode_end_line_id == (unsigned int) (-1) && (unsigned int) (cur_line_id) < m_machine_start_gcode_end_line_id || - m_machine_end_gcode_start_line_id != (unsigned int) (-1) && (unsigned int) (cur_line_id) > m_machine_end_gcode_start_line_id) + // Skip filament changes emitted inside the machine start / end gcode. One forward pass assigns + // the tag ids and tests them in the same loop, so inside the start gcode the end tag is unseen + // and the id still holds the sentinel. That is why the first clause tests == and the second !=. + if ((m_machine_start_gcode_end_line_id == (unsigned int) (-1) && (unsigned int) (cur_line_id) < m_machine_start_gcode_end_line_id) || + (m_machine_end_gcode_start_line_id != (unsigned int) (-1) && (unsigned int) (cur_line_id) > m_machine_end_gcode_start_line_id)) return; if (!m_filament_blocks.empty()) m_filament_blocks.back().upper_gcode_id = cur_line_id; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 6921a72271..556faaa763 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2191,7 +2191,7 @@ void GLCanvas3D::render(bool only_init) // Negative coordinate means out of the window, likely because the window was deactivated. // In that case the tooltip should be hidden. - if (m_mouse.position.x() >= 0. && m_mouse.position.y() >= 0. || has_mouse_capture()) { // ORCA continue to capture mouse pos mid drag + if ((m_mouse.position.x() >= 0. && m_mouse.position.y() >= 0.) || has_mouse_capture()) { // ORCA continue to capture mouse pos mid drag if (tooltip.empty()) tooltip = m_layers_editing.get_tooltip(*this); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 2d8816960b..109d7b3c10 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3667,8 +3667,8 @@ void Sidebar::update_presets(Preset::Type preset_type) // so extruders without an explicit sub-nozzle count never offer Hybrid. A nullable-int // nil is INT_MAX (> 1) and would otherwise falsely pass the gate, so exclude it too. if (boost::algorithm::contains(extruder_variants->values[index], type + " " + nozzle_volumes_def->enum_labels[i]) || - extruder_max_nozzle_count->get_at(index) > 1 && extruder_max_nozzle_count->get_at(index) != ConfigOptionIntsNullable::nil_value() && - nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == nvtHybrid) { + (extruder_max_nozzle_count->get_at(index) > 1 && extruder_max_nozzle_count->get_at(index) != ConfigOptionIntsNullable::nil_value() && + nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == nvtHybrid)) { if (nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == NozzleVolumeType::nvtHighFlow &&(diameter == "0.2" || is_skip_high_flow_printer(printer_model))) continue; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 41ee523fbe..629aef7296 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -3073,7 +3073,7 @@ static bool _HasExt(const std::vector &ams_mapping_result) { }; for (const auto &info : ams_mapping_result) { - if (info.ams_id == VIRTUAL_AMS_MAIN_ID_STR || info.ams_id == VIRTUAL_AMS_DEPUTY_ID_STR && !info.ams_id.empty()) { + if (info.ams_id == VIRTUAL_AMS_MAIN_ID_STR || (info.ams_id == VIRTUAL_AMS_DEPUTY_ID_STR && !info.ams_id.empty())) { return true; } } diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 5c69466cfa..0cb35fb139 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -1281,8 +1281,8 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig& } auto opt_vector = dynamic_cast(option); - if (option->is_scalar() && config.option(opt_key)->is_nil() || - option->is_vector() && opt_vector && opt_idx >= 0 && opt_idx < opt_vector->size() && opt_vector->is_nil(opt_idx)) + if ((option->is_scalar() && config.option(opt_key)->is_nil()) || + (option->is_vector() && opt_vector && opt_idx >= 0 && opt_idx < opt_vector->size() && opt_vector->is_nil(opt_idx))) return _L("N/A"); wxString out; From a3c9041c10b23c2112a506d5cb857da0390d9f95 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 05:45:25 -0500 Subject: [PATCH 04/10] build: clear 2 warnings - sites GCC reports and Clang does not (#15597) Both are in our own code and neither shows up in a clang-cl or clang census, so the Windows and CI matrices have never reported them. FillRectilinear.cpp draws two trapezoid diagrams whose lines end in a backslash, which continues a // comment onto the next line. GCC calls that a multi-line comment. The diagrams are now block comments, where the rule does not apply, and the drawings are unchanged. CutObjectBase has a user-provided operator= and a virtual destructor, either of which deprecates its implicitly generated copy constructor. bbs_3mf.cpp copies the type through CutObjectInfo. The copy constructor is now declared and defaulted, leaving the class with no implicit copy member. Move operations were already suppressed by the user-provided operator=, so nothing changes there. --- src/libslic3r/Fill/FillRectilinear.cpp | 19 +++++++++++-------- src/libslic3r/ObjectID.hpp | 4 ++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index db340748ab..7edf350081 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -3090,10 +3090,11 @@ bool FillRectilinear::fill_surface_trapezoidal( case 0: // Grid / Trapezoidal { // Generate a non-crossing trapezoidal pattern to avoid overextrusion at intersections when `multiline > 1`. - // P2--P3 - // / \ - // P0_P1/ \P4_ - // + /* + * P2--P3 + * / \ + * P0_P1/ \P4_ + */ // P0xP1x=P4xP0x=d1/2 // P2xP3x=d1 // P1yP2y=P2yP3y=d2 @@ -3171,10 +3172,12 @@ bool FillRectilinear::fill_surface_trapezoidal( case 1: // Triangular { // Generate a non-crossing trapezoidal pattern with a base line below. - // P1-P2 - // / \ - // P0/ \P3_P4 - // ---------------- + /* + * P1-P2 + * / \ + * P0/ \P3_P4 + * ---------------- + */ // P1xP2x=P3xP4x=d2 // P0yP1y=P2yP3y=h-2d1 // diff --git a/src/libslic3r/ObjectID.hpp b/src/libslic3r/ObjectID.hpp index f2697b74f5..56042bbaa3 100644 --- a/src/libslic3r/ObjectID.hpp +++ b/src/libslic3r/ObjectID.hpp @@ -170,6 +170,10 @@ public: this->m_check_sum = rhs.check_sum(); this->m_connectors_cnt = rhs.connectors_cnt(); } + // A user-declared copy assignment or destructor deprecates the implicitly generated + // copy constructor, and this class has both, so declare it rather than rely on it. + CutObjectBase(const CutObjectBase &) = default; + CutObjectBase &operator=(const CutObjectBase &other) { this->copy(other); From 46180c3f543964e5349fa0a2db10de0b37184930 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 05:51:10 -0500 Subject: [PATCH 05/10] build: clear 3 warnings - a precedence bug, an arm64-only pragma, and a CLI error label (#15601) * build: clear 2 warnings - a precedence bug and an arm64-only pragma Both were found by promoting every warning to an error across the CI matrix. Neither is reported by clang-cl on Windows x64, which is the configuration the #15374 inventory measures. LineSplit.hpp reserved with path.size() + closed ? 1 : 0. Addition binds tighter than ?:, so that parses as (path.size() + closed) ? 1 : 0, and the function returns early when path is empty, so the condition is always true and the reserve is always 1. The vector then grows by reallocation instead of reserving once. Output is unaffected, since reserve only sets capacity. Reported by Clang on Linux, macOS and Flatpak; GCC does not diagnose it. Int128.hpp declared #pragma intrinsic(_mul128) under _WIN64, which is defined on Windows arm64 as well, where that x64 intrinsic does not exist. The call site at line 190 is already guarded on _M_X64 and carries a comment saying ARM64 has no _mul128, so the pragma now uses the same guard. x64 is unchanged because _M_X64 is defined there. * build: clear 1 warning - CLI error label prints 1 instead of a name construct_assemble_list is a function, so streaming it converts the function pointer to bool. When that catch block fires the CLI prints "1: ". This line was already fixed in #5963 and came back in the wholesale revert of that PR two weeks later, which was reverting an auto-orientation regression somewhere in its 184 files. The string is restored exactly as it was merged then. --- src/OrcaSlicer.cpp | 2 +- src/libslic3r/Algorithm/LineSplit.hpp | 2 +- src/libslic3r/Int128.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 15e7f85c46..1cbf76ef5a 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -1925,7 +1925,7 @@ int CLI::run(int argc, char **argv) } } catch (std::exception& e) { - boost::nowide::cerr << construct_assemble_list << ": " << e.what() << std::endl; + boost::nowide::cerr << "construct_assemble_list: " << e.what() << std::endl; record_exit_reson(outfile_dir, CLI_DATA_FILE_ERROR, 0, cli_errors[CLI_DATA_FILE_ERROR], sliced_info); flush_and_exit(CLI_DATA_FILE_ERROR); } diff --git a/src/libslic3r/Algorithm/LineSplit.hpp b/src/libslic3r/Algorithm/LineSplit.hpp index 58b9fdc34a..e12113fa6c 100644 --- a/src/libslic3r/Algorithm/LineSplit.hpp +++ b/src/libslic3r/Algorithm/LineSplit.hpp @@ -49,7 +49,7 @@ SplittedLine split_line(const PathType& path, const ExPolygons& clip, bool close // Convert the input path into an open ZPath ClipperZUtils::ZPath p; - p.reserve(path.size() + closed ? 1 : 0); + p.reserve(path.size() + (closed ? 1 : 0)); ClipperLib_Z::cInt z = 0; for (const auto& point : path) { p.emplace_back(point.x(), point.y(), z); diff --git a/src/libslic3r/Int128.hpp b/src/libslic3r/Int128.hpp index e7238ca745..e55ef64cfb 100644 --- a/src/libslic3r/Int128.hpp +++ b/src/libslic3r/Int128.hpp @@ -57,7 +57,7 @@ #define HAS_INTRINSIC_128_TYPE #endif -#if defined(_MSC_VER) && defined(_WIN64) +#if defined(_MSC_VER) && defined(_M_X64) #include #pragma intrinsic(_mul128) #endif From fa3dbfcc6f9a093f5aa33833121a16561e7cce3d Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 05:55:19 -0500 Subject: [PATCH 06/10] fix: clear 1 warning - report the real error when a Windows G-code export fails (#15582) fix: report the real error when a Windows G-code export fails copy_file built its failure message as "Error: " + errCode. Adding a DWORD to a string literal is pointer arithmetic, not concatenation, so the pointer lands errCode bytes into an 8-byte literal and runs past its end for any code above 7. std::string then calls strlen on it and throws length_error, and the catch(...) in BackgroundSlicingProcess::finalize_gcode replaces the diagnosis with "Unknown error occurred during exporting G-code." Every code a user is likely to hit is past the end: write-protected media is 19, no media 21, a full disk 112, and a destination held open by another program 32. Codes 1 to 7 stay inside the literal and produce a truncated message instead. So the "Maybe the SD card is write locked?" text has not been reachable on Windows since this path was added in #2923. Now that it is reachable, that guess only fits removable media, so it is conditional on m_export_path_on_removable_media. The existing string is untouched and keeps its 23 translations; the fixed-drive case adds one string. --- src/libslic3r/utils.cpp | 2 +- src/slic3r/GUI/BackgroundSlicingProcess.cpp | 4 ++- tests/libslic3r/test_utils.cpp | 36 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp index 875c90f6ab..58323b29ce 100644 --- a/src/libslic3r/utils.cpp +++ b/src/libslic3r/utils.cpp @@ -961,7 +961,7 @@ CopyFileResult copy_file(const std::string &from, const std::string &to, std::st BOOL result = CopyFileW(src_wstr, dst_wstr, FALSE); if (!result) { DWORD errCode = GetLastError(); - error_message = "Error: " + errCode; + error_message = "Error: " + std::to_string(errCode); ret = FAIL_COPY_FILE; goto __finished; } diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 64c52c6e72..f795b41999 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -848,7 +848,9 @@ void BackgroundSlicingProcess::finalize_gcode() case CopyFileResult::SUCCESS: break; // no error case CopyFileResult::FAIL_COPY_FILE: throw Slic3r::ExportError(GUI::format( - _L("Copying of the temporary G-code to the output G-code failed. Maybe the SD card is write locked?\nError message: %1%"), + m_export_path_on_removable_media ? + _L("Copying of the temporary G-code to the output G-code failed. Maybe the SD card is write locked?\nError message: %1%") : + _L("Copying of the temporary G-code to the output G-code failed.\nError message: %1%"), error_message)); break; case CopyFileResult::FAIL_FILES_DIFFERENT: diff --git a/tests/libslic3r/test_utils.cpp b/tests/libslic3r/test_utils.cpp index c039069b2a..484438127c 100644 --- a/tests/libslic3r/test_utils.cpp +++ b/tests/libslic3r/test_utils.cpp @@ -2,6 +2,13 @@ #include "libslic3r/Utils.hpp" +#include "test_utils.hpp" + +#include +#include +#include +#include + #ifndef _WIN32 #include // getuid #endif @@ -52,3 +59,32 @@ TEST_CASE("per-user temp root is unchanged on Windows, isolated elsewhere", "[ut REQUIRE_THAT(root, Catch::Matchers::StartsWith(base + "/orcaslicer_")); #endif } + +TEST_CASE("copy_file reports the OS error when the destination cannot be written", "[utils]") { + ScopedTemporaryFile source(".txt"); + { + std::ofstream ofs(source.string(), std::ios::binary); + ofs << "orca"; + } + REQUIRE(boost::filesystem::exists(source.path())); + + // A directory that was never created, so the copy fails on every platform. + const boost::filesystem::path destination = source.path().parent_path() / "orca-missing-dir" / "copy.txt"; + REQUIRE_FALSE(boost::filesystem::exists(destination.parent_path())); + + std::string error_message; + REQUIRE(copy_file(source.string(), destination.string(), error_message) == FAIL_COPY_FILE); + REQUIRE_FALSE(error_message.empty()); + +#ifdef _WIN32 + // The Windows branch formats GetLastError() itself. Writing that as + // "Error: " + errCode adds an integer to a string literal, which indexes into the + // literal instead of appending and runs off its end for any code above 7. + const std::string prefix = "Error: "; + REQUIRE(error_message.rfind(prefix, 0) == 0); + + const std::string code = error_message.substr(prefix.size()); + REQUIRE_FALSE(code.empty()); + REQUIRE(std::all_of(code.begin(), code.end(), [](unsigned char c) { return std::isdigit(c) != 0; })); +#endif // _WIN32 +} From 913afc51b7b7fe112b4fa4adb58a824ecc301c28 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 06:07:54 -0500 Subject: [PATCH 07/10] build: clear 3 warnings - lambda captures that are not required (#15596) config_substitution_rule is a const enum with a constant initializer, so a lambda can read it without capturing it. Capturing it explicitly is what -Wunused-lambda-capture reports. The category was taken to zero by #15417 and merged on 2026-09-02. These three sites arrived on 2026-09-08 in bcb4f17d9a, "fix(cli): resolve inherited presets through vendor manifests" (#15438). All three lambdas still read the value, which needs no capture and is unchanged. --- src/OrcaSlicer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 1cbf76ef5a..5463f55c20 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -1975,7 +1975,7 @@ int CLI::run(int argc, char **argv) } std::unique_ptr cli_preset_bundle; - auto ensure_cli_preset_bundle = [&cli_preset_bundle, config_substitution_rule](std::string &error) -> PresetBundle * { + auto ensure_cli_preset_bundle = [&cli_preset_bundle](std::string &error) -> PresetBundle * { if (cli_preset_bundle) return cli_preset_bundle.get(); try { @@ -2002,7 +2002,7 @@ int CLI::run(int argc, char **argv) } }; - auto resolve_preset = [&ensure_cli_preset_bundle, config_substitution_rule](const std::string &file, DynamicPrintConfig &config, + auto resolve_preset = [&ensure_cli_preset_bundle](const std::string &file, DynamicPrintConfig &config, std::string &config_type, const std::string &config_from, bool probe_type, std::string &error) { const auto *inherits = config.option(BBL_JSON_KEY_INHERITS); @@ -2046,7 +2046,7 @@ int CLI::run(int argc, char **argv) error, allow_source_manifest); }; - auto load_config_file = [config_substitution_rule, &resolve_preset](const std::string& file, DynamicPrintConfig& config, std::string& config_type, + auto load_config_file = [&resolve_preset](const std::string& file, DynamicPrintConfig& config, std::string& config_type, std::string& config_name, std::string& filament_id, std::string& config_from) { if (! boost::filesystem::exists(file)) { boost::nowide::cerr << __FUNCTION__<< ": can not find setting file: " << file << std::endl; From f18eb21b82a5eedff91ee95aa9d6755a221f03e1 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 10:01:19 -0500 Subject: [PATCH 08/10] build: clear 11 single-site clang-cl warning categories (#15584) build: clear eleven single-site clang-cl warning categories Each of these is the last site left in its category, and every one is the compiler saying it cannot tell what the code meant. Nothing here changes defined behavior. - OrcaSlicer_app_msvc.cpp printed a DWORD with %d - StackWalker.cpp ran delete[] through an LPVOID - ToolOrdering.cpp used a bare ; as a deliberate skip loop's body - WipeTower.cpp had finish_block_tcr = finish_block_tcr, so the branch that reached it did nothing. Folding the condition into the enclosing if leaves the other branch untouched - GCodeProcessor.cpp had an else binding to the inner if while the outer if carried no braces - AmsMappingPopupUpdate.cpp wrote >= 1 || <= 3 where its own comment says && - CalibrationWizardPresetPage.cpp left max_decimal_length unset through a pair of conditions that cover every value but not visibly so - DevManager.cpp bound map elements to pair rather than pair, copying every one - SyncAmsInfoDialog.cpp had extraneous parentheses around a comparison - Http.cpp had if (speed > 0.01) speed = speed;. speed now starts at 0 as well, because curl_easy_getinfo leaves the target untouched when it fails and the value reaches Progress either way - SnapmakerPrinterAgent.cpp truncated npos into an unsigned int, so the != npos guard was always true. A colour with no # still yields 0, because the wrap produced 0 as well Nine categories go to zero. -Wtautological-overlap-compare and -Wsometimes-uninitialized reach zero when #15583 merges their second site. --- src/OrcaSlicer_app_msvc.cpp | 2 +- src/dev-utils/StackWalker.cpp | 2 +- src/libslic3r/GCode/GCodeProcessor.cpp | 3 ++- src/libslic3r/GCode/ToolOrdering.cpp | 2 +- src/libslic3r/GCode/WipeTower.cpp | 8 ++------ src/slic3r/GUI/AmsMappingPopupUpdate.cpp | 2 +- src/slic3r/GUI/CalibrationWizardPresetPage.cpp | 2 +- src/slic3r/GUI/DeviceCore/DevManager.cpp | 2 +- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 2 +- src/slic3r/Utils/Http.cpp | 4 +--- src/slic3r/Utils/SnapmakerPrinterAgent.cpp | 2 +- 11 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/OrcaSlicer_app_msvc.cpp b/src/OrcaSlicer_app_msvc.cpp index 35568a9cfa..265047fa34 100644 --- a/src/OrcaSlicer_app_msvc.cpp +++ b/src/OrcaSlicer_app_msvc.cpp @@ -297,7 +297,7 @@ int wmain(int argc, wchar_t **argv) // printf("Loading Slic3r library: %S\n", path_to_slic3r); HINSTANCE hInstance_Slic3r = LoadLibraryExW(path_to_slic3r, nullptr, 0); if (hInstance_Slic3r == nullptr) { - printf("OrcaSlicer.dll was not loaded, error=%d\n", GetLastError()); + printf("OrcaSlicer.dll was not loaded, error=%lu\n", GetLastError()); return -1; } diff --git a/src/dev-utils/StackWalker.cpp b/src/dev-utils/StackWalker.cpp index 468e8927a5..6038196cb0 100644 --- a/src/dev-utils/StackWalker.cpp +++ b/src/dev-utils/StackWalker.cpp @@ -364,7 +364,7 @@ void CStackWalker::GetModuleInformation(LPMODULE_INFO pmi) if (dwInfoSize > 0) { - LPVOID lpData = new byte[dwInfoSize]; + byte *lpData = new byte[dwInfoSize]; ZeroMemory(lpData, dwInfoSize * sizeof(byte)); if (GetFileVersionInfo(pmi->szModulePath, dwHandle, dwInfoSize, lpData) > 0 ) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 0b3db0323b..e4da19cd73 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -2779,7 +2779,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int std::map> gcode_path_pos; // object_id, filament_id, pos for (const GCodeProcessorResult::MoveVertex &move : m_result.moves) { // sometimes, the start line extrude was outside the edge of plate a little, this is allowed, so do not include into the gcode_path_pos - if (move.type == EMoveType::Extrude /* && move.extrusion_role != ExtrusionRole::erFlush || move.type == EMoveType::Travel*/) + if (move.type == EMoveType::Extrude /* && move.extrusion_role != ExtrusionRole::erFlush || move.type == EMoveType::Travel*/) { if (move.extrusion_role == ExtrusionRole::erCustom) { /*if (move.is_arc_move_with_interpolation_points()) { for (int i = 0; i < move.interpolation_points.size(); i++) { @@ -2801,6 +2801,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int gcode_path_pos[move.object_label_id][int(move.extruder_id)].max_print_z = std::max(gcode_path_pos[move.object_label_id][int(move.extruder_id)].max_print_z, move.print_z); } + } } bool valid = true; diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 0a97e7ac41..c6517c6e65 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -3137,7 +3137,7 @@ void ToolOrdering::assign_custom_gcodes(const Print &print) // Skip all custom G-codes above this layer and skip all extruder switches. for (; custom_gcode_it != custom_gcode_per_print_z.gcodes.rend() && ( (print_z_above > lt.print_z && custom_gcode_it->print_z > 0.5 * (lt.print_z + print_z_above)) - || custom_gcode_it->type == CustomGCode::ToolChange); ++ custom_gcode_it); + || custom_gcode_it->type == CustomGCode::ToolChange); ++ custom_gcode_it) {} print_z_above = lt.print_z; if (custom_gcode_it == custom_gcode_per_print_z.gcodes.rend()) // Custom G-codes were processed. diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index bef3803c55..589ac14bad 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -4971,12 +4971,8 @@ void WipeTower::generate_new(std::vector= 1 || ams_type <= 3) { // 1:ams 2:ams-lite 3:n3f + if (ams_type >= 1 && ams_type <= 3) { // 1:ams 2:ams-lite 3:n3f auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL); auto ams_mapping_item_container = new MappingContainer(nozzle_id == 0 ? m_right_marea_panel : m_left_marea_panel, "AMS-1", 4); diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index 5267715439..c6d491a930 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -360,7 +360,7 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent) int max_decimal_length; if (i <= 1) max_decimal_length = 3; - else if (i >= 2) + else max_decimal_length = 4; if (decimal_number > max_decimal_length) { int allowed_length = number.length() - decimal_number + max_decimal_length; diff --git a/src/slic3r/GUI/DeviceCore/DevManager.cpp b/src/slic3r/GUI/DeviceCore/DevManager.cpp index 8844303793..feb6301df3 100644 --- a/src/slic3r/GUI/DeviceCore/DevManager.cpp +++ b/src/slic3r/GUI/DeviceCore/DevManager.cpp @@ -872,7 +872,7 @@ namespace Slic3r obj->m_is_online = elem["dev_online"].get(); if (elem.contains("dev_model_name") && !elem["dev_model_name"].is_null()) { auto printer_type = elem["dev_model_name"].get(); - for (const std::pair> &pair : device_subseries) { + for (const auto &pair : device_subseries) { auto it = std::find(pair.second.begin(), pair.second.end(), printer_type); if (it != pair.second.end()) { diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index 92c3d218e5..c6973649b1 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -1547,7 +1547,7 @@ bool SyncAmsInfoDialog::is_nozzle_type_match(DevExtderSystem data, wxString &err auto sai_nz_pt = wxGetApp().preset_bundle->printers.get_edited_preset().get_printer_type(wxGetApp().preset_bundle); if (target_machine_nozzle_id == DEPUTY_EXTRUDER_ID) { pos = _L(DevPrinterConfigUtil::get_toolhead_display_name(sai_nz_pt, DEPUTY_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::LowerCase)); - } else if ((target_machine_nozzle_id == MAIN_EXTRUDER_ID)) { + } else if (target_machine_nozzle_id == MAIN_EXTRUDER_ID) { pos = _L(DevPrinterConfigUtil::get_toolhead_display_name(sai_nz_pt, MAIN_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::LowerCase)); } diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index f1ff056d10..4d34d60d04 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -254,10 +254,8 @@ int Http::priv::xfercb(void *userp, curl_off_t dltotal, curl_off_t dlnow, curl_o bool cb_cancel = false; if (self->progressfn) { - double speed; + double speed = 0.; curl_easy_getinfo(self->curl, CURLINFO_SPEED_UPLOAD, &speed); - if (speed > 0.01) - speed = speed; Progress progress(dltotal, dlnow, ultotal, ulnow, self->buffer, speed); self->progressfn(progress, cb_cancel); } diff --git a/src/slic3r/Utils/SnapmakerPrinterAgent.cpp b/src/slic3r/Utils/SnapmakerPrinterAgent.cpp index 9b9a6809fd..ab7aa9bd52 100644 --- a/src/slic3r/Utils/SnapmakerPrinterAgent.cpp +++ b/src/slic3r/Utils/SnapmakerPrinterAgent.cpp @@ -39,7 +39,7 @@ std::string find_closest_color_preset_by_vendor_and_type(const PresetCollection& std::string p_color = p.config.opt_string("default_filament_colour", 0u); unsigned int p_color_value; if (!p_color.empty()) { - unsigned int hash_pos = p_color.find("#"); + size_t hash_pos = p_color.find("#"); p_color_value = std::stoul(p_color.substr(hash_pos != std::string::npos ? hash_pos + 1 : 0), nullptr, 16); } else { // Default to black if no color specified in profile. Assume other profiles might be a closer color match. From dbeef900ccf341f6b977417164b298e975e38b8f Mon Sep 17 00:00:00 2001 From: TheLegendTubaGuy <95944177+thelegendtubaguy@users.noreply.github.com> Date: Wed, 9 Sep 2026 12:18:21 -0500 Subject: [PATCH 09/10] Fix Windows build test midnight race (#15616) --- scripts/test_build_win.ps1 | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/test_build_win.ps1 b/scripts/test_build_win.ps1 index a8abfbc7bf..65dec8ffa1 100644 --- a/scripts/test_build_win.ps1 +++ b/scripts/test_build_win.ps1 @@ -22,6 +22,7 @@ Match regexes; each must match at least one output line NotMatch regexes; none may match any output line NotExists paths that must not exist after the case runs + DateStampedZip require a bundle date from during this case's invocation .PARAMETER Name Run only the cases whose name matches this regex. Headings with no @@ -109,12 +110,6 @@ $slnDir = Join-Path $fixtures 'sln' New-Item -ItemType Directory -Force -Path $slnDir | Out-Null Set-Content -Path (Join-Path $slnDir 'OrcaSlicer.sln') -Value '' -Encoding ascii -# The pack stamp is checked against real dates, so a locale-dependent parse -# in the script cannot pass by looking date-shaped. Yesterday is accepted too, -# so a run that crosses midnight does not flake. -$dateStamps = @((Get-Date -Format 'yyyyMMdd'), (Get-Date).AddDays(-1).ToString('yyyyMMdd')) -$stampPattern = '_(' + ($dateStamps -join '|') + ')\.zip$' - $cases = @( 'argument handling' @{ Name = 'no arguments prints help'; Args = @(); DryRun = $false @@ -326,12 +321,12 @@ $cases = @( Contains = @('OrcaSlicer_dep_win-x64_') NotContains = @('-clang', '-Release') } @{ Name = 'the bundle is stamped with today, not a shuffled date'; Args = @('-p') - Match = @($stampPattern) } + DateStampedZip = $true } # powershell.exe is not in System32 itself, so a trimmed PATH used to # leave the stamp empty and the bundle named OrcaSlicer_dep_win-x64_.zip. @{ Name = 'the bundle is stamped even with a bare PATH'; Args = @('-p') Env = @{ PATH = 'C:\Windows\system32;C:\Windows' } - Match = @($stampPattern) } + DateStampedZip = $true } @{ Name = '-p packs without rebuilding'; Args = @('-p') Match = @('^\+ .*(7z\.exe a|tar\.exe -a -c -f) ') NotContains = @('cmake -S deps') } @@ -861,7 +856,7 @@ function Invoke-BuildScript { $knownFields = @( 'Name', 'Args', 'ExpectExit', 'DryRun', 'First', 'Env', - 'Contains', 'NotContains', 'Match', 'NotMatch', 'NotExists' + 'Contains', 'NotContains', 'Match', 'NotMatch', 'NotExists', 'DateStampedZip' ) function Test-Case { @@ -876,7 +871,9 @@ function Test-Case { $expect = 0 if ($Case.ContainsKey('ExpectExit')) { $expect = $Case['ExpectExit'] } + $started = Get-Date $result = Invoke-BuildScript -Arguments $argv -Environment $Case['Env'] + $finished = Get-Date $problems = @() @@ -902,6 +899,15 @@ function Test-Case { $problems += "no line matching /$pattern/" } } + if ($Case['DateStampedZip']) { + # Bound the accepted dates to this invocation so crossing midnight is + # valid without allowing an unrelated past or future date. + $dateStamps = @($started.ToString('yyyyMMdd'), $finished.ToString('yyyyMMdd')) | Select-Object -Unique + $pattern = '_(' + ($dateStamps -join '|') + ')\.zip$' + if (@($lines | Where-Object { $_ -match $pattern }).Count -eq 0) { + $problems += "no line matching /$pattern/" + } + } foreach ($pattern in $Case['NotMatch']) { foreach ($line in @($lines | Where-Object { $_ -match $pattern })) { $problems += "line matches /$pattern/: $line" From e296d5daac1084babfc8988620383e9c02b76ed5 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 17:13:05 -0500 Subject: [PATCH 10/10] build: fix 9 defects found by clang-cl warnings (#15583) --- src/slic3r/GUI/Field.cpp | 3 ++- src/slic3r/GUI/GUI_App.cpp | 2 +- src/slic3r/GUI/GUI_Utils.cpp | 4 ++-- src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp | 2 +- src/slic3r/GUI/MediaPlayCtrl.cpp | 2 +- src/slic3r/GUI/Mouse3DController.cpp | 2 +- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 2 +- src/slic3r/Utils/Http.cpp | 4 +++- 9 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 142cf70522..b7564551f8 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -2711,7 +2711,8 @@ void ColourPicker::set_value(const boost::any& value, bool change_event) auto field = dynamic_cast(window); #ifdef __WXMSW__ - wxColour clr = (clr_str.IsEmpty() || !clr.IsOk()) ? wxTransparentColour : clr_str; + const wxColour parsed_clr(clr_str); + wxColour clr = (clr_str.IsEmpty() || !parsed_clr.IsOk()) ? wxTransparentColour : parsed_clr; field->SetColour(clr); draw_bmp_btn(field, clr); #else diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 3500493329..99a829bdcc 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -6808,7 +6808,7 @@ bool GUI_App::check_preset_parent_available(const std::pair>& preset_data) { - Preset::Type type; + Preset::Type type = Preset::Type::TYPE_INVALID; if (preset_data.second.at(BBL_JSON_KEY_TYPE) == PRESET_IOT_PRINT_TYPE) type = Preset::Type::TYPE_PRINT; else if (preset_data.second.at(BBL_JSON_KEY_TYPE) == PRESET_IOT_PRINTER_TYPE) diff --git a/src/slic3r/GUI/GUI_Utils.cpp b/src/slic3r/GUI/GUI_Utils.cpp index cb8ba45c6b..bc66d90ffd 100644 --- a/src/slic3r/GUI/GUI_Utils.cpp +++ b/src/slic3r/GUI/GUI_Utils.cpp @@ -102,7 +102,7 @@ CopyFileResult copy_file_gui(const std::string &from, const std::string &to, std result = ReadFile(handlesrc, buff, size, &dwRead, NULL); if (!result) { DWORD errCode = GetLastError(); - error_message = "Error: " + errCode; + error_message = "Error: " + std::to_string(errCode); ret = FAIL_COPY_FILE; goto __finished; } @@ -110,7 +110,7 @@ CopyFileResult copy_file_gui(const std::string &from, const std::string &to, std result = WriteFile(handledst,buff,size,&dwWrite,NULL); if (!result) { DWORD errCode = GetLastError(); - error_message = "Error: " + errCode; + error_message = "Error: " + std::to_string(errCode); ret = FAIL_COPY_FILE; goto __finished; } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp b/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp index 709e7b5b21..904e7d0a07 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp @@ -342,7 +342,7 @@ bool GLGizmoBrimEars::on_mouse(const wxMouseEvent& mouse_event) // concludes that the event was not intended for it, it should return false. bool GLGizmoBrimEars::gizmo_event(SLAGizmoEventType action, const Vec2d &mouse_position, bool shift_down, bool alt_down, bool control_down) { - if (action != SLAGizmoEventType::MouseWheelDown || action != SLAGizmoEventType::MouseWheelUp || action != SLAGizmoEventType::Moving) { + if (action != SLAGizmoEventType::MouseWheelDown && action != SLAGizmoEventType::MouseWheelUp && action != SLAGizmoEventType::Moving) { apply_radius_change(); } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index f190e1ad97..035fb895aa 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -122,7 +122,7 @@ bool GLGizmoFdmSupports::on_init() {ctrl + _L("Mouse wheel"), _L("Gap area")} }; - memset(&m_print_instance, 0, sizeof(m_print_instance)); + m_print_instance = PrintInstance(); return true; } diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index 0d75c3770d..29c8c9f664 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -71,7 +71,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl3 *media_ctrl, const w auto ip = str.find(' ', ik); if (ip == wxString::npos) ip = str.Length(); auto v = str.Mid(ik, ip - ik); - if (k == "T:" && v.Length() == 8) { + if (strcmp(k, "T:") == 0 && v.Length() == 8) { long h = 0,m = 0,s = 0; v.Left(2).ToLong(&h); v.Mid(3, 2).ToLong(&m); diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 11709501ac..8ed91d461f 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -498,7 +498,7 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 20.0f)); static ImVec2 last_win_size(0.0f, 0.0f); bool shown = true; - if (imgui.begin(_L("3Dconnexion settings"), &shown, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse || ImGuiWindowFlags_NoTitleBar)) { + if (imgui.begin(_L("3Dconnexion settings"), &shown, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar)) { if (shown) { ImVec2 win_size = ImGui::GetWindowSize(); if (last_win_size.x != win_size.x || last_win_size.y != win_size.y) { diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index c6973649b1..7f075dbbfa 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -678,7 +678,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : wxBoxSizer *loading_Sizer = new wxBoxSizer(wxHORIZONTAL); m_gif_ctrl = new wxAnimationCtrl(m_loading_page, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxDefaultSize, wxAC_DEFAULT_STYLE); - auto gif_path = Slic3r::var("loading.gif").c_str(); + const wxString gif_path = from_u8(Slic3r::var("loading.gif")); if (m_gif_ctrl->LoadFile(gif_path)){ m_gif_ctrl->SetSize(m_gif_ctrl->GetAnimation().GetSize()); m_gif_ctrl->Play(); diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 4d34d60d04..6f43df74e4 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -321,8 +321,10 @@ void Http::priv::form_add_file(const char *name, const fs::path &path, const cha // We can't use CURLFORM_FILECONTENT, because curl doesn't support Unicode filenames on Windows // and so we use CURLFORM_STREAM with boost ifstream to read the file. + std::string filename_str; if (filename == nullptr) { - filename = path.string().c_str(); + filename_str = path.string(); + filename = filename_str.c_str(); } form_files.emplace_back(path, offset, length);