Simplify fp-info-cache escaping mechanism.
Fixes https://gitlab.com/kicad/code/kicad/issues/4969
This commit is contained in:
parent
9cc6a77cc0
commit
0e9714fdba
|
@ -82,15 +82,9 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
|||
else
|
||||
converted += c;
|
||||
}
|
||||
else if( aContext == CTX_DELIMITED_STR )
|
||||
else if( aContext == CTX_LINE )
|
||||
{
|
||||
if( c == '{' )
|
||||
converted += "{brace}";
|
||||
else if( c == ' ' )
|
||||
converted += "{space}";
|
||||
else if( c == '\t' )
|
||||
converted += "{tab}";
|
||||
else if( c == '\n' || c == '\r' )
|
||||
if( c == '\n' || c == '\r' )
|
||||
converted += "{return}";
|
||||
else
|
||||
converted += c;
|
||||
|
|
|
@ -47,7 +47,7 @@ enum ESCAPE_CONTEXT
|
|||
CTX_NETNAME,
|
||||
CTX_LIBID,
|
||||
CTX_QUOTED_STR,
|
||||
CTX_DELIMITED_STR,
|
||||
CTX_LINE,
|
||||
CTX_FILENAME
|
||||
};
|
||||
|
||||
|
|
|
@ -359,8 +359,8 @@ void FOOTPRINT_LIST_IMPL::WriteCacheToFile( wxTextFile* aCacheFile )
|
|||
{
|
||||
aCacheFile->AddLine( fpinfo->GetLibNickname() );
|
||||
aCacheFile->AddLine( fpinfo->GetName() );
|
||||
aCacheFile->AddLine( EscapeString( fpinfo->GetDescription(), CTX_DELIMITED_STR ) );
|
||||
aCacheFile->AddLine( EscapeString( fpinfo->GetKeywords(), CTX_DELIMITED_STR ) );
|
||||
aCacheFile->AddLine( EscapeString( fpinfo->GetDescription(), CTX_LINE ) );
|
||||
aCacheFile->AddLine( EscapeString( fpinfo->GetKeywords(), CTX_LINE ) );
|
||||
aCacheFile->AddLine( wxString::Format( "%d", fpinfo->GetOrderNum() ) );
|
||||
aCacheFile->AddLine( wxString::Format( "%u", fpinfo->GetPadCount() ) );
|
||||
aCacheFile->AddLine( wxString::Format( "%u", fpinfo->GetUniquePadCount() ) );
|
||||
|
|
Loading…
Reference in New Issue