diff --git a/src/BaseException.cpp b/src/BaseException.cpp index 0bc5f71212..d51a750577 100644 --- a/src/BaseException.cpp +++ b/src/BaseException.cpp @@ -278,7 +278,7 @@ BOOL CBaseException::GetLogicalAddress( if ( !VirtualQuery( addr, &mbi, sizeof(mbi) ) ) return FALSE; - DWORD hMod = (DWORD)mbi.AllocationBase; + DWORD_PTR hMod = (DWORD_PTR)mbi.AllocationBase; if ( !GetModuleFileName( (HMODULE)hMod, szModule, len ) ) return FALSE; @@ -290,7 +290,7 @@ BOOL CBaseException::GetLogicalAddress( PIMAGE_NT_HEADERS pNtHdr = (PIMAGE_NT_HEADERS)(hMod + pDosHdr->e_lfanew); PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION( pNtHdr ); - DWORD rva = (DWORD)addr - hMod; + DWORD_PTR rva = (DWORD_PTR)addr - hMod; //���㵱ǰ��ַ�ڵڼ����� for (unsigned i = 0; i < pNtHdr->FileHeader.NumberOfSections; i++, pSection++ ) diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 37c778c3bf..fe9c0782dc 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1660,7 +1660,7 @@ public: ConfigOptionEnumsGenericTempl& operator= (const ConfigOption* opt) { this->set(opt); return *this; } bool operator< (const ConfigOptionInts& rhs) const throw() { return this->values < rhs.values; } - bool operator==(const ConfigOptionInts& rhs) const throw() + bool operator==(const ConfigOptionInts& rhs) const { if (rhs.type() != this->type()) throw ConfigurationError("ConfigOptionEnumsGeneric: Comparing incompatible types"); diff --git a/src/libslic3r/GCode/PostProcessor.cpp b/src/libslic3r/GCode/PostProcessor.cpp index e2ed3ed04f..ef20d6d3d8 100644 --- a/src/libslic3r/GCode/PostProcessor.cpp +++ b/src/libslic3r/GCode/PostProcessor.cpp @@ -214,7 +214,7 @@ void gcode_add_line_number(const std::string& path, const DynamicPrintConfig& co while (std::getline(fs, gcode_line)) { char num_str[128]; memset(num_str, 0, sizeof(num_str)); - snprintf(num_str, sizeof(num_str), "%d", line_number); + snprintf(num_str, sizeof(num_str), "%zd", line_number); new_gcode += std::string("N") + num_str + " " + gcode_line + "\n"; line_number++; } diff --git a/src/libslic3r/MeshSplitImpl.hpp b/src/libslic3r/MeshSplitImpl.hpp index f226a2276a..711923ce11 100644 --- a/src/libslic3r/MeshSplitImpl.hpp +++ b/src/libslic3r/MeshSplitImpl.hpp @@ -1,6 +1,12 @@ #ifndef MESHSPLITIMPL_HPP #define MESHSPLITIMPL_HPP +// Disable meaningless boost warning on MSVC +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4805 ) +#endif + #include "TriangleMesh.hpp" #include "libnest2d/tools/benchmark.h" #include "Execution/ExecutionTBB.hpp" @@ -268,4 +274,8 @@ std::vector create_face_neighbors_index(ExPolicy &&ex, const indexed_tria } // namespace Slic3r +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + #endif // MESHSPLITIMPL_HPP diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index d44e348139..bfa4a92b2a 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -3187,7 +3187,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg if (!ret) { BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":error parsing thin_fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; char error_buf[1024]; - ::sprintf(error_buf, "Error while parsing thin_fills at layer %d, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); + ::sprintf(error_buf, "Error while parsing thin_fills at layer %zd, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); throw Slic3r::FileIOError(error_buf); } } @@ -3242,7 +3242,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg if (!ret) { BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing perimeters found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; char error_buf[1024]; - ::sprintf(error_buf, "Error while parsing perimeters at layer %d, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); + ::sprintf(error_buf, "Error while parsing perimeters at layer %zd, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); throw Slic3r::FileIOError(error_buf); } } @@ -3257,7 +3257,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg if (!ret) { BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; char error_buf[1024]; - ::sprintf(error_buf, "Error while parsing fills at layer %d, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); + ::sprintf(error_buf, "Error while parsing fills at layer %zd, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); throw Slic3r::FileIOError(error_buf); } } @@ -3325,7 +3325,7 @@ void extract_support_layer(const json& support_layer_json, SupportLayer& support if (!ret) { BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at support_layer %1%, print_z %2%")%support_layer.id() %support_layer.print_z; char error_buf[1024]; - ::sprintf(error_buf, "Error while parsing fills at support_layer %d, print_z %f", support_layer.id(), support_layer.print_z); + ::sprintf(error_buf, "Error while parsing fills at support_layer %zd, print_z %f", support_layer.id(), support_layer.print_z); throw Slic3r::FileIOError(error_buf); } } diff --git a/src/mcut/CMakeLists.txt b/src/mcut/CMakeLists.txt index 66fc300a63..898a0a2019 100644 --- a/src/mcut/CMakeLists.txt +++ b/src/mcut/CMakeLists.txt @@ -148,7 +148,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" ST elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") list(APPEND compilation_flags w3 -diag-disable:remark) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - list(APPEND compilation_flags /W4 /wd26812 /bigobj) + list(APPEND compilation_flags /W4 /wd26812 /wd4131 /wd4704 /wd4245 /wd4297 /wd4505 /wd4701 /bigobj) list(APPEND preprocessor_defs -D_CRT_SECURE_NO_WARNINGS) endif() diff --git a/src/slic3r/GUI/IMSlider.cpp b/src/slic3r/GUI/IMSlider.cpp index 0f7325e18c..428659823e 100644 --- a/src/slic3r/GUI/IMSlider.cpp +++ b/src/slic3r/GUI/IMSlider.cpp @@ -1112,7 +1112,7 @@ void IMSlider::render_input_custom_gcode(std::string custom_gcode) } void IMSlider::do_go_to_layer(size_t layer_number) { - clamp((int)layer_number, m_min_value, m_max_value); + layer_number = clamp((int)layer_number, m_min_value, m_max_value); GetSelection() == ssLower ? SetLowerValue(layer_number) : SetHigherValue(layer_number); } @@ -1431,7 +1431,7 @@ std::string IMSlider::get_label(int tick, LabelType label_type) const size_t value = tick; if (m_label_koef == 1.0 && m_values.empty()) { - std::to_string(value); + return std::to_string(value); } if (value >= m_values.size()) return "error"; diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index fef7987e0f..4606e9184f 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -1009,7 +1009,7 @@ int GuideFrame::LoadProfile() //cout << iter->path().string() << endl; wxString strVendor = from_u8(iter->path().string()).BeforeLast('.'); strVendor = strVendor.AfterLast( '\\'); - strVendor = strVendor.AfterLast('\/'); + strVendor = strVendor.AfterLast('/'); wxString strExtension = from_u8(iter->path().string()).AfterLast('.').Lower(); if (w2s(strVendor) == PresetBundle::BBL_BUNDLE && strExtension.CmpNoCase("json") == 0) @@ -1028,7 +1028,7 @@ int GuideFrame::LoadProfile() //cout << iter->path().string() << endl; wxString strVendor = from_u8(iter->path().string()).BeforeLast('.'); strVendor = strVendor.AfterLast( '\\'); - strVendor = strVendor.AfterLast('\/'); + strVendor = strVendor.AfterLast('/'); wxString strExtension = from_u8(iter->path().string()).AfterLast('.').Lower(); if (w2s(strVendor) != PresetBundle::BBL_BUNDLE && strExtension.CmpNoCase("json")==0) @@ -1516,7 +1516,7 @@ std::string GuideFrame::w2s(wxString sSrc) void GuideFrame::GetStardardFilePath(std::string &FilePath) { StrReplace(FilePath, "\\", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator))); - StrReplace(FilePath, "\/", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator))); + StrReplace(FilePath, "/", w2s(wxString::Format("%c", boost::filesystem::path::preferred_separator))); } bool GuideFrame::LoadFile(std::string jPath, std::string &sContent) diff --git a/src/slic3r/GUI/calib_dlg.cpp b/src/slic3r/GUI/calib_dlg.cpp index 874e7f891d..57939faa9a 100644 --- a/src/slic3r/GUI/calib_dlg.cpp +++ b/src/slic3r/GUI/calib_dlg.cpp @@ -501,7 +501,7 @@ void MaxVolumetricSpeed_Test_Dlg::on_start(wxCommandEvent& event) { read_double = read_double && m_tiStep->GetTextCtrl()->GetValue().ToDouble(&m_params.step); if (!read_double || m_params.start <= 0 || m_params.step <= 0 || m_params.end < (m_params.start + m_params.step)) { - MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 0 \step >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 0 \nstep >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); return; } @@ -608,7 +608,7 @@ void VFA_Test_Dlg::on_start(wxCommandEvent& event) read_double = read_double && m_tiStep->GetTextCtrl()->GetValue().ToDouble(&m_params.step); if (!read_double || m_params.start <= 10 || m_params.step <= 0 || m_params.end < (m_params.start + m_params.step)) { - MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 10 \step >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 10 \nstep >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); return; } @@ -712,7 +712,7 @@ void Retraction_Test_Dlg::on_start(wxCommandEvent& event) { read_double = read_double && m_tiStep->GetTextCtrl()->GetValue().ToDouble(&m_params.step); if (!read_double || m_params.start < 0 || m_params.step <= 0 || m_params.end < (m_params.start + m_params.step)) { - MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 0 \step >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog msg_dlg(nullptr, _L("Please input valid values:\nstart > 0 \nstep >= 0\nend > start + step)"), wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); return; } diff --git a/src/slic3r/GUI/wxMediaCtrl2.cpp b/src/slic3r/GUI/wxMediaCtrl2.cpp index 82701862b7..43c1927145 100644 --- a/src/slic3r/GUI/wxMediaCtrl2.cpp +++ b/src/slic3r/GUI/wxMediaCtrl2.cpp @@ -113,8 +113,8 @@ void wxMediaCtrl2::Load(wxURI url) SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", quoted_dll_path.c_str(), SW_HIDE }; ::ShellExecuteEx(&info); fs::remove(reg_path); - } + return true; }); } else { CallAfter([] { diff --git a/src/slic3r/Utils/Bonjour.cpp b/src/slic3r/Utils/Bonjour.cpp index e357083816..0701695eff 100644 --- a/src/slic3r/Utils/Bonjour.cpp +++ b/src/slic3r/Utils/Bonjour.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include using boost::optional; using boost::system::error_code; diff --git a/src/slic3r/Utils/TCPConsole.cpp b/src/slic3r/Utils/TCPConsole.cpp index 3c943cc632..277e3c0d5c 100644 --- a/src/slic3r/Utils/TCPConsole.cpp +++ b/src/slic3r/Utils/TCPConsole.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -41,7 +41,7 @@ void TCPConsole::transmit_next_command() boost::asio::async_write( m_socket, boost::asio::buffer(m_send_buffer), - boost::bind(&TCPConsole::handle_write, this, _1, _2) + boost::bind(&TCPConsole::handle_write, this, boost::placeholders::_1, boost::placeholders::_2) ); } @@ -52,7 +52,7 @@ void TCPConsole::wait_next_line() m_socket, m_recv_buffer, m_newline, - boost::bind(&TCPConsole::handle_read, this, _1, _2) + boost::bind(&TCPConsole::handle_read, this, boost::placeholders::_1, boost::placeholders::_2) ); } @@ -157,7 +157,7 @@ bool TCPConsole::run_queue() auto endpoints = m_resolver.resolve(m_host_name, m_port_name); m_socket.async_connect(endpoints->endpoint(), - boost::bind(&TCPConsole::handle_connect, this, _1) + boost::bind(&TCPConsole::handle_connect, this, boost::placeholders::_1) ); // Loop until we get any reasonable result. Negative result is also result.