You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
compare() takes into account string length and can not work as starts_with()
AFAIU this overload could work: int compare(const_pointer s, const size_type n) const
Because c_str() is guaranteed to be zero-terminated, result of prefix.compare(expanded_name.c_str(), prefix.length()) should do exactly the same what your code does if prefix is NoCaseString.
compare() takes into account string length and can not work as starts_with()
AFAIU this overload could work: int compare(const_pointer s, const size_type n) const Because c_str() is guaranteed to be zero-terminated, result of prefix.compare(expanded_name.c_str(), prefix.length()) should do exactly the same what your code does if prefix is NoCaseString.
It could access memory out of expanded_name buffer, if expanded_name.length() < prefix.length()
If you offer to replace just one string (IgnoreCaseComparator::compare), I see no value in it at all as it definitely doesn't make code "clear" - it passes into compare() one string with length of another one.
It could access memory out of expanded_name buffer, if expanded_name.length() < prefix.length()
Only if comparison is greedy and doesn't stop at the first different byte (which would be the expanded_name's terminating <NUL>).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.