From 0acb9992f4c73db6f865ed89411ce4db20cee9f2 Mon Sep 17 00:00:00 2001 From: couriersud Date: Thu, 24 Sep 2020 07:53:56 +0200 Subject: netlist: make pstring length/size use consistent. * length reports the number of character codes in the string * size reports the size in memory units * Reminder: Set PSTRING_USE_STD_STRING to 1 in pstring.h and get native std::string * pstrings are compatible to std::string but only support a limited subset of functionality. * By default (always like this) utf8 is supported and thus length reports the number of multi-byte characters. --- src/lib/netlist/plib/pfunction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/netlist/plib/pfunction.cpp') diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp index 5a00844becc..3ab937735cf 100644 --- a/src/lib/netlist/plib/pfunction.cpp +++ b/src/lib/netlist/plib/pfunction.cpp @@ -143,7 +143,7 @@ namespace plib { if (r == units_si().end()) rc.m_param.val = plib::pstonum_ne(cmd, err); else - rc.m_param.val = plib::pstonum_ne(plib::left(cmd, cmd.size()-1), err) * r->second; + rc.m_param.val = plib::pstonum_ne(plib::left(cmd, cmd.length()-1), err) * r->second; if (err) throw pexception(plib::pfmt("pfunction: unknown/misformatted token <{1}> in <{2}>")(cmd)(expr)); stk += 1; -- cgit v1.2.3-70-g09d2