Fixing GCC warnings 3

This commit is contained in:
Lukas Matena 2021-01-29 07:39:27 +01:00
parent 2d32c80b75
commit d9c9de8eee
15 changed files with 68 additions and 61 deletions

View file

@ -62,13 +62,13 @@ namespace fts {
}
// Public interface
static bool fuzzy_match(char_type const * pattern, char_type const * str, int & outScore) {
[[maybe_unused]] static bool fuzzy_match(char_type const * pattern, char_type const * str, int & outScore) {
pos_type matches[max_matches + 1]; // with the room for the stopper
matches[0] = stopper;
return fuzzy_match(pattern, str, outScore, matches);
}
static bool fuzzy_match(char_type const * pattern, char_type const * str, int & outScore, pos_type * matches) {
[[maybe_unused]] static bool fuzzy_match(char_type const * pattern, char_type const * str, int & outScore, pos_type * matches) {
int recursionCount = 0;
static constexpr int recursionLimit = 10;
return fuzzy_internal::fuzzy_match_recursive(pattern, str, outScore, str, nullptr, matches, 0, recursionCount, recursionLimit);
@ -114,14 +114,15 @@ namespace fts {
while (*pattern != '\0' && *str != '\0') {
int num_matched = std::towlower(*pattern) == std::towlower(*str) ? 1 : 0;
bool folded_match = false;
if (! num_matched) {
// bool folded_match = false;
if (! num_matched) {
wchar_t tmp[4];
wchar_t *end = Slic3r::fold_to_ascii(*str, tmp);
wchar_t *c = tmp;
for (const wchar_t* d = pattern; c != end && *d != 0 && std::towlower(*c) == std::towlower(*d); ++c, ++d);
if (c == end) {
folded_match = true;
// folded_match = true;
num_matched = end - tmp;
}
}
@ -169,7 +170,7 @@ namespace fts {
if (matched) {
static constexpr int sequential_bonus = 15; // bonus for adjacent matches
static constexpr int separator_bonus = 10/*30*/; // bonus if match occurs after a separator
static constexpr int camel_bonus = 30; // bonus if match is uppercase and prev is lower
// static constexpr int camel_bonus = 30; // bonus if match is uppercase and prev is lower
static constexpr int first_letter_bonus = 15; // bonus if the first letter is matched
static constexpr int leading_letter_penalty = -1/*-5*/; // penalty applied for every letter in str before the first match