Don't include null terminator in pattern string_view

This commit is contained in:
Silent 2017-04-27 17:36:05 +02:00
parent ace01292eb
commit fa1d50b62c
2 changed files with 4 additions and 4 deletions

View file

@ -223,7 +223,7 @@ void pattern::EnsureMatches(uint32_t maxCount)
} }
i++; i++;
} }
else i += std::max(1, j - Last[ ptr[j] ]); else i += std::max(ptrdiff_t(1), j - Last[ ptr[j] ]);
} }
m_matched = true; m_matched = true;

View file

@ -117,7 +117,7 @@ namespace hook
pattern(const char (&pattern)[Len]) pattern(const char (&pattern)[Len])
: pattern(getRVA<void>(0)) : pattern(getRVA<void>(0))
{ {
Initialize(pattern, Len); Initialize(pattern, Len-1);
} }
inline pattern& count(uint32_t expected) & inline pattern& count(uint32_t expected) &
@ -203,7 +203,7 @@ namespace hook
module_pattern(void* module, const char(&pattern)[Len]) module_pattern(void* module, const char(&pattern)[Len])
: pattern(module) : pattern(module)
{ {
Initialize(pattern, Len); Initialize(pattern, Len-1);
} }
}; };
@ -215,7 +215,7 @@ namespace hook
range_pattern(uintptr_t begin, uintptr_t end, const char(&pattern)[Len]) range_pattern(uintptr_t begin, uintptr_t end, const char(&pattern)[Len])
: pattern(begin, end) : pattern(begin, end)
{ {
Initialize(pattern, Len); Initialize(pattern, Len-1);
} }
}; };