From f6a1d703ec6f3265f46c5c4fb46290b8b66d9aa1 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Wed, 30 Dec 2020 18:19:43 -0500 Subject: [PATCH] Fix some build warnings in the importer code. --- .../cadstar/cadstar_archive_parser.cpp | 12 +++++------ kicad/import_project.cpp | 20 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/common/plugins/cadstar/cadstar_archive_parser.cpp b/common/plugins/cadstar/cadstar_archive_parser.cpp index 7753b9bcf4..4d35b40dde 100644 --- a/common/plugins/cadstar/cadstar_archive_parser.cpp +++ b/common/plugins/cadstar/cadstar_archive_parser.cpp @@ -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 txtTokens = + static const std::map 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( 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( 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; diff --git a/kicad/import_project.cpp b/kicad/import_project.cpp index 30a32bb959..e109d195dc 100644 --- a/kicad/import_project.cpp +++ b/kicad/import_project.cpp @@ -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 );