From 7c556742205b99000421b89803fd68d8644ff872 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 27 Feb 2020 17:01:50 +0100 Subject: [PATCH] Disabled implicit conversion of wxString to std::string or const char* and vice versa. Fixed one last implicit wxString conversion. --- CMakeLists.txt | 3 +++ src/slic3r/GUI/GLCanvas3D.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4e686645..9c69052c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,6 +227,9 @@ endif(WIN32) add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO) +# Disable unsafe implicit wxString to const char* / std::string and vice versa. This implicit conversion breaks the UTF-8 encoding quite often. +add_definitions(-DwxNO_UNSAFE_WXSTRING_CONV) + if (SLIC3R_PROFILE) message("PrusaSlicer will be built with a Shiny invasive profiler") add_definitions(-DSLIC3R_PROFILE) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index adc1e2e44..1ccebbabb 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -734,7 +734,7 @@ static void msw_disable_cleartype(wxFont &font) ++ startpos_weight; size_t endpos_weight = font_desc.find(sep, startpos_weight); // Parse the weight field. - unsigned int weight = atoi(font_desc(startpos_weight, endpos_weight - startpos_weight)); + unsigned int weight = wxAtoi(font_desc(startpos_weight, endpos_weight - startpos_weight)); size_t startpos = endpos_weight; for (size_t i = 0; i < 6; ++ i) startpos = font_desc.find(sep, startpos + 1);