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
(cherry picked from commit 0d235ac64b
)
This commit is contained in:
parent
ad9109cad4
commit
888a35bbde
|
@ -44,7 +44,7 @@
|
||||||
#include <sim/sim_lib_mgr.h>
|
#include <sim/sim_lib_mgr.h>
|
||||||
#include <sim/sim_library_kibis.h>
|
#include <sim/sim_library_kibis.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <pegtl/contrib/parse_tree.hpp>
|
#include <pegtl/contrib/parse_tree.hpp>
|
||||||
|
|
||||||
|
@ -816,13 +816,11 @@ const SIM_MODEL::PARAM& SIM_MODEL::GetParam( unsigned aParamIndex ) const
|
||||||
|
|
||||||
int SIM_MODEL::doFindParam( const std::string& aParamName ) 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();
|
std::vector<std::reference_wrapper<const PARAM>> params = GetParams();
|
||||||
|
|
||||||
for( int ii = 0; ii < (int) params.size(); ++ii )
|
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;
|
return ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue