#include "references.hh" #include "hash.hh" #include "util.hh" #include "archive.hh" #include #include namespace nix { static unsigned int refLength = 32; /* characters */ static void search(const unsigned char * s, unsigned int len, StringSet & hashes, StringSet & seen) { static bool initialised = false; static bool isBase32[256]; if (!initialised) { for (unsigned int i = 0; i < 256; ++i) isBase32[i] = false; for (unsigned int i = 0; i < base32Chars.size(); ++i) isBase32[(unsigned char) base32Chars[i]] = true; initialised = true; } for (unsigned int i = 0; i + refLength <= len; ) { int j; bool match = true; for (j = refLength - 1; j >= 0; --j) if (!isBase32[(unsigned char) s[i + j]]) { i += j + 1; match = false; break; } if (!match) continue; string ref((const char *) s + i, refLength); if (hashes.find(ref) != hashes
aboutsummaryrefslogtreecommitdiff
blob: da4c3ddf04c2d5965fbd6a631137c6d4da375bdb (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22