mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Use Common::ToLower and Common::ToUpper
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -22,9 +21,8 @@ struct CaseInsensitiveStringCompare
|
||||
bool operator()(std::string_view a, std::string_view b) const
|
||||
{
|
||||
return std::lexicographical_compare(
|
||||
a.begin(), a.end(), b.begin(), b.end(), [](char lhs, char rhs) {
|
||||
return std::tolower(static_cast<u8>(lhs)) < std::tolower(static_cast<u8>(rhs));
|
||||
});
|
||||
a.begin(), a.end(), b.begin(), b.end(),
|
||||
[](char lhs, char rhs) { return Common::ToLower(lhs) < Common::ToLower(rhs); });
|
||||
}
|
||||
|
||||
static bool IsEqual(std::string_view a, std::string_view b)
|
||||
@ -33,7 +31,7 @@ struct CaseInsensitiveStringCompare
|
||||
return false;
|
||||
|
||||
return std::equal(a.begin(), a.end(), b.begin(), b.end(), [](char lhs, char rhs) {
|
||||
return std::tolower(static_cast<u8>(lhs)) == std::tolower(static_cast<u8>(rhs));
|
||||
return Common::ToLower(lhs) == Common::ToLower(rhs);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -101,8 +101,7 @@ static size_t DeterminePathCutOffPoint()
|
||||
constexpr const char* pattern2 = "\\source\\core\\";
|
||||
#endif
|
||||
std::string path = __FILE__;
|
||||
std::transform(path.begin(), path.end(), path.begin(),
|
||||
[](char c) { return std::tolower(c, std::locale::classic()); });
|
||||
Common::ToLower(&path);
|
||||
size_t pos = path.find(pattern);
|
||||
#ifdef _WIN32
|
||||
if (pos == std::string::npos)
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "Common/Network.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <string_view>
|
||||
|
||||
#ifndef _WIN32
|
||||
@ -18,6 +17,7 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/Random.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
@ -59,7 +59,7 @@ std::optional<MACAddress> StringToMacAddress(std::string_view mac_string)
|
||||
|
||||
for (size_t i = 0; i < mac_string.size() && x < (MAC_ADDRESS_SIZE * 2); ++i)
|
||||
{
|
||||
char c = tolower(mac_string.at(i));
|
||||
char c = Common::ToLower(mac_string.at(i));
|
||||
if (c >= '0' && c <= '9')
|
||||
{
|
||||
mac[x / 2] |= (c - '0') << ((x & 1) ? 0 : 4);
|
||||
|
Reference in New Issue
Block a user