diff options
author | Neil <nyamatongwe@gmail.com> | 2018-01-28 09:10:00 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-01-28 09:10:00 +1100 |
commit | 1bd42ee98eff237cbc8e3856aa1e63ef5bc5b64a (patch) | |
tree | f056a21042b9c35d350b8356742baea9b4d333a8 | |
parent | 6141b5164e83cf1122027decd88829e735ba707d (diff) | |
download | scintilla-mirror-1bd42ee98eff237cbc8e3856aa1e63ef5bc5b64a.tar.gz |
Use std::end when filling arrays as reduces chance of mistake.
-rw-r--r-- | lexlib/WordList.cxx | 3 | ||||
-rw-r--r-- | scripts/HeaderOrder.txt | 1 | ||||
-rw-r--r-- | src/PositionCache.cxx | 5 | ||||
-rw-r--r-- | src/RESearch.cxx | 7 | ||||
-rw-r--r-- | src/XPM.cxx | 4 |
5 files changed, 13 insertions, 7 deletions
diff --git a/lexlib/WordList.cxx b/lexlib/WordList.cxx index f65b5ed48..425bcc01a 100644 --- a/lexlib/WordList.cxx +++ b/lexlib/WordList.cxx @@ -10,6 +10,7 @@ #include <cstring> #include <algorithm> +#include <iterator> #include "StringCopy.h" #include "WordList.h" @@ -128,7 +129,7 @@ void WordList::Set(const char *s) { #else SortWordList(words, len); #endif - std::fill(starts, starts + ELEMENTS(starts), -1); + std::fill(starts, std::end(starts), -1); for (int l = len - 1; l >= 0; l--) { unsigned char indexChar = words[l][0]; starts[indexChar] = l; diff --git a/scripts/HeaderOrder.txt b/scripts/HeaderOrder.txt index c16b7bdff..5eeb320eb 100644 --- a/scripts/HeaderOrder.txt +++ b/scripts/HeaderOrder.txt @@ -39,6 +39,7 @@ #include <set> #include <forward_list> #include <algorithm> +#include <iterator> #include <functional> #include <memory> #include <regex> diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 0b563f525..99e3c4d56 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -14,6 +14,7 @@ #include <vector> #include <map> #include <algorithm> +#include <iterator> #include <memory> #include "Platform.h" @@ -378,7 +379,7 @@ static inline int KeyFromString(const char *charBytes, size_t len) { } SpecialRepresentations::SpecialRepresentations() { - std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast<short>(0)); + std::fill(startByteHasReprs, std::end(startByteHasReprs), static_cast<short>(0)); } void SpecialRepresentations::SetRepresentation(const char *charBytes, const char *value) { @@ -419,7 +420,7 @@ bool SpecialRepresentations::Contains(const char *charBytes, size_t len) const { void SpecialRepresentations::Clear() { mapReprs.clear(); - std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast<short>(0)); + std::fill(startByteHasReprs, std::end(startByteHasReprs), static_cast<short>(0)); } void BreakFinder::Insert(int val) { diff --git a/src/RESearch.cxx b/src/RESearch.cxx index 31ee9aaac..f7ae04974 100644 --- a/src/RESearch.cxx +++ b/src/RESearch.cxx @@ -205,6 +205,7 @@ #include <stdexcept> #include <string> #include <algorithm> +#include <iterator> #include "Position.h" #include "CharClassify.h" @@ -254,9 +255,9 @@ RESearch::RESearch(CharClassify *charClassTable) { charClass = charClassTable; sta = NOP; /* status of lastpat */ bol = 0; - std::fill(bittab, bittab + BITBLK, static_cast<unsigned char>(0)); - std::fill(tagstk, tagstk + MAXTAG, 0); - std::fill(nfa, nfa + MAXNFA, '\0'); + std::fill(bittab, std::end(bittab), static_cast<unsigned char>(0)); + std::fill(tagstk, std::end(tagstk), 0); + std::fill(nfa, std::end(nfa), '\0'); Clear(); } diff --git a/src/XPM.cxx b/src/XPM.cxx index 0f314f35f..35bfc79aa 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -11,6 +11,8 @@ #include <stdexcept> #include <vector> #include <map> +#include <algorithm> +#include <iterator> #include <memory> #include "Platform.h" @@ -87,7 +89,7 @@ void XPM::Init(const char *const *linesForm) { if (!linesForm) return; - std::fill(colourCodeTable, colourCodeTable+256, 0); + std::fill(colourCodeTable, std::end(colourCodeTable), 0); const char *line0 = linesForm[0]; width = atoi(line0); line0 = NextField(line0); |