diff --git a/srcbpatch/streamreplacer.cpp b/srcbpatch/streamreplacer.cpp index 41d55f5..41a9be6 100644 --- a/srcbpatch/streamreplacer.cpp +++ b/srcbpatch/streamreplacer.cpp @@ -263,7 +263,7 @@ class ChoiceReplacer final : public ReplacerWithNext vector rpairs_; mutable size_t cachedAmount_ = 0; // we cache this amount of data - mutable size_t indexOfCached_ = 0; // at this index from rpairs_ + mutable size_t indexOfPartialMatch = 0; // at this index from rpairs_, represents last partial match // this is used to hold temporary data while the logic is // looking for the new beginning of the cached value @@ -287,7 +287,7 @@ void ChoiceReplacer::ProcessLastCharacter(const char toProcess) const while (cachedAmount_ > 0) { bool foundFullMatch = false; - for (size_t i = indexOfCached_; i < rpairs_.size(); ++i) + for (size_t i = indexOfPartialMatch; i < rpairs_.size(); ++i) { auto [partialMatch, fullMatch, srcMatchedLength, destStringIdx] = CheckMatch(i); if (fullMatch) @@ -314,7 +314,7 @@ void ChoiceReplacer::ProcessCharacter(const char toProcess) const buffer_[cachedAmount_++] = toProcess; while (cachedAmount_ > 0) { - for (size_t i = indexOfCached_; i < rpairs_.size(); ++i) + for (size_t i = indexOfPartialMatch; i < rpairs_.size(); ++i) { auto [partialMatch, fullMatch, srcMatchedLength, matchPairIdx] = CheckMatch(i); if (fullMatch) @@ -325,7 +325,7 @@ void ChoiceReplacer::ProcessCharacter(const char toProcess) const } if (partialMatch) { - indexOfCached_ = matchPairIdx; + indexOfPartialMatch = matchPairIdx; return; } } @@ -341,7 +341,7 @@ inline void ChoiceReplacer::MakeReplace(span target) const { pNext_->DoReplacements(elem, false); } - indexOfCached_ = 0; + indexOfPartialMatch = 0; } inline void ChoiceReplacer::CleanTheCache(size_t srcMatchedLength) const