diff options
author | Neil <nyamatongwe@gmail.com> | 2021-10-12 12:00:48 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-10-12 12:00:48 +1100 |
commit | 40e479ba4f68d442fe0552c2551422e884085cdd (patch) | |
tree | f30b3585f36be4492d29c85f0f1d8a1f1014d1f1 | |
parent | 8c07d7f5b68ccb39469dcde13d6d401c3ebb35b4 (diff) | |
download | scintilla-mirror-40e479ba4f68d442fe0552c2551422e884085cdd.tar.gz |
Feature [feature-requests:#1416] Use range for.
-rw-r--r-- | src/Editor.cxx | 6 | ||||
-rw-r--r-- | src/PositionCache.cxx | 6 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 493146455..485eaef87 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -772,9 +772,9 @@ void Editor::MultipleSelectAdd(AddNumber addNumber) { searchRanges.push_back(rangeTarget); } - for (std::vector<Range>::const_iterator it = searchRanges.begin(); it != searchRanges.end(); ++it) { - Sci::Position searchStart = it->start; - const Sci::Position searchEnd = it->end; + for (const Range range : searchRanges) { + Sci::Position searchStart = range.start; + const Sci::Position searchEnd = range.end; for (;;) { Sci::Position lengthFound = selectedText.length(); const Sci::Position pos = pdoc->FindText(searchStart, searchEnd, diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index e57cb572a..af1c5065c 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -548,10 +548,8 @@ namespace { constexpr unsigned int KeyFromString(std::string_view charBytes) noexcept { PLATFORM_ASSERT(charBytes.length() <= 4); unsigned int k=0; - for (size_t i=0; i < charBytes.length(); i++) { - k = k * 0x100; - const unsigned char uc = charBytes[i]; - k += uc; + for (const unsigned char uc : charBytes) { + k = k * 0x100 + uc; } return k; } |