mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
strat: compat with gcc 11
This commit is contained in:
parent
4f16106702
commit
21f3d29df7
11 changed files with 26 additions and 21 deletions
|
@ -58,7 +58,7 @@ namespace ams::kvdb {
|
||||||
|
|
||||||
/* Getters. */
|
/* Getters. */
|
||||||
size_t GetLength() const {
|
size_t GetLength() const {
|
||||||
return strnlen(this->buffer, N);
|
return util::Strnlen(this->buffer, N);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Get() const {
|
const char *Get() const {
|
||||||
|
@ -72,7 +72,7 @@ namespace ams::kvdb {
|
||||||
/* Setters. */
|
/* Setters. */
|
||||||
void Set(const char *s) {
|
void Set(const char *s) {
|
||||||
/* Ensure string can fit in our buffer. */
|
/* Ensure string can fit in our buffer. */
|
||||||
CheckLength(strnlen(s, N));
|
CheckLength(util::Strnlen(s, N));
|
||||||
std::strncpy(this->buffer, s, N);
|
std::strncpy(this->buffer, s, N);
|
||||||
this->buffer[N - 1] = 0;
|
this->buffer[N - 1] = 0;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ namespace ams::kvdb {
|
||||||
/* Append to existing. */
|
/* Append to existing. */
|
||||||
void Append(const char *s) {
|
void Append(const char *s) {
|
||||||
const size_t length = GetLength();
|
const size_t length = GetLength();
|
||||||
CheckLength(length + strnlen(s, N));
|
CheckLength(length + util::Strnlen(s, N));
|
||||||
std::strncat(this->buffer, s, N - length - 1);
|
std::strncat(this->buffer, s, N - length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ namespace ams::kvdb {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EndsWith(const char *s) const {
|
bool EndsWith(const char *s) const {
|
||||||
const size_t suffix_length = strnlen(s, N);
|
const size_t suffix_length = util::Strnlen(s, N);
|
||||||
const size_t length = GetLength();
|
const size_t length = GetLength();
|
||||||
return suffix_length <= length && EndsWith(s, length - suffix_length);
|
return suffix_length <= length && EndsWith(s, length - suffix_length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace ams::tipc {
|
||||||
constexpr inline u16 MethodId_CloseSession = 0xF;
|
constexpr inline u16 MethodId_CloseSession = 0xF;
|
||||||
|
|
||||||
class ObjectManagerBase {
|
class ObjectManagerBase {
|
||||||
private:
|
protected:
|
||||||
struct Entry {
|
struct Entry {
|
||||||
util::TypedStorage<WaitableObject> object;
|
util::TypedStorage<WaitableObject> object;
|
||||||
os::WaitableHolderType waitable_holder;
|
os::WaitableHolderType waitable_holder;
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace ams {
|
||||||
StackFrame cur_frame;
|
StackFrame cur_frame;
|
||||||
svc::lp64::MemoryInfo mem_info;
|
svc::lp64::MemoryInfo mem_info;
|
||||||
svc::PageInfo page_info;
|
svc::PageInfo page_info;
|
||||||
if (R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), cur_fp)) && (mem_info.perm & Perm_R) == Perm_R) {
|
if (R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), cur_fp)) && (mem_info.perm & svc::MemoryPermission_Read) == svc::MemoryPermission_Read) {
|
||||||
std::memcpy(&cur_frame, reinterpret_cast<void *>(cur_fp), sizeof(cur_frame));
|
std::memcpy(&cur_frame, reinterpret_cast<void *>(cur_fp), sizeof(cur_frame));
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -136,7 +136,7 @@ namespace ams {
|
||||||
{
|
{
|
||||||
svc::lp64::MemoryInfo mem_info;
|
svc::lp64::MemoryInfo mem_info;
|
||||||
svc::PageInfo page_info;
|
svc::PageInfo page_info;
|
||||||
if (R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), ams_ctx.sp)) && (mem_info.perm & Perm_R) == Perm_R) {
|
if (R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), ams_ctx.sp)) && (mem_info.perm & svc::MemoryPermission_Read) == svc::MemoryPermission_Read) {
|
||||||
size_t copy_size = std::min(FatalErrorContext::MaxStackDumpSize, static_cast<size_t>(mem_info.addr + mem_info.size - ams_ctx.sp));
|
size_t copy_size = std::min(FatalErrorContext::MaxStackDumpSize, static_cast<size_t>(mem_info.addr + mem_info.size - ams_ctx.sp));
|
||||||
ams_ctx.stack_dump_size = copy_size;
|
ams_ctx.stack_dump_size = copy_size;
|
||||||
std::memcpy(ams_ctx.stack_dump, reinterpret_cast<void *>(ams_ctx.sp), copy_size);
|
std::memcpy(ams_ctx.stack_dump, reinterpret_cast<void *>(ams_ctx.sp), copy_size);
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace ams::fs {
|
||||||
virtual Result GenerateCommonMountName(char *dst, size_t dst_size) override {
|
virtual Result GenerateCommonMountName(char *dst, size_t dst_size) override {
|
||||||
/* Determine how much space we need. */
|
/* Determine how much space we need. */
|
||||||
const char *bis_mount_name = GetBisMountName(this->id);
|
const char *bis_mount_name = GetBisMountName(this->id);
|
||||||
const size_t needed_size = strnlen(bis_mount_name, MountNameLengthMax) + 2;
|
const size_t needed_size = util::Strnlen(bis_mount_name, MountNameLengthMax) + 2;
|
||||||
AMS_ABORT_UNLESS(dst_size >= needed_size);
|
AMS_ABORT_UNLESS(dst_size >= needed_size);
|
||||||
|
|
||||||
/* Generate the name. */
|
/* Generate the name. */
|
||||||
|
|
|
@ -219,10 +219,11 @@ namespace ams::htcs::client {
|
||||||
sf::SharedPointer<tma::ISocket> socket = nullptr;
|
sf::SharedPointer<tma::ISocket> socket = nullptr;
|
||||||
|
|
||||||
/* Find the socket. */
|
/* Find the socket. */
|
||||||
|
s32 index;
|
||||||
{
|
{
|
||||||
std::scoped_lock lk(m_mutex);
|
std::scoped_lock lk(m_mutex);
|
||||||
|
|
||||||
if (auto index = this->Find(id, std::addressof(error_code)); index >= 0) {
|
if (index = this->Find(id, std::addressof(error_code)); index >= 0) {
|
||||||
/* Get the socket's object. */
|
/* Get the socket's object. */
|
||||||
VirtualSocket *virt_socket = m_socket_list + index;
|
VirtualSocket *virt_socket = m_socket_list + index;
|
||||||
socket = virt_socket->m_socket;
|
socket = virt_socket->m_socket;
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
namespace ams::i2c::driver::board::nintendo::nx::impl {
|
namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||||
|
|
||||||
class I2cBusAccessorManager : public IAllocator<I2cBusAccessor::BusAccessorList> {
|
class I2cBusAccessorManager : public IAllocator<I2cBusAccessor::BusAccessorList> {
|
||||||
/* ... */
|
public:
|
||||||
|
using IAllocator<I2cBusAccessor::BusAccessorList>::IAllocator;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
namespace ams::i2c::driver::board::nintendo::nx::impl {
|
namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||||
|
|
||||||
class I2cDevicePropertyManager : public IAllocator<I2cDeviceProperty::DevicePropertyList> {
|
class I2cDevicePropertyManager : public IAllocator<I2cDeviceProperty::DevicePropertyList> {
|
||||||
/* ... */
|
public:
|
||||||
|
using IAllocator<I2cDeviceProperty::DevicePropertyList>::IAllocator;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
|
||||||
|
|
||||||
template<typename ListType>
|
template<typename ListType>
|
||||||
class IAllocator {
|
class IAllocator {
|
||||||
|
NON_COPYABLE(IAllocator);
|
||||||
|
NON_MOVEABLE(IAllocator);
|
||||||
private:
|
private:
|
||||||
using T = typename ListType::value_type;
|
using T = typename ListType::value_type;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -20,9 +20,9 @@ namespace ams::mem::impl {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
os::Mutex g_virt_mem_enabled_lock(false);
|
constinit os::SdkMutex g_virt_mem_enabled_lock;
|
||||||
bool g_virt_mem_enabled_detected;
|
constinit bool g_virt_mem_enabled_detected = false;
|
||||||
bool g_virt_mem_enabled;
|
constinit bool g_virt_mem_enabled = false;
|
||||||
|
|
||||||
void EnsureVirtualAddressMemoryDetected() {
|
void EnsureVirtualAddressMemoryDetected() {
|
||||||
std::scoped_lock lk(g_virt_mem_enabled_lock);
|
std::scoped_lock lk(g_virt_mem_enabled_lock);
|
||||||
|
@ -48,7 +48,8 @@ namespace ams::mem::impl {
|
||||||
ALWAYS_INLINE os::MemoryPermission ConvertToOsPermission(Prot prot) {
|
ALWAYS_INLINE os::MemoryPermission ConvertToOsPermission(Prot prot) {
|
||||||
static_assert(static_cast<int>(Prot_read) == static_cast<int>(os::MemoryPermission_ReadOnly));
|
static_assert(static_cast<int>(Prot_read) == static_cast<int>(os::MemoryPermission_ReadOnly));
|
||||||
static_assert(static_cast<int>(Prot_write) == static_cast<int>(os::MemoryPermission_WriteOnly));
|
static_assert(static_cast<int>(Prot_write) == static_cast<int>(os::MemoryPermission_WriteOnly));
|
||||||
return static_cast<os::MemoryPermission>(prot & os::MemoryPermission_ReadWrite);
|
static_assert((util::ToUnderlying(Prot_read) | util::ToUnderlying(Prot_write)) == util::ToUnderlying(os::MemoryPermission_ReadWrite));
|
||||||
|
return static_cast<os::MemoryPermission>(prot & (Prot_read | Prot_write));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,7 +477,6 @@ namespace ams::pinmux::driver::board::nintendo::nx {
|
||||||
u32 reg_address;
|
u32 reg_address;
|
||||||
u32 reg_mask;
|
u32 reg_mask;
|
||||||
u32 reg_value;
|
u32 reg_value;
|
||||||
u8 safe_func;
|
|
||||||
const char *pad_name;
|
const char *pad_name;
|
||||||
private:
|
private:
|
||||||
bool IsValidRegisterAddress() const {
|
bool IsValidRegisterAddress() const {
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ams::dmnt::cheat::impl {
|
||||||
|
|
||||||
class FrozenAddressMapEntry : public util::IntrusiveRedBlackTreeBaseNode<FrozenAddressMapEntry> {
|
class FrozenAddressMapEntry : public util::IntrusiveRedBlackTreeBaseNode<FrozenAddressMapEntry> {
|
||||||
public:
|
public:
|
||||||
using LightCompareType = u64;
|
using RedBlackKeyType = u64;
|
||||||
private:
|
private:
|
||||||
u64 m_address;
|
u64 m_address;
|
||||||
FrozenAddressValue m_value;
|
FrozenAddressValue m_value;
|
||||||
|
@ -40,7 +40,7 @@ namespace ams::dmnt::cheat::impl {
|
||||||
constexpr const FrozenAddressValue &GetValue() const { return m_value; }
|
constexpr const FrozenAddressValue &GetValue() const { return m_value; }
|
||||||
constexpr FrozenAddressValue &GetValue() { return m_value; }
|
constexpr FrozenAddressValue &GetValue() { return m_value; }
|
||||||
|
|
||||||
static constexpr ALWAYS_INLINE int Compare(const LightCompareType &lval, const FrozenAddressMapEntry &rhs) {
|
static constexpr ALWAYS_INLINE int Compare(const RedBlackKeyType &lval, const FrozenAddressMapEntry &rhs) {
|
||||||
const auto rval = rhs.GetAddress();
|
const auto rval = rhs.GetAddress();
|
||||||
|
|
||||||
if (lval < rval) {
|
if (lval < rval) {
|
||||||
|
@ -603,7 +603,7 @@ namespace ams::dmnt::cheat::impl {
|
||||||
|
|
||||||
R_TRY(this->EnsureCheatProcess());
|
R_TRY(this->EnsureCheatProcess());
|
||||||
|
|
||||||
const auto it = this->frozen_addresses_map.find_light(address);
|
const auto it = this->frozen_addresses_map.find_key(address);
|
||||||
R_UNLESS(it != this->frozen_addresses_map.end(), ResultFrozenAddressNotFound());
|
R_UNLESS(it != this->frozen_addresses_map.end(), ResultFrozenAddressNotFound());
|
||||||
|
|
||||||
frz_addr->address = it->GetAddress();
|
frz_addr->address = it->GetAddress();
|
||||||
|
@ -616,7 +616,7 @@ namespace ams::dmnt::cheat::impl {
|
||||||
|
|
||||||
R_TRY(this->EnsureCheatProcess());
|
R_TRY(this->EnsureCheatProcess());
|
||||||
|
|
||||||
const auto it = this->frozen_addresses_map.find_light(address);
|
const auto it = this->frozen_addresses_map.find_key(address);
|
||||||
R_UNLESS(it == this->frozen_addresses_map.end(), ResultFrozenAddressAlreadyExists());
|
R_UNLESS(it == this->frozen_addresses_map.end(), ResultFrozenAddressAlreadyExists());
|
||||||
|
|
||||||
FrozenAddressValue value = {};
|
FrozenAddressValue value = {};
|
||||||
|
@ -636,7 +636,7 @@ namespace ams::dmnt::cheat::impl {
|
||||||
|
|
||||||
R_TRY(this->EnsureCheatProcess());
|
R_TRY(this->EnsureCheatProcess());
|
||||||
|
|
||||||
const auto it = this->frozen_addresses_map.find_light(address);
|
const auto it = this->frozen_addresses_map.find_key(address);
|
||||||
R_UNLESS(it != this->frozen_addresses_map.end(), ResultFrozenAddressNotFound());
|
R_UNLESS(it != this->frozen_addresses_map.end(), ResultFrozenAddressNotFound());
|
||||||
|
|
||||||
FrozenAddressMapEntry *entry = std::addressof(*it);
|
FrozenAddressMapEntry *entry = std::addressof(*it);
|
||||||
|
|
Loading…
Reference in a new issue