1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# HG changeset patch
# User Neil <nyamatongwe@gmail.com>
# 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 <cstring>
#include <algorithm>
+#include <iterator>
#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 <set>
#include <forward_list>
#include <algorithm>
+#include <iterator>
#include <functional>
#include <memory>
#include <regex>
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 <vector>
#include <map>
#include <algorithm>
+#include <iterator>
#include "Platform.h"
@@ -378,7 +379,7 @@
}
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 @@
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 -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 <stdexcept>
#include <string>
#include <algorithm>
+#include <iterator>
#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<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 -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 <stdexcept>
#include <vector>
#include <map>
+#include <algorithm>
+#include <iterator>
#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);
|