# HG changeset patch # User Neil # Date 1517091000 -39600 # Node ID a366ce1a811e322b24f08a20825947113d39d698 # Parent 5dd1b26df75f0ffa20624a61d1b77d24406ba048 Use std::end when filling arrays as reduces chance of mistake. diff -r 5dd1b26df75f -r a366ce1a811e lexlib/WordList.cxx --- a/lexlib/WordList.cxx Sun Jan 28 08:57:56 2018 +1100 +++ b/lexlib/WordList.cxx Sun Jan 28 09:10:00 2018 +1100 @@ -10,6 +10,7 @@ #include #include +#include #include "StringCopy.h" #include "WordList.h" @@ -128,7 +129,7 @@ #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 -r 5dd1b26df75f -r a366ce1a811e scripts/HeaderOrder.txt --- a/scripts/HeaderOrder.txt Sun Jan 28 08:57:56 2018 +1100 +++ b/scripts/HeaderOrder.txt Sun Jan 28 09:10:00 2018 +1100 @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff -r 5dd1b26df75f -r a366ce1a811e src/PositionCache.cxx --- a/src/PositionCache.cxx Sun Jan 28 08:57:56 2018 +1100 +++ b/src/PositionCache.cxx Sun Jan 28 09:10:00 2018 +1100 @@ -14,5 +14,6 @@ #include #include #include +#include #include "Platform.h" @@ -378,7 +379,7 @@ } SpecialRepresentations::SpecialRepresentations() { - std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast(0)); + std::fill(startByteHasReprs, std::end(startByteHasReprs), static_cast(0)); } void SpecialRepresentations::SetRepresentation(const char *charBytes, const char *value) { @@ -419,7 +420,7 @@ void SpecialRepresentations::Clear() { mapReprs.clear(); - std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast(0)); + std::fill(startByteHasReprs, std::end(startByteHasReprs), static_cast(0)); } void BreakFinder::Insert(int val) { diff -r 5dd1b26df75f -r a366ce1a811e src/RESearch.cxx --- a/src/RESearch.cxx Sun Jan 28 08:57:56 2018 +1100 +++ b/src/RESearch.cxx Sun Jan 28 09:10:00 2018 +1100 @@ -205,6 +205,7 @@ #include #include #include +#include #include "Position.h" #include "CharClassify.h" @@ -254,9 +255,9 @@ charClass = charClassTable; sta = NOP; /* status of lastpat */ bol = 0; - std::fill(bittab, bittab + BITBLK, static_cast(0)); - std::fill(tagstk, tagstk + MAXTAG, 0); - std::fill(nfa, nfa + MAXNFA, '\0'); + std::fill(bittab, std::end(bittab), static_cast(0)); + std::fill(tagstk, std::end(tagstk), 0); + std::fill(nfa, std::end(nfa), '\0'); Clear(); } diff -r 5dd1b26df75f -r a366ce1a811e src/XPM.cxx --- a/src/XPM.cxx Sun Jan 28 08:57:56 2018 +1100 +++ b/src/XPM.cxx Sun Jan 28 09:10:00 2018 +1100 @@ -11,5 +11,7 @@ #include #include #include +#include +#include #include "Platform.h" @@ -87,7 +89,7 @@ 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);