src: switched isupper to iswupper and all similar functions (issue #598)
This commit is contained in:
@@ -639,11 +639,11 @@ bool BookmarkController::bookmarkNameCompare(const std::shared_ptr<Bookmark> 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;
|
||||
}
|
||||
|
||||
@@ -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<DummyNode> textNode = std::make_shared<DummyNode>(DummyNode::DUMMY_TEXT);
|
||||
textNode->name = character;
|
||||
|
||||
@@ -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<int> SuffixArray::buildLCP()
|
||||
std::vector<int> 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();
|
||||
|
||||
@@ -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<size_t>&
|
||||
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++;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user