From 021eb2f3a86569710a31193df9f87bdd82493f54 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 16 Feb 2020 10:21:36 +0100 Subject: [PATCH] Fix incorrect usage of a UTF8 char in a C string in code. Using a UTF8 char inside a C string can work on unix, but not on Windows. It must be explicitly converted in a unicode value inside a wide string (like a wxString) --- common/lib_tree_model_adapter.h | 10 ++++++++++ eeschema/symbol_tree_synchronizing_adapter.cpp | 2 +- pcbnew/fp_tree_synchronizing_adapter.cpp | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/lib_tree_model_adapter.h b/common/lib_tree_model_adapter.h index d325ec347d..b9aef9bba5 100644 --- a/common/lib_tree_model_adapter.h +++ b/common/lib_tree_model_adapter.h @@ -336,6 +336,16 @@ protected: unsigned int aCol, wxDataViewItemAttr& aAttr ) const override; + /** + * @return a unicode string to mark a node name like + * a pinned library name + * This is not an ascii7 char, but a unicode char + */ + const wxString GetPinningSymbol() const + { + return wxString::FromUTF8( "☆ " ); + } + private: EDA_BASE_FRAME* m_parent; diff --git a/eeschema/symbol_tree_synchronizing_adapter.cpp b/eeschema/symbol_tree_synchronizing_adapter.cpp index 04c1b57fe1..dfab5e2e68 100644 --- a/eeschema/symbol_tree_synchronizing_adapter.cpp +++ b/eeschema/symbol_tree_synchronizing_adapter.cpp @@ -216,7 +216,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie aVariant = node->m_Name; if( node->m_Pinned ) - aVariant = "☆ " + node->m_Name; + aVariant = GetPinningSymbol() + node->m_Name; // mark modified libs with an asterisk if( node->m_Type == LIB_TREE_NODE::LIB && m_libMgr->IsLibraryModified( node->m_Name ) ) diff --git a/pcbnew/fp_tree_synchronizing_adapter.cpp b/pcbnew/fp_tree_synchronizing_adapter.cpp index e572d9cbba..0d474088b3 100644 --- a/pcbnew/fp_tree_synchronizing_adapter.cpp +++ b/pcbnew/fp_tree_synchronizing_adapter.cpp @@ -184,7 +184,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte aVariant = currentFPName; } else if( node->m_Pinned ) - aVariant = "☆ " + node->m_Name; + aVariant = GetPinningSymbol() + node->m_Name; else aVariant = node->m_Name; break;