diff --git a/src/lib/component/controller/BookmarkController.cpp b/src/lib/component/controller/BookmarkController.cpp index 078195da..f565cb64 100644 --- a/src/lib/component/controller/BookmarkController.cpp +++ b/src/lib/component/controller/BookmarkController.cpp @@ -639,11 +639,11 @@ bool BookmarkController::bookmarkNameCompare(const std::shared_ptr a, unsigned int i = 0; while (i < aName.length() && i < bName.length()) { - if (std::tolower(aName[i]) < std::tolower(bName[i])) + if (std::towlower(aName[i]) < std::towlower(bName[i])) { return true; } - else if (std::tolower(aName[i]) > std::tolower(bName[i])) + else if (std::towlower(aName[i]) > std::towlower(bName[i])) { return false; } diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index f4480a16..c77191e4 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -1403,9 +1403,9 @@ void GraphController::addCharacterIndex() continue; } - if (toupper(m_dummyNodes[i]->name[0]) != character) + if (towupper(m_dummyNodes[i]->name[0]) != character) { - character = toupper(m_dummyNodes[i]->name[0]); + character = towupper(m_dummyNodes[i]->name[0]); std::shared_ptr textNode = std::make_shared(DummyNode::DUMMY_TEXT); textNode->name = character; diff --git a/src/lib/data/fulltextsearch/SuffixArray.cpp b/src/lib/data/fulltextsearch/SuffixArray.cpp index 33786ece..c86de417 100644 --- a/src/lib/data/fulltextsearch/SuffixArray.cpp +++ b/src/lib/data/fulltextsearch/SuffixArray.cpp @@ -17,7 +17,7 @@ int SuffixArray::cmp(const struct suffix& a, const struct suffix& b) SuffixArray::SuffixArray(const std::wstring& text) : m_text(text) { - std::transform(m_text.begin(), m_text.end(), m_text.begin(), ::tolower); + std::transform(m_text.begin(), m_text.end(), m_text.begin(), ::towlower); m_array = buildSuffixArray(); m_lcp = buildLCP(); } @@ -77,7 +77,7 @@ std::vector SuffixArray::buildLCP() std::vector SuffixArray::searchForTerm(const std::wstring& searchTerm) const { std::wstring term = searchTerm; - std::transform(term.begin(), term.end(), term.begin(), ::tolower); + std::transform(term.begin(), term.end(), term.begin(), ::towlower); int termLength = term.length(); int textLength = m_text.length(); diff --git a/src/lib/data/search/SearchIndex.cpp b/src/lib/data/search/SearchIndex.cpp index 3bbfdc7e..c79c0af7 100644 --- a/src/lib/data/search/SearchIndex.cpp +++ b/src/lib/data/search/SearchIndex.cpp @@ -142,7 +142,7 @@ void SearchIndex::populateEdgeGate(SearchEdge* e) } for (size_t i = 0; i < e->s.size(); i++) { - e->gate.insert(tolower(e->s[i])); + e->gate.insert(towlower(e->s[i])); } } @@ -184,7 +184,7 @@ void SearchIndex::searchRecursive( size_t j = 0; for (size_t i = 0; i < edgeString.size() && j < remainingQuery.size(); i++) { - if (tolower(edgeString[i]) == remainingQuery[j]) + if (towlower(edgeString[i]) == remainingQuery[j]) { currentPath.indices.push_back(path.text.size() + i); j++; @@ -418,10 +418,10 @@ int SearchIndex::scoreText(const std::wstring& text, const std::vector& noLetterScore += noLetterBonus; } // camel case - else if (isupper(text[index])) + else if (iswupper(text[index])) { - bool prevIsLower = (index > 0 && islower(text[index - 1])); - bool nextIsLower = (index + 1 < text.size() && islower(text[index + 1])); + bool prevIsLower = (index > 0 && iswlower(text[index - 1])); + bool nextIsLower = (index + 1 < text.size() && iswlower(text[index + 1])); if (prevIsLower || nextIsLower) { @@ -482,7 +482,7 @@ SearchResult SearchIndex::rescoreText( for (size_t i = 0; i < textSize && idx < indices.size(); i++) { - if (tolower(text[i]) == tolower(fulltext[indices[idx]])) + if (towlower(text[i]) == towlower(fulltext[indices[idx]])) { textIndices.push_back(i); idx++; diff --git a/src/lib/data/search/SearchMatch.cpp b/src/lib/data/search/SearchMatch.cpp index dc7a7fd1..5521f9b4 100644 --- a/src/lib/data/search/SearchMatch.cpp +++ b/src/lib/data/search/SearchMatch.cpp @@ -154,9 +154,9 @@ bool SearchMatch::operator<(const SearchMatch& other) const // lower case for (size_t i = 0; i < str->size(); i++) { - if (tolower(str->at(i)) != tolower(otherStr->at(i))) + if (towlower(str->at(i)) != towlower(otherStr->at(i))) { - return tolower(str->at(i)) < tolower(otherStr->at(i)); + return towlower(str->at(i)) < towlower(otherStr->at(i)); } else { diff --git a/src/lib_license/License.cpp b/src/lib_license/License.cpp index f7e67913..90e18fb4 100644 --- a/src/lib_license/License.cpp +++ b/src/lib_license/License.cpp @@ -37,7 +37,7 @@ std::string trim(const std::string &str) std::string toLowerCase(const std::string& in) { std::string out; - std::transform(in.begin(), in.end(), std::back_inserter(out), tolower); + std::transform(in.begin(), in.end(), std::back_inserter(out), towlower); return out; } diff --git a/src/lib_utility/utility/utilityString.cpp b/src/lib_utility/utility/utilityString.cpp index c953b66b..6bf882df 100644 --- a/src/lib_utility/utility/utilityString.cpp +++ b/src/lib_utility/utility/utilityString.cpp @@ -254,6 +254,13 @@ namespace utility return out; } + std::wstring toUpperCase(const std::wstring& in) + { + std::wstring out; + std::transform(in.begin(), in.end(), std::back_inserter(out), towupper); + return out; + } + std::string toLowerCase(const std::string& in) { std::string out; @@ -264,7 +271,7 @@ namespace utility std::wstring toLowerCase(const std::wstring& in) { std::wstring out; - std::transform(in.begin(), in.end(), std::back_inserter(out), tolower); + std::transform(in.begin(), in.end(), std::back_inserter(out), towlower); return out; } diff --git a/src/lib_utility/utility/utilityString.h b/src/lib_utility/utility/utilityString.h index 1ebd149a..9ffb294c 100644 --- a/src/lib_utility/utility/utilityString.h +++ b/src/lib_utility/utility/utilityString.h @@ -59,6 +59,7 @@ namespace utility bool isPostfix(const StringType& postfix, const StringType& text); std::string toUpperCase(const std::string& in); + std::wstring toUpperCase(const std::wstring& in); std::string toLowerCase(const std::string& in); std::wstring toLowerCase(const std::wstring& in);