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/ppreprocessor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/netlist/plib/ppreprocessor.cpp') diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp index 320cbe23857..c203fea1753 100644 --- a/src/lib/netlist/plib/ppreprocessor.cpp +++ b/src/lib/netlist/plib/ppreprocessor.cpp @@ -245,10 +245,10 @@ namespace plib { else { pstring tok=tmp[pi]; - if (tok.size() >= 2 && pi < tmp.size() - 2 ) + if (tok.length() >= 2 && pi < tmp.size() - 2 ) { auto sc=tok.substr(0,1); - auto ec=tok.substr(tok.size()-1, 1); + auto ec=tok.substr(tok.length()-1, 1); if ((sc == "." || (sc>="0" && sc<="9")) && (ec=="e" || ec=="E")) { // looks like an incomplete float due splitting by - or + @@ -496,7 +496,7 @@ namespace plib { { bool line_cont = plib::right(line_in, 1) == "\\"; - pstring line = line_cont ? plib::left(line_in, line_in.size() - 1) : line_in; + pstring line = line_cont ? plib::left(line_in, line_in.length() - 1) : line_in; if (m_state == LINE_CONTINUATION) m_line += line; -- cgit v1.2.3-70-g09d2