From f10635e8be47039c1301e0c01d64dc3e6d3b4aa6 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 27 Sep 2018 13:49:38 +0100 Subject: [PATCH] More work on arbitrary characters in references, etc. --- common/string.cpp | 12 ++++++++++-- include/kicad_string.h | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/common/string.cpp b/common/string.cpp index 1d1d8bef6c..dadb87f601 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -487,8 +487,12 @@ bool ApplyModifier( double& value, const wxString& aString ) // // TODO: case (d) unimplemented !!! // -int ValueStringCompare( const wxString& strFWord, const wxString& strSWord ) +int ValueStringCompare( wxString strFWord, wxString strSWord ) { + // Compare unescaped text + strFWord = UnescapeString( strFWord ); + strSWord = UnescapeString( strSWord ); + // The different sections of the two strings wxString strFWordBeg, strFWordMid, strFWordEnd; wxString strSWordBeg, strSWordMid, strSWordEnd; @@ -531,8 +535,12 @@ int ValueStringCompare( const wxString& strFWord, const wxString& strSWord ) } -int RefDesStringCompare( const wxString& strFWord, const wxString& strSWord ) +int RefDesStringCompare( wxString strFWord, wxString strSWord ) { + // Compare unescaped text + strFWord = UnescapeString( strFWord ); + strSWord = UnescapeString( strSWord ); + // The different sections of the two strings wxString strFWordBeg, strFWordMid, strFWordEnd; wxString strSWordBeg, strSWordMid, strSWordEnd; diff --git a/include/kicad_string.h b/include/kicad_string.h index e499fa9336..d93b49cabe 100644 --- a/include/kicad_string.h +++ b/include/kicad_string.h @@ -146,7 +146,7 @@ bool WildCompareString( const wxString& pattern, * return 0 if the strings are equal * return 1 if the first string is greater than the second */ -int ValueStringCompare( const wxString& strFWord, const wxString& strSWord ); +int ValueStringCompare( wxString strFWord, wxString strSWord ); /** * Function RefDesStringCompare @@ -156,7 +156,7 @@ int ValueStringCompare( const wxString& strFWord, const wxString& strSWord ); * return 0 if the strings are equal * return 1 if the first string is greater than the second */ -int RefDesStringCompare( const wxString& lhs, const wxString& rhs ); +int RefDesStringCompare( wxString lhs, wxString rhs ); /** * Function SplitString