Revert "use std::tolower"

This reverts commit a3db4128bc.

This broke the build.
This commit is contained in:
ridiculousfish 2019-09-22 15:33:08 -07:00
parent a3db4128bc
commit 91c4dad812
5 changed files with 16 additions and 6 deletions

View File

@ -633,7 +633,7 @@ class wildcard_matcher_t : public string_matcher_t {
io_streams_t &streams)
: string_matcher_t(opts, streams), wcpattern(parse_util_unescape_wildcards(pattern)) {
if (opts.ignore_case) {
wcpattern = std::tolower(std::move(wcpattern));
wcpattern = wcstolower(std::move(wcpattern));
}
if (opts.entire) {
if (!wcpattern.empty()) {
@ -654,7 +654,7 @@ class wildcard_matcher_t : public string_matcher_t {
bool match;
if (opts.ignore_case) {
match = wildcard_match(std::tolower(arg), wcpattern, false);
match = wildcard_match(wcstolower(arg), wcpattern, false);
} else {
match = wildcard_match(arg, wcpattern, false);
}

View File

@ -79,9 +79,9 @@ enum : wchar_t {
VARIABLE_EXPAND,
/// Character representing variable expansion into a single element.
VARIABLE_EXPAND_SINGLE,
/// Character representing the start of a brace expansion.
/// Character representing the start of a bracket expansion.
BRACE_BEGIN,
/// Character representing the end of a brace expansion.
/// Character representing the end of a bracket expansion.
BRACE_END,
/// Character representing separation between two bracket elements.
BRACE_SEP,

View File

@ -22,7 +22,6 @@
#include <cwchar>
#include <functional>
#include <iterator>
#include <locale>
#include <map>
#include <numeric>
#include <type_traits>
@ -181,7 +180,7 @@ bool history_item_t::matches_search(const wcstring &term, enum history_search_ty
// search object if we're doing a case insensitive search.
wcstring contents_lower;
if (!case_sensitive) {
contents_lower = std::tolower(contents);
contents_lower = wcstolower(contents);
}
const wcstring &content_to_match = case_sensitive ? contents : contents_lower;

View File

@ -4,6 +4,8 @@
#include "common.h"
#include "wcstringutil.h"
#include <wctype.h>
typedef wcstring::size_type size_type;
wcstring_range wcstring_tok(wcstring &str, const wcstring &needle, wcstring_range last) {
@ -62,3 +64,9 @@ wcstring trim(wcstring input, const wchar_t *any_of) {
result.erase(0, prefix);
return result;
}
wcstring wcstolower(wcstring input) {
wcstring result = std::move(input);
std::transform(result.begin(), result.end(), result.begin(), towlower);
return result;
}

View File

@ -68,4 +68,7 @@ wcstring truncate(const wcstring &input, int max_len,
wcstring trim(wcstring input);
wcstring trim(wcstring input, const wchar_t *any_of);
/// Converts a string to lowercase.
wcstring wcstolower(wcstring input);
#endif