Pcbnew: Fpid parser: Fix crash when reading a .kicad_pcb file containing a valid fpid with a revision value.

Fix an issue when a .kicad_pcb file contains an incorrect fpid ( containing a '/ ' in footprint section ) . After saving the board the file was no more readable, due to a broken fpid saved in file
(can happens in old .kicad_pcb files, coming from the bzr 4022 stable version, and/or in files converted from an other EDA tool like altium)
Fix 2 very minor coverity warnings.
This commit is contained in:
jean-pierre charras
2015-08-23 14:35:49 +02:00
parent 0386a4df94
commit bb3dc5771c
6 changed files with 33 additions and 15 deletions
+6 -2
View File
@@ -456,7 +456,7 @@ wxString GetIllegalFileNameWxChars()
}
bool ReplaceIllegalFileNameChars( std::string* aName )
bool ReplaceIllegalFileNameChars( std::string* aName, int aReplaceChar )
{
bool changed = false;
std::string result;
@@ -465,7 +465,11 @@ bool ReplaceIllegalFileNameChars( std::string* aName )
{
if( strchr( illegalFileNameChars, *it ) )
{
StrPrintf( &result, "%%%02x", *it );
if( aReplaceChar )
StrPrintf( &result, "%c", aReplaceChar );
else
StrPrintf( &result, "%%%02x", *it );
changed = true;
}
else