diff options
author | 2020-01-25 17:41:14 +0100 | |
---|---|---|
committer | 2020-01-25 21:12:01 +0100 | |
commit | 9431ee68e78aa0fe5164bfa7466f35ebd02f560d (patch) | |
tree | 3a8d8cea0d90c665f4b786f23cbc657bcd01939f /src/lib/netlist/plib/pstring.h | |
parent | 334e367d4de45f66ea2209034272a41b4e52a792 (diff) |
netlist: clang lint fixes, srcclean and nlwav fix. (nw)
Diffstat (limited to 'src/lib/netlist/plib/pstring.h')
-rw-r--r-- | src/lib/netlist/plib/pstring.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h index 43cdf5f7e32..29f8fe2e6da 100644 --- a/src/lib/netlist/plib/pstring.h +++ b/src/lib/netlist/plib/pstring.h @@ -174,7 +174,7 @@ public: size_type length() const noexcept { return traits_type::len(m_str); } size_type size() const noexcept { return traits_type::len(m_str); } - bool empty() const noexcept { return m_str.size() == 0; } + bool empty() const noexcept { return m_str.empty(); } pstring_t substr(size_type start, size_type nlen = npos) const; int compare(const pstring_t &right) const noexcept; @@ -317,7 +317,9 @@ struct putf8_traits const mem_t *p1 = p; std::size_t i = n; while (i-- > 0) + { p1 += codelen(p1); + } return p1; } }; @@ -336,7 +338,9 @@ struct putf16_traits // FIXME: check that size is equal auto c = static_cast<uint16_t>(*i++); if (!((c & 0xd800) == 0xd800)) + { ret++; + } } return ret; } @@ -347,10 +351,7 @@ struct putf16_traits } static std::size_t codelen(const code_t c) noexcept { - if (c < 0x10000) - return 1; - else // U+10000 U+1FFFFF - return 2; + return (c < 0x10000) ? 1 : 2; // U+10000 U+1FFFFF } static code_t code(const mem_t *p) noexcept { @@ -381,7 +382,9 @@ struct putf16_traits { std::size_t i = n; while (i-- > 0) + { p += codelen(p); + } return p; } }; |