7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-30 06:36:55 +00:00

Fix Coverity issue and all related issues.

Don't use fmt::format() when formatting wxString objects.  It will throw
an exception on an argument type mismatch which isn't handled in most
code paths.

This also prevents the conversion of the fmt::format() arguments from
wxString to std::string and the result from std::string back to wxString
for the return value.

https://scan8.scan.coverity.com/#/project-view/22886/10844?selectedIssue=545159
This commit is contained in:
Wayne Stambaugh 2025-03-20 11:16:02 -04:00
parent b567532af7
commit f5cae044d0

View File

@ -275,7 +275,7 @@ bool LIB_ID::isLegalLibraryNameChar( unsigned aUniChar )
const wxString LIB_ID::GetFullLibraryName() const
{
if( m_subLibraryName.empty() )
return m_libraryName.c_str();
return m_libraryName;
return fmt::format( "{} - {}", m_libraryName.c_str(), m_subLibraryName.c_str() );
return wxString::Format( wxS( "%s - %s" ), m_libraryName.c_str(), m_subLibraryName.c_str() );
}