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++;
}
else i += std::max(1, j - Last[ ptr[j] ]);
else i += std::max(ptrdiff_t(1), j - Last[ ptr[j] ]);
}
m_matched = true;

View File

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