Fix some build warnings in the importer code.

This commit is contained in:
Wayne Stambaugh 2020-12-30 18:19:43 -05:00
parent 8d81abb57a
commit f6a1d703ec
2 changed files with 15 additions and 17 deletions

View File

@ -734,7 +734,7 @@ void CADSTAR_ARCHIVE_PARSER::SETTINGS::Parse( XNODE* aNode, PARSER_CONTEXT* aCon
wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_CONTEXT* aContext )
{
static const std::map<TEXT_FIELD_NAME, wxString> txtTokens =
static const std::map<TEXT_FIELD_NAME, wxString> txtTokens =
{
{ TEXT_FIELD_NAME::DESIGN_TITLE, wxT( "DESIGN TITLE" ) },
{ TEXT_FIELD_NAME::SHORT_JOBNAME, wxT( "SHORT_JOBNAME" ) },
@ -757,7 +757,7 @@ wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_C
{ TEXT_FIELD_NAME::UNITS_FULL, wxT( "UNITS FULL" ) },
{ TEXT_FIELD_NAME::HYPERLINK, wxT( "HYPERLINK" ) }
};
wxString remainingStr = aTextString;
wxString returnStr;
@ -767,7 +767,7 @@ wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_C
//Find the start token
size_t startpos = remainingStr.Find( wxT( "<@" ) );
if( startpos == wxNOT_FOUND )
if( static_cast<int>( startpos ) == wxNOT_FOUND )
{
// No more fields to parse, add to return string
returnStr += remainingStr;
@ -804,7 +804,7 @@ wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_C
//Now lets find the end token
size_t endpos = remainingStr.Find( wxT( "@>" ) );
if( endpos == wxNOT_FOUND )
if( static_cast<int>( endpos ) == wxNOT_FOUND )
{
// The field we found isn't valid as it doesn't have a termination
// Lets append the whole thing as plain text
@ -865,7 +865,7 @@ wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_C
aContext->TextFieldToValuesMap.insert( { foundField, fieldValue } );
}
KI_FALLTHROUGH;
KI_FALLTHROUGH;
case TEXT_FIELD_NAME::NUM_OF_SHEETS:
case TEXT_FIELD_NAME::SHEET_NUMBER:
@ -919,7 +919,7 @@ wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_C
if( ( endpos + 2 ) >= remainingStr.size() )
break;
remainingStr = remainingStr.Mid( endpos + 2 );
remainingStr = remainingStr.Mid( endpos + 2 );
}
return returnStr;

View File

@ -51,8 +51,9 @@
void KICAD_MANAGER_FRAME::ImportNonKiCadProject( wxString aWindowTitle, wxString aFilesWildcard,
wxString aSchFileExtension, wxString aPcbFileExtension, int aSchFileType, int aPcbFileType )
{
int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
wxString msg;
wxString default_dir = GetMruPath();
int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
ClearMsg();
@ -61,7 +62,6 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( wxString aWindowTitle, wxString
if( schdlg.ShowModal() == wxID_CANCEL )
return;
wxFileName sch( schdlg.GetPath() );
sch.SetExt( aSchFileExtension );
@ -87,10 +87,9 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( wxString aWindowTitle, wxString
if( directory.HasFiles() )
{
wxString msg =
_( "The selected directory is not empty. We recommend you "
"create projects in their own clean directory.\n\nDo you "
"want to create a new empty directory for the project?" );
msg = _( "The selected directory is not empty. We recommend you "
"create projects in their own clean directory.\n\nDo you "
"want to create a new empty directory for the project?" );
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxYES_NO | wxICON_WARNING );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
@ -113,17 +112,16 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( wxString aWindowTitle, wxString
if( !wxMkdir( pro.GetPath() ) )
{
wxString msg = _( "Error creating new directory. Please try a different path. The "
"project was not imported." );
msg = _( "Error creating new directory. Please try a different path. The "
"project was not imported." );
wxMessageDialog dlg( this, msg, _( "Error" ), wxOK_DEFAULT | wxICON_ERROR );
dlg.ShowModal();
wxMessageDialog dirErrorDlg( this, msg, _( "Error" ), wxOK_DEFAULT | wxICON_ERROR );
dirErrorDlg.ShowModal();
return;
}
}
}
std::string packet;
pro.SetExt( ProjectFileExtension );