diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-08-25 18:48:34 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-08-25 18:48:34 +0200 |
commit | 0a26a319b241978ee317bbe768eb61c4eb7a39d9 (patch) | |
tree | bfa56141b5140c1f25c81925d5fc616012bd22a3 /src/NetUtils.cpp | |
parent | 48da6508416dd80c68c9213a242a2542af2574fe (diff) |
Faster mangakatana search on exact match
Diffstat (limited to 'src/NetUtils.cpp')
-rw-r--r-- | src/NetUtils.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/NetUtils.cpp b/src/NetUtils.cpp index 0f957d5..9cf88c7 100644 --- a/src/NetUtils.cpp +++ b/src/NetUtils.cpp @@ -311,7 +311,7 @@ namespace QuickMedia { std::string result; string_split(header, '\n', [&type, &result](const char *str, size_t size) { while(size > 0 && (*str == ' ' || *str == '\t')) { ++str; --size; } - if(size < type.size() || strncasecmp(str, type.c_str(), type.size()) != 0 || size == type.size()) + if(size < type.size() || !strncase_equals(str, type.c_str(), type.size()) || size == type.size()) return true; str += type.size(); @@ -325,7 +325,9 @@ namespace QuickMedia { str += (colon_offset + 1); size -= (colon_offset + 1); + // lstrip space while(size > 0 && (*str == ' ' || *str == '\t')) { ++str; --size; } + // rstrip whitespace while(size > 0 && (str[size - 1] == ' ' || str[size - 1] == '\t' || str[size - 1] == '\r' || str[size - 1] == '\n')) { --size; } result.assign(str, size); |