fix bug whereby spice params with capital letters no longer cause an error and data loss

Spice parameters were converted to lower-case before comparison. This is incorrect, as it
is legal and common for spice parameters to contain capital letters (e.g. potentiometers
typically use Rt and SET as their parameters).
Spice parameters are not case sensitive, so the correct behaviour is to instead do a
case-insensitive comparison on the parameter name.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793
This commit is contained in:
Mark Visser 2023-05-21 17:50:35 -04:00
parent df763eaf88
commit 0d235ac64b
1 changed files with 2 additions and 4 deletions

View File

@ -44,7 +44,7 @@
#include <sim/sim_lib_mgr.h>
#include <sim/sim_library_kibis.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string.hpp>
#include <fmt/core.h>
#include <pegtl/contrib/parse_tree.hpp>
@ -802,13 +802,11 @@ const SIM_MODEL::PARAM& SIM_MODEL::GetParam( unsigned aParamIndex ) const
int SIM_MODEL::doFindParam( const std::string& aParamName ) const
{
std::string lowerParamName = boost::to_lower_copy( aParamName );
std::vector<std::reference_wrapper<const PARAM>> params = GetParams();
for( int ii = 0; ii < (int) params.size(); ++ii )
{
if( params[ii].get().info.name == lowerParamName )
if( boost::iequals( params[ii].get().info.name, aParamName ) )
return ii;
}