summaryrefslogtreecommitdiff
path: root/src/mongo/db/fts
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2020-10-09 20:50:38 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-13 19:30:17 +0000
commitff37b70553dbfd0b2aaeabb8a29c4d492507a9d3 (patch)
tree728b9266de70d79901eed31b0e39de0abc78cf24 /src/mongo/db/fts
parentbbe604a5b3f94f78a30a76941ea89c0ca5db14d2 (diff)
downloadmongo-ff37b70553dbfd0b2aaeabb8a29c4d492507a9d3.tar.gz
SERVER-50917 util/ctype.h to replace <cctype> & <ctype.h> funcs
Diffstat (limited to 'src/mongo/db/fts')
-rw-r--r--src/mongo/db/fts/fts_language.cpp6
-rw-r--r--src/mongo/db/fts/unicode/string_test.cpp5
2 files changed, 5 insertions, 6 deletions
diff --git a/src/mongo/db/fts/fts_language.cpp b/src/mongo/db/fts/fts_language.cpp
index a2765d350d2..654817cd261 100644
--- a/src/mongo/db/fts/fts_language.cpp
+++ b/src/mongo/db/fts/fts_language.cpp
@@ -30,7 +30,6 @@
#include "mongo/db/fts/fts_language.h"
#include <algorithm>
-#include <cctype>
#include <fmt/format.h>
#include <map>
#include <memory>
@@ -45,6 +44,7 @@
#include "mongo/db/fts/fts_unicode_phrase_matcher.h"
#include "mongo/db/fts/fts_unicode_tokenizer.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/ctype.h"
namespace mongo::fts {
@@ -59,8 +59,8 @@ using namespace fmt::literals;
struct LanguageStringCompare {
bool operator()(StringData a, StringData b) const {
return std::lexicographical_compare(
- a.begin(), a.end(), b.begin(), b.end(), [](unsigned char a, unsigned char b) {
- return std::tolower(a) < std::tolower(b);
+ a.begin(), a.end(), b.begin(), b.end(), [](char a, char b) {
+ return ctype::toLower(a) < ctype::toLower(b);
});
}
};
diff --git a/src/mongo/db/fts/unicode/string_test.cpp b/src/mongo/db/fts/unicode/string_test.cpp
index a2943877b28..00931a22a10 100644
--- a/src/mongo/db/fts/unicode/string_test.cpp
+++ b/src/mongo/db/fts/unicode/string_test.cpp
@@ -29,11 +29,10 @@
#include "mongo/platform/basic.h"
-#include <cctype>
-
#include "mongo/db/fts/unicode/string.h"
#include "mongo/shell/linenoise_utf8.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/ctype.h"
#include "mongo/util/text.h"
#ifdef MSC_VER
@@ -114,7 +113,7 @@ TEST(UnicodeString, CaseFolding) {
// Test all ascii chars.
for (unsigned char ch = 0; ch <= 0x7F; ch++) {
const auto upper = std::string(1, ch);
- const auto lower = std::string(1, std::tolower(ch));
+ const auto lower = std::string(1, ctype::toLower(ch));
if (ch) { // String's constructor doesn't handle embedded NUL bytes.
ASSERT_EQUALS(lower, String(upper).toLowerToBuf(&buf, kNormal));
}