mirror of
https://github.com/PabloMK7/citra.git
synced 2025-12-01 04:48:47 +00:00
misc: fix issues pointed out by msvc (#7316)
* do not move constant variables
* applet_manager: avoid possible use after move
* use constant references where pointed out by msvc
* extra_hid: initialize response
* ValidateSaveState: passing slot separately is not necessary
* common: mark HashCombine as nodiscard
* cityhash: remove use of using namespace std
* Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
based on 7d8f115
* shared_memory.cpp: fix log error format
* fix compiling with pch off
This commit is contained in:
parent
6069fac76d
commit
c8c2beaeff
73 changed files with 181 additions and 167 deletions
|
|
@ -22,22 +22,22 @@ std::shared_ptr<ResourceLimit> ResourceLimit::Create(KernelSystem& kernel, std::
|
|||
}
|
||||
|
||||
s32 ResourceLimit::GetCurrentValue(ResourceLimitType type) const {
|
||||
const auto index = static_cast<size_t>(type);
|
||||
const auto index = static_cast<std::size_t>(type);
|
||||
return m_current_values[index];
|
||||
}
|
||||
|
||||
s32 ResourceLimit::GetLimitValue(ResourceLimitType type) const {
|
||||
const auto index = static_cast<size_t>(type);
|
||||
const auto index = static_cast<std::size_t>(type);
|
||||
return m_limit_values[index];
|
||||
}
|
||||
|
||||
void ResourceLimit::SetLimitValue(ResourceLimitType type, s32 value) {
|
||||
const auto index = static_cast<size_t>(type);
|
||||
const auto index = static_cast<std::size_t>(type);
|
||||
m_limit_values[index] = value;
|
||||
}
|
||||
|
||||
bool ResourceLimit::Reserve(ResourceLimitType type, s32 amount) {
|
||||
const auto index = static_cast<size_t>(type);
|
||||
const auto index = static_cast<std::size_t>(type);
|
||||
const s32 limit = m_limit_values[index];
|
||||
const s32 new_value = m_current_values[index] + amount;
|
||||
if (new_value > limit) {
|
||||
|
|
@ -50,7 +50,7 @@ bool ResourceLimit::Reserve(ResourceLimitType type, s32 amount) {
|
|||
}
|
||||
|
||||
bool ResourceLimit::Release(ResourceLimitType type, s32 amount) {
|
||||
const auto index = static_cast<size_t>(type);
|
||||
const auto index = static_cast<std::size_t>(type);
|
||||
const s32 value = m_current_values[index];
|
||||
if (amount > value) {
|
||||
LOG_ERROR(Kernel, "Amount {} exceeds current value {} for resource type {}", amount, value,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public:
|
|||
bool Release(ResourceLimitType type, s32 amount);
|
||||
|
||||
private:
|
||||
using ResourceArray = std::array<s32, static_cast<size_t>(ResourceLimitType::Max)>;
|
||||
using ResourceArray = std::array<s32, static_cast<std::size_t>(ResourceLimitType::Max)>;
|
||||
ResourceArray m_limit_values{};
|
||||
ResourceArray m_current_values{};
|
||||
std::string m_name;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ Result SharedMemory::Map(Process& target_process, VAddr address, MemoryPermissio
|
|||
|
||||
// Heap-backed memory blocks can not be mapped with other_permissions = DontCare
|
||||
if (base_address != 0 && other_permissions == MemoryPermission::DontCare) {
|
||||
LOG_ERROR(Kernel, "cannot map id={}, address=0x{08X} name={}, permissions don't match",
|
||||
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:08X} name={}, permissions don't match",
|
||||
GetObjectId(), address, name);
|
||||
return ResultInvalidCombination;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1686,8 +1686,8 @@ Result SVC::AcceptSession(Handle* out_server_session, Handle server_port_handle)
|
|||
return current_process->handle_table.Create(out_server_session, std::move(session));
|
||||
}
|
||||
|
||||
static void CopyStringPart(char* out, const char* in, size_t offset, size_t max_length) {
|
||||
size_t str_size = strlen(in);
|
||||
static void CopyStringPart(char* out, const char* in, std::size_t offset, std::size_t max_length) {
|
||||
std::size_t str_size = strlen(in);
|
||||
if (offset < str_size) {
|
||||
strncpy(out, in + offset, max_length - 1);
|
||||
out[max_length - 1] = '\0';
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ void Thread::WakeAfterDelay(s64 nanoseconds, bool thread_safe_mode) {
|
|||
// Don't schedule a wakeup if the thread wants to wait forever
|
||||
if (nanoseconds == -1)
|
||||
return;
|
||||
size_t core = thread_safe_mode ? core_id : std::numeric_limits<std::size_t>::max();
|
||||
std::size_t core = thread_safe_mode ? core_id : std::numeric_limits<std::size_t>::max();
|
||||
|
||||
thread_manager.kernel.timing.ScheduleEvent(nsToCycles(nanoseconds),
|
||||
thread_manager.ThreadWakeupEventType, thread_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue