diff options
author | 2020-09-24 07:53:56 +0200 | |
---|---|---|
committer | 2020-09-24 15:22:25 +0200 | |
commit | 0acb9992f4c73db6f865ed89411ce4db20cee9f2 (patch) | |
tree | 21203310f91c9590da371e2826395e75eb00d99a /src/lib/netlist/nl_setup.cpp | |
parent | dd5769bea9d3ef209c5cd46507ef6d4800ee1ccf (diff) |
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.
Diffstat (limited to 'src/lib/netlist/nl_setup.cpp')
-rw-r--r-- | src/lib/netlist/nl_setup.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 9af1ec92d51..3a2ba38d921 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -1305,7 +1305,7 @@ void models_t::model_parse(const pstring &model_in, map_t &map) if (!plib::endsWith(remainder, ")")) throw nl_exception(MF_MODEL_ERROR_1(model)); // FIMXE: Not optimal - remainder = plib::left(remainder, remainder.size() - 1); + remainder = plib::left(remainder, remainder.length() - 1); const auto pairs(plib::psplit(remainder,' ', true)); for (const pstring &pe : pairs) @@ -1353,7 +1353,7 @@ nl_fptype models_t::model_t::value(const pstring &entity) const pstring tmp = value_str(entity); nl_fptype factor = nlconst::one(); - auto p = std::next(tmp.begin(), plib::narrow_cast<pstring::difference_type>(tmp.size() - 1)); + auto p = std::next(tmp.begin(), plib::narrow_cast<pstring::difference_type>(tmp.length() - 1)); switch (*p) { case 'M': factor = nlconst::magic(1e6); break; // NOLINT @@ -1370,7 +1370,7 @@ nl_fptype models_t::model_t::value(const pstring &entity) const throw nl_exception(MF_UNKNOWN_NUMBER_FACTOR_IN_2(m_model, entity)); } if (factor != nlconst::one()) - tmp = plib::left(tmp, tmp.size() - 1); + tmp = plib::left(tmp, tmp.length() - 1); // FIXME: check for errors bool err(false); auto val = plib::pstonum_ne<nl_fptype>(tmp, err); |