Cherry pick of line-ending-safety fix from 5.1.

Fixes: lp:1842943
* https://bugs.launchpad.net/kicad/+bug/1842943
This commit is contained in:
Jeff Young 2019-09-07 03:13:08 +01:00
parent 1ac6cbc4a6
commit a612fb690b
3 changed files with 12 additions and 3 deletions

View File

@ -337,7 +337,12 @@ bool doPrintFile( const wxString& file, bool aDryRun )
}
#endif
DisplayError( NULL, wxString::Format( _( "Cannot print '%s'.\n\nUnknown filetype." ), file ) );
if( !aDryRun )
{
DisplayError( nullptr, wxString::Format( _( "Cannot print '%s'.\n\nUnknown filetype." ),
file ) );
}
return false;
}

View File

@ -246,8 +246,12 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )
}
std::string EscapedUTF8( const wxString& aString )
std::string EscapedUTF8( wxString aString )
{
// No new-lines allowed in quoted strings
aString.Replace( "\r\n", "\r" );
aString.Replace( "\n", "\r" );
std::string utf8 = TO_UTF8( aString );
std::string ret;

View File

@ -87,7 +87,7 @@ int ReadDelimitedText( wxString* aDest, const char* aSource );
* @param aString is the input string to convert.
* @return std::string - the escaped input text, without the wrapping double quotes.
*/
std::string EscapedUTF8( const wxString& aString );
std::string EscapedUTF8( wxString aString );
/**
* Return a new wxString escaped for embedding in HTML.