Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to_lower(wchar_t) and to_upper(wchar_t) #2360

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix to_lower(wchar_t) and to_upper(wchar_t)
  • Loading branch information
AntoinePrv committed Mar 8, 2023
commit e3cc1838be28c12a36d914697047b903e0b83ba4
23 changes: 12 additions & 11 deletions libmamba/src/core/util_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,20 @@ namespace mamba

wchar_t to_lower(wchar_t c)
{
return static_cast<wchar_t>(std::tolower(c));
return static_cast<wchar_t>(std::towlower(static_cast<wint_t>(c)));
}

char to_upper(char c)
{
return static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
}

wchar_t to_upper(wchar_t c)
{
return static_cast<wchar_t>(std::towupper(static_cast<wint_t>(c)));
}


/***************************************************
* Implementation of to_lower to_upper functions *
***************************************************/
Expand Down Expand Up @@ -169,16 +180,6 @@ namespace mamba
template std::string to_lower(std::string&& str);
template std::wstring to_lower(std::wstring&& str);

char to_upper(char c)
{
return static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
}

wchar_t to_upper(wchar_t c)
{
return static_cast<wchar_t>(std::toupper(c));
}

namespace
{
template <typename Char>
Expand Down