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`
This commit is contained in:
parent
eca98eeb3e
commit
7d8f115185
158 changed files with 669 additions and 634 deletions
|
@ -149,7 +149,7 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(
|
|||
frontend_config.max_text_length = config.max_text_length;
|
||||
frontend_config.max_digits = config.max_digits;
|
||||
|
||||
size_t text_size = config.hint_text.size();
|
||||
std::size_t text_size = config.hint_text.size();
|
||||
const auto text_end = std::find(config.hint_text.begin(), config.hint_text.end(), u'\0');
|
||||
if (text_end != config.hint_text.end())
|
||||
text_size = std::distance(config.hint_text.begin(), text_end);
|
||||
|
|
|
@ -33,10 +33,10 @@ inline u32* GetCommandBuffer(const int offset = 0) {
|
|||
namespace IPC {
|
||||
|
||||
/// Size of the command buffer area, in 32-bit words.
|
||||
constexpr size_t COMMAND_BUFFER_LENGTH = 0x100 / sizeof(u32);
|
||||
constexpr std::size_t COMMAND_BUFFER_LENGTH = 0x100 / sizeof(u32);
|
||||
|
||||
// Maximum number of static buffers per thread.
|
||||
constexpr size_t MAX_STATIC_BUFFERS = 16;
|
||||
constexpr std::size_t MAX_STATIC_BUFFERS = 16;
|
||||
|
||||
// These errors are commonly returned by invalid IPC translations, so alias them here for
|
||||
// convenience.
|
||||
|
@ -113,7 +113,7 @@ union StaticBufferDescInfo {
|
|||
BitField<14, 18, u32> size;
|
||||
};
|
||||
|
||||
inline u32 StaticBufferDesc(size_t size, u8 buffer_id) {
|
||||
inline u32 StaticBufferDesc(std::size_t size, u8 buffer_id) {
|
||||
StaticBufferDescInfo info{};
|
||||
info.descriptor_type.Assign(StaticBuffer);
|
||||
info.buffer_id.Assign(buffer_id);
|
||||
|
@ -151,7 +151,7 @@ union MappedBufferDescInfo {
|
|||
BitField<4, 28, u32> size;
|
||||
};
|
||||
|
||||
inline u32 MappedBufferDesc(size_t size, MappedBufferPermissions perms) {
|
||||
inline u32 MappedBufferDesc(std::size_t size, MappedBufferPermissions perms) {
|
||||
MappedBufferDescInfo info{};
|
||||
info.flags.Assign(MappedBuffer);
|
||||
info.perms.Assign(perms);
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
: context(&context), cmdbuf(context.CommandBuffer()), header(desired_header) {}
|
||||
|
||||
/// Returns the total size of the request in words
|
||||
size_t TotalSize() const {
|
||||
std::size_t TotalSize() const {
|
||||
return 1 /* command header */ + header.normal_params_size + header.translate_params_size;
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ inline std::array<Kernel::SharedPtr<Kernel::Object>, N> RequestParser::PopGeneri
|
|||
}
|
||||
|
||||
namespace detail {
|
||||
template <typename... T, size_t... I>
|
||||
template <typename... T, std::size_t... I>
|
||||
std::tuple<Kernel::SharedPtr<T>...> PopObjectsHelper(
|
||||
std::array<Kernel::SharedPtr<Kernel::Object>, sizeof...(T)>&& pointers,
|
||||
std::index_sequence<I...>) {
|
||||
|
|
|
@ -66,7 +66,7 @@ ResultCode HandleTable::Close(Handle handle) {
|
|||
}
|
||||
|
||||
bool HandleTable::IsValid(Handle handle) const {
|
||||
size_t slot = GetSlot(handle);
|
||||
std::size_t slot = GetSlot(handle);
|
||||
u16 generation = GetGeneration(handle);
|
||||
|
||||
return slot < MAX_COUNT && objects[slot] != nullptr && generations[slot] == generation;
|
||||
|
|
|
@ -93,7 +93,7 @@ private:
|
|||
* This is the maximum limit of handles allowed per process in CTR-OS. It can be further
|
||||
* reduced by ExHeader values, but this is not emulated here.
|
||||
*/
|
||||
static const size_t MAX_COUNT = 4096;
|
||||
static const std::size_t MAX_COUNT = 4096;
|
||||
|
||||
static u16 GetSlot(Handle handle) {
|
||||
return handle >> 15;
|
||||
|
|
|
@ -100,13 +100,13 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const u32_le* sr
|
|||
HandleTable& src_table) {
|
||||
IPC::Header header{src_cmdbuf[0]};
|
||||
|
||||
size_t untranslated_size = 1u + header.normal_params_size;
|
||||
size_t command_size = untranslated_size + header.translate_params_size;
|
||||
std::size_t untranslated_size = 1u + header.normal_params_size;
|
||||
std::size_t command_size = untranslated_size + header.translate_params_size;
|
||||
ASSERT(command_size <= IPC::COMMAND_BUFFER_LENGTH); // TODO(yuriks): Return error
|
||||
|
||||
std::copy_n(src_cmdbuf, untranslated_size, cmd_buf.begin());
|
||||
|
||||
size_t i = untranslated_size;
|
||||
std::size_t i = untranslated_size;
|
||||
while (i < command_size) {
|
||||
u32 descriptor = cmd_buf[i] = src_cmdbuf[i];
|
||||
i += 1;
|
||||
|
@ -165,13 +165,13 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, P
|
|||
HandleTable& dst_table) const {
|
||||
IPC::Header header{cmd_buf[0]};
|
||||
|
||||
size_t untranslated_size = 1u + header.normal_params_size;
|
||||
size_t command_size = untranslated_size + header.translate_params_size;
|
||||
std::size_t untranslated_size = 1u + header.normal_params_size;
|
||||
std::size_t command_size = untranslated_size + header.translate_params_size;
|
||||
ASSERT(command_size <= IPC::COMMAND_BUFFER_LENGTH);
|
||||
|
||||
std::copy_n(cmd_buf.begin(), untranslated_size, dst_cmdbuf);
|
||||
|
||||
size_t i = untranslated_size;
|
||||
std::size_t i = untranslated_size;
|
||||
while (i < command_size) {
|
||||
u32 descriptor = dst_cmdbuf[i] = cmd_buf[i];
|
||||
i += 1;
|
||||
|
@ -201,7 +201,8 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, P
|
|||
// Grab the address that the target thread set up to receive the response static buffer
|
||||
// and write our data there. The static buffers area is located right after the command
|
||||
// buffer area.
|
||||
size_t static_buffer_offset = IPC::COMMAND_BUFFER_LENGTH + 2 * buffer_info.buffer_id;
|
||||
std::size_t static_buffer_offset =
|
||||
IPC::COMMAND_BUFFER_LENGTH + 2 * buffer_info.buffer_id;
|
||||
IPC::StaticBufferDescInfo target_descriptor{dst_cmdbuf[static_buffer_offset]};
|
||||
VAddr target_address = dst_cmdbuf[static_buffer_offset + 1];
|
||||
|
||||
|
@ -237,13 +238,13 @@ MappedBuffer::MappedBuffer(const Process& process, u32 descriptor, VAddr address
|
|||
perms = desc.perms;
|
||||
}
|
||||
|
||||
void MappedBuffer::Read(void* dest_buffer, size_t offset, size_t size) {
|
||||
void MappedBuffer::Read(void* dest_buffer, std::size_t offset, std::size_t size) {
|
||||
ASSERT(perms & IPC::R);
|
||||
ASSERT(offset + size <= this->size);
|
||||
Memory::ReadBlock(*process, address + static_cast<VAddr>(offset), dest_buffer, size);
|
||||
}
|
||||
|
||||
void MappedBuffer::Write(const void* src_buffer, size_t offset, size_t size) {
|
||||
void MappedBuffer::Write(const void* src_buffer, std::size_t offset, std::size_t size) {
|
||||
ASSERT(perms & IPC::W);
|
||||
ASSERT(offset + size <= this->size);
|
||||
Memory::WriteBlock(*process, address + static_cast<VAddr>(offset), src_buffer, size);
|
||||
|
|
|
@ -98,9 +98,9 @@ public:
|
|||
MappedBuffer(const Process& process, u32 descriptor, VAddr address, u32 id);
|
||||
|
||||
// interface for service
|
||||
void Read(void* dest_buffer, size_t offset, size_t size);
|
||||
void Write(const void* src_buffer, size_t offset, size_t size);
|
||||
size_t GetSize() const {
|
||||
void Read(void* dest_buffer, std::size_t offset, std::size_t size);
|
||||
void Write(const void* src_buffer, std::size_t offset, std::size_t size);
|
||||
std::size_t GetSize() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ private:
|
|||
u32 id;
|
||||
VAddr address;
|
||||
const Process* process;
|
||||
size_t size;
|
||||
std::size_t size;
|
||||
IPC::MappedBufferPermissions perms;
|
||||
};
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
|
|||
// TODO(Subv): Replace by Memory::Read32 when possible.
|
||||
Memory::ReadBlock(*src_process, src_address, &header.raw, sizeof(header.raw));
|
||||
|
||||
size_t untranslated_size = 1u + header.normal_params_size;
|
||||
size_t command_size = untranslated_size + header.translate_params_size;
|
||||
std::size_t untranslated_size = 1u + header.normal_params_size;
|
||||
std::size_t command_size = untranslated_size + header.translate_params_size;
|
||||
|
||||
// Note: The real kernel does not check that the command length fits into the IPC buffer area.
|
||||
ASSERT(command_size <= IPC::COMMAND_BUFFER_LENGTH);
|
||||
|
@ -33,7 +33,7 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
|
|||
std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
|
||||
Memory::ReadBlock(*src_process, src_address, cmd_buf.data(), command_size * sizeof(u32));
|
||||
|
||||
size_t i = untranslated_size;
|
||||
std::size_t i = untranslated_size;
|
||||
while (i < command_size) {
|
||||
u32 descriptor = cmd_buf[i];
|
||||
i += 1;
|
||||
|
@ -178,11 +178,12 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
|
|||
auto buffer = std::make_shared<std::vector<u8>>(Memory::PAGE_SIZE);
|
||||
|
||||
// Number of bytes until the next page.
|
||||
size_t difference_to_page =
|
||||
std::size_t difference_to_page =
|
||||
Common::AlignUp(source_address, Memory::PAGE_SIZE) - source_address;
|
||||
// If the data fits in one page we can just copy the required size instead of the
|
||||
// entire page.
|
||||
size_t read_size = num_pages == 1 ? static_cast<size_t>(size) : difference_to_page;
|
||||
std::size_t read_size =
|
||||
num_pages == 1 ? static_cast<std::size_t>(size) : difference_to_page;
|
||||
|
||||
Memory::ReadBlock(*src_process, source_address, buffer->data() + page_offset,
|
||||
read_size);
|
||||
|
|
|
@ -46,8 +46,8 @@ SharedPtr<Process> Process::Create(SharedPtr<CodeSet> code_set) {
|
|||
return process;
|
||||
}
|
||||
|
||||
void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
void Process::ParseKernelCaps(const u32* kernel_caps, std::size_t len) {
|
||||
for (std::size_t i = 0; i < len; ++i) {
|
||||
u32 descriptor = kernel_caps[i];
|
||||
u32 type = descriptor >> 20;
|
||||
|
||||
|
@ -253,7 +253,7 @@ ResultVal<VAddr> Process::LinearAllocate(VAddr target, u32 size, VMAPermission p
|
|||
|
||||
// TODO(yuriks): As is, this lets processes map memory allocated by other processes from the
|
||||
// same region. It is unknown if or how the 3DS kernel checks against this.
|
||||
size_t offset = target - GetLinearHeapBase();
|
||||
std::size_t offset = target - GetLinearHeapBase();
|
||||
CASCADE_RESULT(auto vma, vm_manager.MapMemoryBlock(target, linheap_memory, offset, size,
|
||||
MemoryState::Continuous));
|
||||
vm_manager.Reprotect(vma, perms);
|
||||
|
|
|
@ -57,7 +57,7 @@ struct MemoryRegionInfo;
|
|||
|
||||
struct CodeSet final : public Object {
|
||||
struct Segment {
|
||||
size_t offset = 0;
|
||||
std::size_t offset = 0;
|
||||
VAddr addr = 0;
|
||||
u32 size = 0;
|
||||
};
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
* Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them
|
||||
* to this process.
|
||||
*/
|
||||
void ParseKernelCaps(const u32* kernel_caps, size_t len);
|
||||
void ParseKernelCaps(const u32* kernel_caps, std::size_t len);
|
||||
|
||||
/**
|
||||
* Applies address space changes and launches the process main thread.
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
/// Backing memory for this shared memory block.
|
||||
std::shared_ptr<std::vector<u8>> backing_block;
|
||||
/// Offset into the backing block for this shared memory.
|
||||
size_t backing_block_offset;
|
||||
std::size_t backing_block_offset;
|
||||
/// Size of the memory block. Page-aligned.
|
||||
u32 size;
|
||||
/// Permission restrictions applied to the process which created the block.
|
||||
|
|
|
@ -424,7 +424,7 @@ static ResultCode WaitSynchronizationN(s32* out, VAddr handles_address, s32 hand
|
|||
thread->status = THREADSTATUS_WAIT_SYNCH_ANY;
|
||||
|
||||
// Add the thread to each of the objects' waiting threads.
|
||||
for (size_t i = 0; i < objects.size(); ++i) {
|
||||
for (std::size_t i = 0; i < objects.size(); ++i) {
|
||||
WaitObject* object = objects[i].get();
|
||||
object->AddWaitingThread(thread);
|
||||
}
|
||||
|
@ -581,7 +581,7 @@ static ResultCode ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_
|
|||
thread->status = THREADSTATUS_WAIT_SYNCH_ANY;
|
||||
|
||||
// Add the thread to each of the objects' waiting threads.
|
||||
for (size_t i = 0; i < objects.size(); ++i) {
|
||||
for (std::size_t i = 0; i < objects.size(); ++i) {
|
||||
WaitObject* object = objects[i].get();
|
||||
object->AddWaitingThread(thread);
|
||||
}
|
||||
|
|
|
@ -378,7 +378,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
|
|||
return ERR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
size_t offset = linheap_memory->size();
|
||||
std::size_t offset = linheap_memory->size();
|
||||
|
||||
// Allocate some memory from the end of the linear heap for this region.
|
||||
linheap_memory->insert(linheap_memory->end(), Memory::PAGE_SIZE, 0);
|
||||
|
|
|
@ -73,7 +73,7 @@ VMManager::VMAHandle VMManager::FindVMA(VAddr target) const {
|
|||
|
||||
ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
|
||||
std::shared_ptr<std::vector<u8>> block,
|
||||
size_t offset, u32 size,
|
||||
std::size_t offset, u32 size,
|
||||
MemoryState state) {
|
||||
ASSERT(block != nullptr);
|
||||
ASSERT(offset + size <= block->size());
|
||||
|
@ -95,7 +95,7 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
|
|||
|
||||
ResultVal<VAddr> VMManager::MapMemoryBlockToBase(VAddr base, u32 region_size,
|
||||
std::shared_ptr<std::vector<u8>> block,
|
||||
size_t offset, u32 size, MemoryState state) {
|
||||
std::size_t offset, u32 size, MemoryState state) {
|
||||
|
||||
// Find the first Free VMA.
|
||||
VMAHandle vma_handle = std::find_if(vma_map.begin(), vma_map.end(), [&](const auto& vma) {
|
||||
|
|
|
@ -75,7 +75,7 @@ struct VirtualMemoryArea {
|
|||
/// Memory block backing this VMA.
|
||||
std::shared_ptr<std::vector<u8>> backing_block = nullptr;
|
||||
/// Offset into the backing_memory the mapping starts from.
|
||||
size_t offset = 0;
|
||||
std::size_t offset = 0;
|
||||
|
||||
// Settings for type = BackingMemory
|
||||
/// Pointer backing this VMA. It will not be destroyed or freed when the VMA is removed.
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
* @param state MemoryState tag to attach to the VMA.
|
||||
*/
|
||||
ResultVal<VMAHandle> MapMemoryBlock(VAddr target, std::shared_ptr<std::vector<u8>> block,
|
||||
size_t offset, u32 size, MemoryState state);
|
||||
std::size_t offset, u32 size, MemoryState state);
|
||||
|
||||
/**
|
||||
* Maps part of a ref-counted block of memory at the first free address after the given base.
|
||||
|
@ -156,8 +156,8 @@ public:
|
|||
* @returns The address at which the memory was mapped.
|
||||
*/
|
||||
ResultVal<VAddr> MapMemoryBlockToBase(VAddr base, u32 region_size,
|
||||
std::shared_ptr<std::vector<u8>> block, size_t offset,
|
||||
u32 size, MemoryState state);
|
||||
std::shared_ptr<std::vector<u8>> block,
|
||||
std::size_t offset, u32 size, MemoryState state);
|
||||
/**
|
||||
* Maps an unmanaged host memory pointer at a given address.
|
||||
*
|
||||
|
|
|
@ -74,12 +74,13 @@ struct TicketInfo {
|
|||
|
||||
static_assert(sizeof(TicketInfo) == 0x18, "Ticket info structure size is wrong");
|
||||
|
||||
ResultVal<size_t> CIAFile::Read(u64 offset, size_t length, u8* buffer) const {
|
||||
ResultVal<std::size_t> CIAFile::Read(u64 offset, std::size_t length, u8* buffer) const {
|
||||
UNIMPLEMENTED();
|
||||
return MakeResult<size_t>(length);
|
||||
return MakeResult<std::size_t>(length);
|
||||
}
|
||||
|
||||
ResultVal<size_t> CIAFile::WriteTitleMetadata(u64 offset, size_t length, const u8* buffer) {
|
||||
ResultVal<std::size_t> CIAFile::WriteTitleMetadata(u64 offset, std::size_t length,
|
||||
const u8* buffer) {
|
||||
container.LoadTitleMetadata(data, container.GetTitleMetadataOffset());
|
||||
FileSys::TitleMetadata tmd = container.GetTitleMetadata();
|
||||
tmd.Print();
|
||||
|
@ -111,10 +112,10 @@ ResultVal<size_t> CIAFile::WriteTitleMetadata(u64 offset, size_t length, const u
|
|||
content_written.resize(container.GetTitleMetadata().GetContentCount());
|
||||
install_state = CIAInstallState::TMDLoaded;
|
||||
|
||||
return MakeResult<size_t>(length);
|
||||
return MakeResult<std::size_t>(length);
|
||||
}
|
||||
|
||||
ResultVal<size_t> CIAFile::WriteContentData(u64 offset, size_t length, const u8* buffer) {
|
||||
ResultVal<std::size_t> CIAFile::WriteContentData(u64 offset, std::size_t length, const u8* buffer) {
|
||||
// Data is not being buffered, so we have to keep track of how much of each <ID>.app
|
||||
// has been written since we might get a written buffer which contains multiple .app
|
||||
// contents or only part of a larger .app's contents.
|
||||
|
@ -153,10 +154,11 @@ ResultVal<size_t> CIAFile::WriteContentData(u64 offset, size_t length, const u8*
|
|||
}
|
||||
}
|
||||
|
||||
return MakeResult<size_t>(length);
|
||||
return MakeResult<std::size_t>(length);
|
||||
}
|
||||
|
||||
ResultVal<size_t> CIAFile::Write(u64 offset, size_t length, bool flush, const u8* buffer) {
|
||||
ResultVal<std::size_t> CIAFile::Write(u64 offset, std::size_t length, bool flush,
|
||||
const u8* buffer) {
|
||||
written += length;
|
||||
|
||||
// TODO(shinyquagsire23): Can we assume that things will only be written in sequence?
|
||||
|
@ -168,9 +170,9 @@ ResultVal<size_t> CIAFile::Write(u64 offset, size_t length, bool flush, const u8
|
|||
// content sizes so it ends up becoming a problem of keeping track of how much has been
|
||||
// written and what we have been able to pick up.
|
||||
if (install_state == CIAInstallState::InstallStarted) {
|
||||
size_t buf_copy_size = std::min(length, FileSys::CIA_HEADER_SIZE);
|
||||
size_t buf_max_size =
|
||||
std::min(static_cast<size_t>(offset + length), FileSys::CIA_HEADER_SIZE);
|
||||
std::size_t buf_copy_size = std::min(length, FileSys::CIA_HEADER_SIZE);
|
||||
std::size_t buf_max_size =
|
||||
std::min(static_cast<std::size_t>(offset + length), FileSys::CIA_HEADER_SIZE);
|
||||
data.resize(buf_max_size);
|
||||
memcpy(data.data() + offset, buffer, buf_copy_size);
|
||||
|
||||
|
@ -184,18 +186,18 @@ ResultVal<size_t> CIAFile::Write(u64 offset, size_t length, bool flush, const u8
|
|||
|
||||
// If we don't have a header yet, we can't pull offsets of other sections
|
||||
if (install_state == CIAInstallState::InstallStarted)
|
||||
return MakeResult<size_t>(length);
|
||||
return MakeResult<std::size_t>(length);
|
||||
|
||||
// If we have been given data before (or including) .app content, pull it into
|
||||
// our buffer, but only pull *up to* the content offset, no further.
|
||||
if (offset < container.GetContentOffset()) {
|
||||
size_t buf_loaded = data.size();
|
||||
size_t copy_offset = std::max(static_cast<size_t>(offset), buf_loaded);
|
||||
size_t buf_offset = buf_loaded - offset;
|
||||
size_t buf_copy_size =
|
||||
std::min(length, static_cast<size_t>(container.GetContentOffset() - offset)) -
|
||||
std::size_t buf_loaded = data.size();
|
||||
std::size_t copy_offset = std::max(static_cast<std::size_t>(offset), buf_loaded);
|
||||
std::size_t buf_offset = buf_loaded - offset;
|
||||
std::size_t buf_copy_size =
|
||||
std::min(length, static_cast<std::size_t>(container.GetContentOffset() - offset)) -
|
||||
buf_loaded;
|
||||
size_t buf_max_size = std::min(offset + length, container.GetContentOffset());
|
||||
std::size_t buf_max_size = std::min(offset + length, container.GetContentOffset());
|
||||
data.resize(buf_max_size);
|
||||
memcpy(data.data() + copy_offset, buffer + buf_offset, buf_copy_size);
|
||||
}
|
||||
|
@ -212,14 +214,14 @@ ResultVal<size_t> CIAFile::Write(u64 offset, size_t length, bool flush, const u8
|
|||
|
||||
// Content data sizes can only be retrieved from TMD data
|
||||
if (install_state != CIAInstallState::TMDLoaded)
|
||||
return MakeResult<size_t>(length);
|
||||
return MakeResult<std::size_t>(length);
|
||||
|
||||
// From this point forward, data will no longer be buffered in data
|
||||
auto result = WriteContentData(offset, length, buffer);
|
||||
if (result.Failed())
|
||||
return result;
|
||||
|
||||
return MakeResult<size_t>(length);
|
||||
return MakeResult<std::size_t>(length);
|
||||
}
|
||||
|
||||
u64 CIAFile::GetSize() const {
|
||||
|
@ -232,7 +234,7 @@ bool CIAFile::SetSize(u64 size) const {
|
|||
|
||||
bool CIAFile::Close() const {
|
||||
bool complete = true;
|
||||
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
|
||||
for (std::size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
|
||||
if (content_written[i] < container.GetContentSize(static_cast<u16>(i)))
|
||||
complete = false;
|
||||
}
|
||||
|
@ -294,7 +296,7 @@ InstallStatus InstallCIA(const std::string& path,
|
|||
Service::AM::CIAFile installFile(
|
||||
Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID()));
|
||||
|
||||
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
|
||||
for (std::size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
|
||||
if (container.GetTitleMetadata().GetContentTypeByIndex(static_cast<u16>(i)) &
|
||||
FileSys::TMDContentTypeFlag::Encrypted) {
|
||||
LOG_ERROR(Service_AM, "File {} is encrypted! Aborting...", path);
|
||||
|
@ -307,9 +309,9 @@ InstallStatus InstallCIA(const std::string& path,
|
|||
return InstallStatus::ErrorFailedToOpenFile;
|
||||
|
||||
std::array<u8, 0x10000> buffer;
|
||||
size_t total_bytes_read = 0;
|
||||
std::size_t total_bytes_read = 0;
|
||||
while (total_bytes_read != file.GetSize()) {
|
||||
size_t bytes_read = file.ReadBytes(buffer.data(), buffer.size());
|
||||
std::size_t bytes_read = file.ReadBytes(buffer.data(), buffer.size());
|
||||
auto result = installFile.Write(static_cast<u64>(total_bytes_read), bytes_read, true,
|
||||
static_cast<u8*>(buffer.data()));
|
||||
|
||||
|
@ -525,7 +527,7 @@ void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
|
|||
if (tmd.Load(tmd_path) == Loader::ResultStatus::Success) {
|
||||
std::size_t write_offset = 0;
|
||||
// Get info for each content index requested
|
||||
for (size_t i = 0; i < content_count; i++) {
|
||||
for (std::size_t i = 0; i < content_count; i++) {
|
||||
std::shared_ptr<FileUtil::IOFile> romfs_file;
|
||||
u64 romfs_offset = 0;
|
||||
|
||||
|
|
|
@ -53,10 +53,10 @@ enum class InstallStatus : u32 {
|
|||
};
|
||||
|
||||
// Title ID valid length
|
||||
constexpr size_t TITLE_ID_VALID_LENGTH = 16;
|
||||
constexpr std::size_t TITLE_ID_VALID_LENGTH = 16;
|
||||
|
||||
// Progress callback for InstallCIA, receives bytes written and total bytes
|
||||
using ProgressCallback = void(size_t, size_t);
|
||||
using ProgressCallback = void(std::size_t, std::size_t);
|
||||
|
||||
// A file handled returned for CIAs to be written into and subsequently installed.
|
||||
class CIAFile final : public FileSys::FileBackend {
|
||||
|
@ -66,10 +66,11 @@ public:
|
|||
Close();
|
||||
}
|
||||
|
||||
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
|
||||
ResultVal<size_t> WriteTitleMetadata(u64 offset, size_t length, const u8* buffer);
|
||||
ResultVal<size_t> WriteContentData(u64 offset, size_t length, const u8* buffer);
|
||||
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override;
|
||||
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override;
|
||||
ResultVal<std::size_t> WriteTitleMetadata(u64 offset, std::size_t length, const u8* buffer);
|
||||
ResultVal<std::size_t> WriteContentData(u64 offset, std::size_t length, const u8* buffer);
|
||||
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
|
||||
const u8* buffer) override;
|
||||
u64 GetSize() const override;
|
||||
bool SetSize(u64 size) const override;
|
||||
bool Close() const override;
|
||||
|
|
|
@ -19,11 +19,11 @@ struct AppletTitleData {
|
|||
std::array<AppletId, 2> applet_ids;
|
||||
|
||||
// There's a specific TitleId per region for each applet.
|
||||
static constexpr size_t NumRegions = 7;
|
||||
static constexpr std::size_t NumRegions = 7;
|
||||
std::array<u64, NumRegions> title_ids;
|
||||
};
|
||||
|
||||
static constexpr size_t NumApplets = 29;
|
||||
static constexpr std::size_t NumApplets = 29;
|
||||
static constexpr std::array<AppletTitleData, NumApplets> applet_titleids = {{
|
||||
{AppletId::HomeMenu, AppletId::None, 0x4003000008202, 0x4003000008F02, 0x4003000009802,
|
||||
0x4003000008202, 0x400300000A102, 0x400300000A902, 0x400300000B102},
|
||||
|
@ -84,7 +84,7 @@ static u64 GetTitleIdForApplet(AppletId id) {
|
|||
|
||||
AppletManager::AppletSlotData* AppletManager::GetAppletSlotData(AppletId id) {
|
||||
auto GetSlot = [this](AppletSlot slot) -> AppletSlotData* {
|
||||
return &applet_slots[static_cast<size_t>(slot)];
|
||||
return &applet_slots[static_cast<std::size_t>(slot)];
|
||||
};
|
||||
|
||||
if (id == AppletId::Application) {
|
||||
|
@ -160,9 +160,9 @@ AppletManager::AppletSlotData* AppletManager::GetAppletSlotData(AppletAttributes
|
|||
// The Home Menu is a system applet, however, it has its own applet slot so that it can run
|
||||
// concurrently with other system applets.
|
||||
if (slot == AppletSlot::SystemApplet && attributes.is_home_menu)
|
||||
return &applet_slots[static_cast<size_t>(AppletSlot::HomeMenu)];
|
||||
return &applet_slots[static_cast<std::size_t>(AppletSlot::HomeMenu)];
|
||||
|
||||
return &applet_slots[static_cast<size_t>(slot)];
|
||||
return &applet_slots[static_cast<std::size_t>(slot)];
|
||||
}
|
||||
|
||||
void AppletManager::CancelAndSendParameter(const MessageParameter& parameter) {
|
||||
|
@ -314,7 +314,7 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
|
|||
ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||
}
|
||||
|
||||
const auto& slot = applet_slots[static_cast<size_t>(AppletSlot::LibraryApplet)];
|
||||
const auto& slot = applet_slots[static_cast<std::size_t>(AppletSlot::LibraryApplet)];
|
||||
|
||||
if (slot.registered) {
|
||||
return ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
|
||||
|
@ -341,7 +341,7 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
|
|||
}
|
||||
|
||||
ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
|
||||
const auto& slot = applet_slots[static_cast<size_t>(AppletSlot::LibraryApplet)];
|
||||
const auto& slot = applet_slots[static_cast<std::size_t>(AppletSlot::LibraryApplet)];
|
||||
|
||||
if (slot.registered) {
|
||||
return ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
|
||||
|
@ -369,7 +369,7 @@ ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
|
|||
|
||||
ResultCode AppletManager::FinishPreloadingLibraryApplet(AppletId applet_id) {
|
||||
// TODO(Subv): This function should fail depending on the applet preparation state.
|
||||
auto& slot = applet_slots[static_cast<size_t>(AppletSlot::LibraryApplet)];
|
||||
auto& slot = applet_slots[static_cast<std::size_t>(AppletSlot::LibraryApplet)];
|
||||
slot.loaded = true;
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ ResultCode AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiti
|
|||
|
||||
ResultCode AppletManager::CloseLibraryApplet(Kernel::SharedPtr<Kernel::Object> object,
|
||||
std::vector<u8> buffer) {
|
||||
auto& slot = applet_slots[static_cast<size_t>(AppletSlot::LibraryApplet)];
|
||||
auto& slot = applet_slots[static_cast<std::size_t>(AppletSlot::LibraryApplet)];
|
||||
|
||||
MessageParameter param;
|
||||
// TODO(Subv): The destination id should be the "current applet slot id", which changes
|
||||
|
@ -467,7 +467,7 @@ ResultVal<AppletManager::AppletInfo> AppletManager::GetAppletInfo(AppletId app_i
|
|||
}
|
||||
|
||||
AppletManager::AppletManager() {
|
||||
for (size_t slot = 0; slot < applet_slots.size(); ++slot) {
|
||||
for (std::size_t slot = 0; slot < applet_slots.size(); ++slot) {
|
||||
auto& slot_data = applet_slots[slot];
|
||||
slot_data.slot = static_cast<AppletSlot>(slot);
|
||||
slot_data.applet_id = AppletId::None;
|
||||
|
|
|
@ -146,7 +146,7 @@ private:
|
|||
/// TODO(Subv): Use std::optional once we migrate to C++17.
|
||||
boost::optional<MessageParameter> next_parameter;
|
||||
|
||||
static constexpr size_t NumAppletSlot = 4;
|
||||
static constexpr std::size_t NumAppletSlot = 4;
|
||||
|
||||
enum class AppletSlot : u8 {
|
||||
Application,
|
||||
|
|
|
@ -533,7 +533,7 @@ void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
|
|||
IPC::RequestParser rp(ctx, 0x1E, 2, 4); // 0x1E0084
|
||||
AppletId applet_id = rp.PopEnum<AppletId>();
|
||||
|
||||
size_t buffer_size = rp.Pop<u32>();
|
||||
std::size_t buffer_size = rp.Pop<u32>();
|
||||
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
|
||||
std::vector<u8> buffer = rp.PopStaticBuffer();
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void Module::CompletionEventCallBack(u64 port_id, s64) {
|
|||
port.dest_size, buffer_size);
|
||||
}
|
||||
Memory::WriteBlock(*port.dest_process, port.dest, buffer.data(),
|
||||
std::min<size_t>(port.dest_size, buffer_size));
|
||||
std::min<std::size_t>(port.dest_size, buffer_size));
|
||||
}
|
||||
|
||||
port.is_receiving = false;
|
||||
|
|
|
@ -477,7 +477,7 @@ ResultCode Module::FormatConfig() {
|
|||
|
||||
u16_le country_name_buffer[16][0x40] = {};
|
||||
std::u16string region_name = Common::UTF8ToUTF16("Gensokyo");
|
||||
for (size_t i = 0; i < 16; ++i) {
|
||||
for (std::size_t i = 0; i < 16; ++i) {
|
||||
std::copy(region_name.cbegin(), region_name.cend(), country_name_buffer[i]);
|
||||
}
|
||||
// 0x000B0001 - Localized names for the profile Country
|
||||
|
@ -627,7 +627,7 @@ std::u16string Module::GetUsername() {
|
|||
// the username string in the block isn't null-terminated,
|
||||
// so we need to find the end manually.
|
||||
std::u16string username(block.username, ARRAY_SIZE(block.username));
|
||||
const size_t pos = username.find(u'\0');
|
||||
const std::size_t pos = username.find(u'\0');
|
||||
if (pos != std::u16string::npos)
|
||||
username.erase(pos);
|
||||
return username;
|
||||
|
|
|
@ -330,16 +330,16 @@ Kernel::SharedPtr<Kernel::Event>& DSP_DSP::GetInterruptEvent(InterruptType type,
|
|||
case InterruptType::One:
|
||||
return interrupt_one;
|
||||
case InterruptType::Pipe: {
|
||||
const size_t pipe_index = static_cast<size_t>(pipe);
|
||||
const std::size_t pipe_index = static_cast<std::size_t>(pipe);
|
||||
ASSERT(pipe_index < AudioCore::num_dsp_pipe);
|
||||
return pipes[pipe_index];
|
||||
}
|
||||
}
|
||||
UNREACHABLE_MSG("Invalid interrupt type = {}", static_cast<size_t>(type));
|
||||
UNREACHABLE_MSG("Invalid interrupt type = {}", static_cast<std::size_t>(type));
|
||||
}
|
||||
|
||||
bool DSP_DSP::HasTooManyEventsRegistered() const {
|
||||
size_t number =
|
||||
std::size_t number =
|
||||
std::count_if(pipes.begin(), pipes.end(), [](const auto& evt) { return evt != nullptr; });
|
||||
|
||||
if (interrupt_zero != nullptr)
|
||||
|
|
|
@ -18,11 +18,11 @@ public:
|
|||
~DSP_DSP();
|
||||
|
||||
/// There are three types of interrupts
|
||||
static constexpr size_t NUM_INTERRUPT_TYPE = 3;
|
||||
static constexpr std::size_t NUM_INTERRUPT_TYPE = 3;
|
||||
enum class InterruptType : u32 { Zero = 0, One = 1, Pipe = 2 };
|
||||
|
||||
/// Actual service implementation only has 6 'slots' for interrupts.
|
||||
static constexpr size_t max_number_of_interrupt_events = 6;
|
||||
static constexpr std::size_t max_number_of_interrupt_events = 6;
|
||||
|
||||
/// Signal interrupt on pipe
|
||||
void SignalInterrupt(InterruptType type, AudioCore::DspPipe pipe);
|
||||
|
|
|
@ -106,8 +106,8 @@ void Module::Interface::GetMyScreenName(Kernel::HLERequestContext& ctx) {
|
|||
}
|
||||
|
||||
void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx) {
|
||||
const size_t scrambled_friend_code_size = 12;
|
||||
const size_t friend_code_size = 8;
|
||||
const std::size_t scrambled_friend_code_size = 12;
|
||||
const std::size_t friend_code_size = 8;
|
||||
|
||||
IPC::RequestParser rp(ctx, 0x1C, 1, 2);
|
||||
const u32 friend_code_count = rp.Pop<u32>();
|
||||
|
|
|
@ -94,7 +94,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
|||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
|
||||
std::vector<u8> data(length);
|
||||
ResultVal<size_t> read = backend->Read(offset, data.size(), data.data());
|
||||
ResultVal<std::size_t> read = backend->Read(offset, data.size(), data.data());
|
||||
if (read.Failed()) {
|
||||
rb.Push(read.Code());
|
||||
rb.Push<u32>(0);
|
||||
|
@ -136,7 +136,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
std::vector<u8> data(length);
|
||||
buffer.Read(data.data(), 0, data.size());
|
||||
ResultVal<size_t> written = backend->Write(offset, data.size(), flush != 0, data.data());
|
||||
ResultVal<std::size_t> written = backend->Write(offset, data.size(), flush != 0, data.data());
|
||||
if (written.Failed()) {
|
||||
rb.Push(written.Code());
|
||||
rb.Push<u32>(0);
|
||||
|
@ -268,7 +268,7 @@ void File::OpenSubFile(Kernel::HLERequestContext& ctx) {
|
|||
return;
|
||||
}
|
||||
|
||||
size_t end = offset + size;
|
||||
std::size_t end = offset + size;
|
||||
|
||||
// TODO(Subv): Check for overflow and return ERR_WRITE_BEYOND_END
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, const std::ve
|
|||
LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
|
||||
return ERR_REGS_MISALIGNED;
|
||||
} else {
|
||||
size_t offset = 0;
|
||||
std::size_t offset = 0;
|
||||
while (size_in_bytes > 0) {
|
||||
u32 value;
|
||||
std::memcpy(&value, &data[offset], sizeof(u32));
|
||||
|
@ -172,7 +172,7 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes,
|
|||
LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
|
||||
return ERR_REGS_MISALIGNED;
|
||||
} else {
|
||||
size_t offset = 0;
|
||||
std::size_t offset = 0;
|
||||
while (size_in_bytes > 0) {
|
||||
const u32 reg_address = base_address + REGS_BEGIN;
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) {
|
|||
return;
|
||||
}
|
||||
|
||||
static constexpr size_t MaxConcurrentHTTPContexts = 8;
|
||||
static constexpr std::size_t MaxConcurrentHTTPContexts = 8;
|
||||
if (session_data->num_http_contexts >= MaxConcurrentHTTPContexts) {
|
||||
// There can only be 8 HTTP contexts open at the same time for any particular session.
|
||||
LOG_ERROR(Service_HTTP, "Tried to open too many HTTP contexts");
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
SetPacketInfo(info.end_index, packet_info);
|
||||
|
||||
// writes packet data
|
||||
for (size_t i = 0; i < packet.size(); ++i) {
|
||||
for (std::size_t i = 0; i < packet.size(); ++i) {
|
||||
*GetDataBufferPointer((write_offset + i) % max_data_size) = packet[i];
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ private:
|
|||
/// Wraps the payload into packet and puts it to the receive buffer
|
||||
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
|
||||
LOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(payload.data(), payload.size()));
|
||||
size_t size = payload.size();
|
||||
std::size_t size = payload.size();
|
||||
|
||||
std::vector<u8> packet;
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ static std::mutex beacon_mutex;
|
|||
|
||||
// Number of beacons to store before we start dropping the old ones.
|
||||
// TODO(Subv): Find a more accurate value for this limit.
|
||||
constexpr size_t MaxBeaconFrames = 15;
|
||||
constexpr std::size_t MaxBeaconFrames = 15;
|
||||
|
||||
// List of the last <MaxBeaconFrames> beacons received from the network.
|
||||
static std::list<Network::WifiPacket> received_beacons;
|
||||
|
@ -160,11 +160,11 @@ static void BroadcastNodeMap() {
|
|||
packet.channel = network_channel;
|
||||
packet.type = Network::WifiPacket::PacketType::NodeMap;
|
||||
packet.destination_address = Network::BroadcastMac;
|
||||
size_t size = node_map.size();
|
||||
std::size_t size = node_map.size();
|
||||
using node_t = decltype(node_map)::value_type;
|
||||
packet.data.resize(sizeof(size) + (sizeof(node_t::first) + sizeof(node_t::second)) * size);
|
||||
std::memcpy(packet.data.data(), &size, sizeof(size));
|
||||
size_t offset = sizeof(size);
|
||||
std::size_t offset = sizeof(size);
|
||||
for (const auto& node : node_map) {
|
||||
std::memcpy(packet.data.data() + offset, node.first.data(), sizeof(node.first));
|
||||
std::memcpy(packet.data.data() + offset + sizeof(node.first), &node.second,
|
||||
|
@ -178,12 +178,12 @@ static void BroadcastNodeMap() {
|
|||
static void HandleNodeMapPacket(const Network::WifiPacket& packet) {
|
||||
std::lock_guard<std::mutex> lock(connection_status_mutex);
|
||||
node_map.clear();
|
||||
size_t num_entries;
|
||||
std::size_t num_entries;
|
||||
Network::MacAddress address;
|
||||
u16 id;
|
||||
std::memcpy(&num_entries, packet.data.data(), sizeof(num_entries));
|
||||
size_t offset = sizeof(num_entries);
|
||||
for (size_t i = 0; i < num_entries; ++i) {
|
||||
std::size_t offset = sizeof(num_entries);
|
||||
for (std::size_t i = 0; i < num_entries; ++i) {
|
||||
std::memcpy(&address, packet.data.data() + offset, sizeof(address));
|
||||
std::memcpy(&id, packet.data.data() + offset + sizeof(address), sizeof(id));
|
||||
node_map[address] = id;
|
||||
|
@ -306,7 +306,7 @@ static void HandleEAPoLPacket(const Network::WifiPacket& packet) {
|
|||
|
||||
node_info.clear();
|
||||
node_info.reserve(network_info.max_nodes);
|
||||
for (size_t index = 0; index < logoff.connected_nodes; ++index) {
|
||||
for (std::size_t index = 0; index < logoff.connected_nodes; ++index) {
|
||||
connection_status.node_bitmask |= 1 << index;
|
||||
connection_status.changed_nodes |= 1 << index;
|
||||
connection_status.nodes[index] = logoff.nodes[index].network_node_id;
|
||||
|
@ -332,7 +332,7 @@ static void HandleEAPoLPacket(const Network::WifiPacket& packet) {
|
|||
|
||||
node_info.clear();
|
||||
node_info.reserve(network_info.max_nodes);
|
||||
for (size_t index = 0; index < logoff.connected_nodes; ++index) {
|
||||
for (std::size_t index = 0; index < logoff.connected_nodes; ++index) {
|
||||
if ((connection_status.node_bitmask & (1 << index)) == 0) {
|
||||
connection_status.changed_nodes |= 1 << index;
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
|
|||
Kernel::MappedBuffer out_buffer = rp.PopMappedBuffer();
|
||||
ASSERT(out_buffer.GetSize() == out_buffer_size);
|
||||
|
||||
size_t cur_buffer_size = sizeof(BeaconDataReplyHeader);
|
||||
std::size_t cur_buffer_size = sizeof(BeaconDataReplyHeader);
|
||||
|
||||
// Retrieve all beacon frames that were received from the desired mac address.
|
||||
auto beacons = GetReceivedBeacons(mac_address);
|
||||
|
@ -736,7 +736,7 @@ void NWM_UDS::Bind(Kernel::HLERequestContext& ctx) {
|
|||
return;
|
||||
}
|
||||
|
||||
constexpr size_t MaxBindNodes = 16;
|
||||
constexpr std::size_t MaxBindNodes = 16;
|
||||
if (channel_data.size() >= MaxBindNodes) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(ResultCode(ErrorDescription::OutOfMemory, ErrorModule::UDS,
|
||||
|
@ -1027,7 +1027,7 @@ void NWM_UDS::SendTo(Kernel::HLERequestContext& ctx) {
|
|||
dest_address = network_info.host_mac_address;
|
||||
}
|
||||
|
||||
constexpr size_t MaxSize = 0x5C6;
|
||||
constexpr std::size_t MaxSize = 0x5C6;
|
||||
if (data_size > MaxSize) {
|
||||
rb.Push(ResultCode(ErrorDescription::TooLarge, ErrorModule::UDS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Usage));
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
namespace Service {
|
||||
namespace NWM {
|
||||
|
||||
const size_t ApplicationDataSize = 0xC8;
|
||||
const std::size_t ApplicationDataSize = 0xC8;
|
||||
const u8 DefaultNetworkChannel = 11;
|
||||
|
||||
// Number of milliseconds in a TU.
|
||||
|
|
|
@ -241,8 +241,8 @@ void DecryptBeacon(const NetworkInfo& network_info, std::vector<u8>& buffer) {
|
|||
*/
|
||||
std::vector<u8> GenerateNintendoFirstEncryptedDataTag(const NetworkInfo& network_info,
|
||||
const NodeList& nodes) {
|
||||
const size_t payload_size =
|
||||
std::min<size_t>(EncryptedDataSizeCutoff, nodes.size() * sizeof(NodeInfo));
|
||||
const std::size_t payload_size =
|
||||
std::min<std::size_t>(EncryptedDataSizeCutoff, nodes.size() * sizeof(NodeInfo));
|
||||
|
||||
EncryptedDataTag tag{};
|
||||
tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific);
|
||||
|
@ -273,9 +273,9 @@ std::vector<u8> GenerateNintendoSecondEncryptedDataTag(const NetworkInfo& networ
|
|||
if (nodes.size() * sizeof(NodeInfo) <= EncryptedDataSizeCutoff)
|
||||
return {};
|
||||
|
||||
const size_t payload_size = nodes.size() * sizeof(NodeInfo) - EncryptedDataSizeCutoff;
|
||||
const std::size_t payload_size = nodes.size() * sizeof(NodeInfo) - EncryptedDataSizeCutoff;
|
||||
|
||||
const size_t tag_length = sizeof(EncryptedDataTag) - sizeof(TagHeader) + payload_size;
|
||||
const std::size_t tag_length = sizeof(EncryptedDataTag) - sizeof(TagHeader) + payload_size;
|
||||
|
||||
// TODO(Subv): What does the 3DS do when a game has too much data to fit into the tag?
|
||||
ASSERT_MSG(tag_length <= 255, "Data is too big.");
|
||||
|
|
|
@ -203,7 +203,7 @@ static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload
|
|||
df.ChannelMessageEnd(CryptoPP::DEFAULT_CHANNEL);
|
||||
df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
|
||||
|
||||
size_t size = df.MaxRetrievable();
|
||||
std::size_t size = df.MaxRetrievable();
|
||||
|
||||
std::vector<u8> pdata(size);
|
||||
df.Get(pdata.data(), size);
|
||||
|
@ -257,7 +257,7 @@ static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
|
|||
|
||||
df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
|
||||
|
||||
size_t size = df.MaxRetrievable();
|
||||
std::size_t size = df.MaxRetrievable();
|
||||
|
||||
std::vector<u8> cipher(size);
|
||||
df.Get(cipher.data(), size);
|
||||
|
@ -357,7 +357,7 @@ std::vector<u8> GenerateEAPoLLogoffFrame(const MacAddress& mac_address, u16 netw
|
|||
eapol_logoff.connected_nodes = total_nodes;
|
||||
eapol_logoff.max_nodes = max_nodes;
|
||||
|
||||
for (size_t index = 0; index < total_nodes; ++index) {
|
||||
for (std::size_t index = 0; index < total_nodes; ++index) {
|
||||
const auto& node_info = nodes[index];
|
||||
auto& node = eapol_logoff.nodes[index];
|
||||
|
||||
|
|
|
@ -152,9 +152,9 @@ void ServiceFrameworkBase::InstallAsNamedPort() {
|
|||
AddNamedPort(service_name, std::move(client_port));
|
||||
}
|
||||
|
||||
void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, size_t n) {
|
||||
void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) {
|
||||
handlers.reserve(handlers.size() + n);
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
for (std::size_t i = 0; i < n; ++i) {
|
||||
// Usually this array is sorted by id already, so hint to insert at the end
|
||||
handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ private:
|
|||
ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker);
|
||||
~ServiceFrameworkBase();
|
||||
|
||||
void RegisterHandlersBase(const FunctionInfoBase* functions, size_t n);
|
||||
void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n);
|
||||
void ReportUnimplementedFunction(u32* cmd_buf, const FunctionInfoBase* info);
|
||||
|
||||
/// Identifier string used to connect to the service.
|
||||
|
@ -147,7 +147,7 @@ protected:
|
|||
: ServiceFrameworkBase(service_name, max_sessions, Invoker) {}
|
||||
|
||||
/// Registers handlers in the service.
|
||||
template <size_t N>
|
||||
template <std::size_t N>
|
||||
void RegisterHandlers(const FunctionInfo (&functions)[N]) {
|
||||
RegisterHandlers(functions, N);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ protected:
|
|||
* Registers handlers in the service. Usually prefer using the other RegisterHandlers
|
||||
* overload in order to avoid needing to specify the array size.
|
||||
*/
|
||||
void RegisterHandlers(const FunctionInfo* functions, size_t n) {
|
||||
void RegisterHandlers(const FunctionInfo* functions, std::size_t n) {
|
||||
RegisterHandlersBase(functions, n);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) {
|
|||
void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x5, 4, 0);
|
||||
auto name_buf = rp.PopRaw<std::array<char, 8>>();
|
||||
size_t name_len = rp.Pop<u32>();
|
||||
std::size_t name_len = rp.Pop<u32>();
|
||||
u32 flags = rp.Pop<u32>();
|
||||
|
||||
bool wait_until_available = (flags & 1) == 0;
|
||||
|
@ -218,7 +218,7 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
|
|||
IPC::RequestParser rp(ctx, 0x3, 4, 0);
|
||||
|
||||
auto name_buf = rp.PopRaw<std::array<char, 8>>();
|
||||
size_t name_len = rp.Pop<u32>();
|
||||
std::size_t name_len = rp.Pop<u32>();
|
||||
u32 max_sessions = rp.Pop<u32>();
|
||||
|
||||
std::string name(name_buf.data(), std::min(name_len, name_buf.size()));
|
||||
|
|
|
@ -51,7 +51,7 @@ ResultCode ConversionConfiguration::SetInputLines(u16 lines) {
|
|||
|
||||
ResultCode ConversionConfiguration::SetStandardCoefficient(
|
||||
StandardCoefficient standard_coefficient) {
|
||||
size_t index = static_cast<size_t>(standard_coefficient);
|
||||
std::size_t index = static_cast<std::size_t>(standard_coefficient);
|
||||
if (index >= ARRAY_SIZE(standard_coefficients)) {
|
||||
return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
|
||||
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053ED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue