Changeset a6ca1bc in mainline
- Timestamp:
- 2018-07-05T21:41:18Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 509738fd
- Parents:
- 6c089a9
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-11-02 17:38:55)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/string.hpp
r6c089a9 ra6ca1bc 1019 1019 size_type find(const value_type* str, size_type pos, size_type len) const noexcept 1020 1020 { 1021 if (empty() || len == 0 || len -pos > size())1021 if (empty() || len == 0 || len + pos > size()) 1022 1022 return npos; 1023 1023 … … 1060 1060 size_type rfind(const value_type* str, size_type pos, size_type len) const noexcept 1061 1061 { 1062 if (empty() || len == 0 || len -pos > size())1062 if (empty() || len == 0 || len + pos > size()) 1063 1063 return npos; 1064 1064 … … 1085 1085 return npos; 1086 1086 1087 for (size_type i = min(pos , size_ - 1) + 1; i > 0; --i)1087 for (size_type i = min(pos + 1, size_ - 1) + 1; i > 0; --i) 1088 1088 { 1089 1089 if (traits_type::eq(c, data_[i - 1])) … … 1101 1101 size_type find_first_of(const value_type* str, size_type pos, size_type len) const noexcept 1102 1102 { 1103 if (empty() || len == 0 || pos + len >size())1103 if (empty() || len == 0 || pos >= size()) 1104 1104 return npos; 1105 1105 … … 1133 1133 size_type find_last_of(const value_type* str, size_type pos, size_type len) const noexcept 1134 1134 { 1135 if (empty() )1135 if (empty() || len == 0) 1136 1136 return npos; 1137 1137 … … 1162 1162 size_type find_first_not_of(const value_type* str, size_type pos, size_type len) const noexcept 1163 1163 { 1164 if (empty() || len == 0 || pos + len >size())1164 if (empty() || pos >= size()) 1165 1165 return npos; 1166 1166 … … 1179 1179 size_type find_first_not_of(const value_type* str, size_type pos = 0) const noexcept 1180 1180 { 1181 return find_first_not_of(str .c_str(), pos, str.size());1181 return find_first_not_of(str, pos, traits_type::length(str)); 1182 1182 } 1183 1183 … … 1208 1208 for (size_type i = min(pos, size_ - 1) + 1; i > 0; --i) 1209 1209 { 1210 if (!is_ one_of_(i - 1, str, len))1210 if (!is_any_of_(i - 1, str, len)) 1211 1211 return i - 1; 1212 1212 } … … 1387 1387 } 1388 1388 1389 bool is_one_of_(size_type idx, const basic_string& str) const 1390 { 1391 auto cstr = str.c_str(); 1392 for (size_type i = 0; i < str.size(); ++i) 1393 { 1394 if (traits_type::eq(data_[idx], cstr[i])) 1389 bool is_any_of_(size_type idx, const value_type* str, size_type len) const 1390 { 1391 for (size_type i = 0; i < len; ++i) 1392 { 1393 if (traits_type::eq(data_[idx], str[i])) 1395 1394 return true; 1396 1395 }
Note:
See TracChangeset
for help on using the changeset viewer.