This commit is contained in:
Eelco Dolstra 2021-11-18 12:12:31 +01:00
parent acf381b061
commit 262a3c7ce3

View file

@ -54,12 +54,12 @@ void RefScanSink::operator () (std::string_view data)
fragment, so search in the concatenation of the tail of the fragment, so search in the concatenation of the tail of the
previous fragment and the start of the current fragment. */ previous fragment and the start of the current fragment. */
auto s = tail; auto s = tail;
s.append(data.data(), std::min(data.size(), refLength)); auto tailLen = std::min(data.size(), refLength);
s.append(data.data(), tailLen);
search(s, hashes, seen); search(s, hashes, seen);
search(data, hashes, seen); search(data, hashes, seen);
auto tailLen = std::min(data.size(), refLength);
auto rest = refLength - tailLen; auto rest = refLength - tailLen;
if (rest < tail.size()) if (rest < tail.size())
tail = tail.substr(tail.size() - rest); tail = tail.substr(tail.size() - rest);