summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/tests/genhashcheck.py
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-29 03:00:39 +0000
committerNorbert Preining <norbert@preining.info>2019-10-29 03:00:39 +0000
commit97f5151099967e6c823d640a90d87bca92c44035 (patch)
tree685caa49488599f87d0caa4e972833b2263d8567 /dviware/dvisvgm/tests/genhashcheck.py
parent25a647b97ef526aefcc75269dd19c46dbe3ae4c1 (diff)
CTAN sync 201910290300
Diffstat (limited to 'dviware/dvisvgm/tests/genhashcheck.py')
-rwxr-xr-xdviware/dvisvgm/tests/genhashcheck.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/dviware/dvisvgm/tests/genhashcheck.py b/dviware/dvisvgm/tests/genhashcheck.py
index 8f391fe733..f7ac46c488 100755
--- a/dviware/dvisvgm/tests/genhashcheck.py
+++ b/dviware/dvisvgm/tests/genhashcheck.py
@@ -29,6 +29,7 @@ if (len(sys.argv) < 2):
print("""\
#include <xxhash.h>
#include <cstdint>
+#include <iterator>
#include <iomanip>
#include <iostream>
#include <string>
@@ -44,15 +45,14 @@ extract_hashes(sys.argv[1])
print(r"""};
int main () {
- uint32_t prev_hash=0;
- size_t size = sizeof(nameHashes)/sizeof(NameHash);
- if (size == 0) {
+ if (distance(begin(nameHashes), end(nameHashes)) == 0) {
cout << "hash table is empty\n";
return 1;
}
- for (size_t i=0; i < size; i++) {
- const string &name = nameHashes[i].name;
- const uint32_t hash = nameHashes[i].hash;
+ uint32_t prev_hash=0;
+ for (NameHash &nameHash : nameHashes) {
+ const string &name = nameHash.name;
+ const uint32_t hash = nameHash.hash;
if (XXH32(&name[0], name.length(), 0) != hash) {
cout << "hash of '" << name << "' doesn't match\n";
return 1;