diff options
| author | 2018-09-15 15:21:06 +0200 | |
|---|---|---|
| committer | 2018-09-15 15:21:06 +0200 | |
| commit | 63c2e32e207d31ecadd9022e1d7cd705c9febac8 (patch) | |
| tree | 8a90e8ef2804f147dff7225a543a8740ecf7160c /src/core/hle | |
| parent | Merge pull request #1310 from lioncash/kernel-ns (diff) | |
| download | yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.gz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.tar.xz yuzu-63c2e32e207d31ecadd9022e1d7cd705c9febac8.zip | |
Port #4182 from Citra: "Prefix all size_t with std::"
Diffstat (limited to 'src/core/hle')
31 files changed, 125 insertions, 119 deletions
diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h index 545cd884a..419f45896 100644 --- a/src/core/hle/ipc.h +++ b/src/core/hle/ipc.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | namespace IPC { | 12 | namespace IPC { |
| 13 | 13 | ||
| 14 | /// Size of the command buffer area, in 32-bit words. | 14 | /// Size of the command buffer area, in 32-bit words. |
| 15 | constexpr size_t COMMAND_BUFFER_LENGTH = 0x100 / sizeof(u32); | 15 | constexpr std::size_t COMMAND_BUFFER_LENGTH = 0x100 / sizeof(u32); |
| 16 | 16 | ||
| 17 | // These errors are commonly returned by invalid IPC translations, so alias them here for | 17 | // These errors are commonly returned by invalid IPC translations, so alias them here for |
| 18 | // convenience. | 18 | // convenience. |
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 0f3ffdb60..7545ecf2a 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -152,8 +152,8 @@ public: | |||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | void ValidateHeader() { | 154 | void ValidateHeader() { |
| 155 | const size_t num_domain_objects = context->NumDomainObjects(); | 155 | const std::size_t num_domain_objects = context->NumDomainObjects(); |
| 156 | const size_t num_move_objects = context->NumMoveObjects(); | 156 | const std::size_t num_move_objects = context->NumMoveObjects(); |
| 157 | ASSERT_MSG(!num_domain_objects || !num_move_objects, | 157 | ASSERT_MSG(!num_domain_objects || !num_move_objects, |
| 158 | "cannot move normal handles and domain objects"); | 158 | "cannot move normal handles and domain objects"); |
| 159 | ASSERT_MSG((index - datapayload_index) == normal_params_size, | 159 | ASSERT_MSG((index - datapayload_index) == normal_params_size, |
| @@ -329,10 +329,10 @@ public: | |||
| 329 | T PopRaw(); | 329 | T PopRaw(); |
| 330 | 330 | ||
| 331 | template <typename T> | 331 | template <typename T> |
| 332 | Kernel::SharedPtr<T> GetMoveObject(size_t index); | 332 | Kernel::SharedPtr<T> GetMoveObject(std::size_t index); |
| 333 | 333 | ||
| 334 | template <typename T> | 334 | template <typename T> |
| 335 | Kernel::SharedPtr<T> GetCopyObject(size_t index); | 335 | Kernel::SharedPtr<T> GetCopyObject(std::size_t index); |
| 336 | 336 | ||
| 337 | template <class T> | 337 | template <class T> |
| 338 | std::shared_ptr<T> PopIpcInterface() { | 338 | std::shared_ptr<T> PopIpcInterface() { |
| @@ -406,12 +406,12 @@ void RequestParser::Pop(First& first_value, Other&... other_values) { | |||
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | template <typename T> | 408 | template <typename T> |
| 409 | Kernel::SharedPtr<T> RequestParser::GetMoveObject(size_t index) { | 409 | Kernel::SharedPtr<T> RequestParser::GetMoveObject(std::size_t index) { |
| 410 | return context->GetMoveObject<T>(index); | 410 | return context->GetMoveObject<T>(index); |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | template <typename T> | 413 | template <typename T> |
| 414 | Kernel::SharedPtr<T> RequestParser::GetCopyObject(size_t index) { | 414 | Kernel::SharedPtr<T> RequestParser::GetCopyObject(std::size_t index) { |
| 415 | return context->GetCopyObject<T>(index); | 415 | return context->GetCopyObject<T>(index); |
| 416 | } | 416 | } |
| 417 | 417 | ||
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index 6657accd5..93577591f 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp | |||
| @@ -35,16 +35,17 @@ static ResultCode WaitForAddress(VAddr address, s64 timeout) { | |||
| 35 | 35 | ||
| 36 | // Gets the threads waiting on an address. | 36 | // Gets the threads waiting on an address. |
| 37 | static std::vector<SharedPtr<Thread>> GetThreadsWaitingOnAddress(VAddr address) { | 37 | static std::vector<SharedPtr<Thread>> GetThreadsWaitingOnAddress(VAddr address) { |
| 38 | const auto RetrieveWaitingThreads = | 38 | const auto RetrieveWaitingThreads = [](std::size_t core_index, |
| 39 | [](size_t core_index, std::vector<SharedPtr<Thread>>& waiting_threads, VAddr arb_addr) { | 39 | std::vector<SharedPtr<Thread>>& waiting_threads, |
| 40 | const auto& scheduler = Core::System::GetInstance().Scheduler(core_index); | 40 | VAddr arb_addr) { |
| 41 | auto& thread_list = scheduler->GetThreadList(); | 41 | const auto& scheduler = Core::System::GetInstance().Scheduler(core_index); |
| 42 | 42 | auto& thread_list = scheduler->GetThreadList(); | |
| 43 | for (auto& thread : thread_list) { | 43 | |
| 44 | if (thread->arb_wait_address == arb_addr) | 44 | for (auto& thread : thread_list) { |
| 45 | waiting_threads.push_back(thread); | 45 | if (thread->arb_wait_address == arb_addr) |
| 46 | } | 46 | waiting_threads.push_back(thread); |
| 47 | }; | 47 | } |
| 48 | }; | ||
| 48 | 49 | ||
| 49 | // Retrieve all threads that are waiting for this address. | 50 | // Retrieve all threads that are waiting for this address. |
| 50 | std::vector<SharedPtr<Thread>> threads; | 51 | std::vector<SharedPtr<Thread>> threads; |
| @@ -66,12 +67,12 @@ static std::vector<SharedPtr<Thread>> GetThreadsWaitingOnAddress(VAddr address) | |||
| 66 | static void WakeThreads(std::vector<SharedPtr<Thread>>& waiting_threads, s32 num_to_wake) { | 67 | static void WakeThreads(std::vector<SharedPtr<Thread>>& waiting_threads, s32 num_to_wake) { |
| 67 | // Only process up to 'target' threads, unless 'target' is <= 0, in which case process | 68 | // Only process up to 'target' threads, unless 'target' is <= 0, in which case process |
| 68 | // them all. | 69 | // them all. |
| 69 | size_t last = waiting_threads.size(); | 70 | std::size_t last = waiting_threads.size(); |
| 70 | if (num_to_wake > 0) | 71 | if (num_to_wake > 0) |
| 71 | last = num_to_wake; | 72 | last = num_to_wake; |
| 72 | 73 | ||
| 73 | // Signal the waiting threads. | 74 | // Signal the waiting threads. |
| 74 | for (size_t i = 0; i < last; i++) { | 75 | for (std::size_t i = 0; i < last; i++) { |
| 75 | ASSERT(waiting_threads[i]->status == ThreadStatus::WaitArb); | 76 | ASSERT(waiting_threads[i]->status == ThreadStatus::WaitArb); |
| 76 | waiting_threads[i]->SetWaitSynchronizationResult(RESULT_SUCCESS); | 77 | waiting_threads[i]->SetWaitSynchronizationResult(RESULT_SUCCESS); |
| 77 | waiting_threads[i]->arb_wait_address = 0; | 78 | waiting_threads[i]->arb_wait_address = 0; |
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index 3a079b9a9..5ee5c05e3 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp | |||
| @@ -65,7 +65,7 @@ ResultCode HandleTable::Close(Handle handle) { | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | bool HandleTable::IsValid(Handle handle) const { | 67 | bool HandleTable::IsValid(Handle handle) const { |
| 68 | size_t slot = GetSlot(handle); | 68 | std::size_t slot = GetSlot(handle); |
| 69 | u16 generation = GetGeneration(handle); | 69 | u16 generation = GetGeneration(handle); |
| 70 | 70 | ||
| 71 | return slot < MAX_COUNT && objects[slot] != nullptr && generations[slot] == generation; | 71 | return slot < MAX_COUNT && objects[slot] != nullptr && generations[slot] == generation; |
diff --git a/src/core/hle/kernel/handle_table.h b/src/core/hle/kernel/handle_table.h index cac928adb..9e2f33e8a 100644 --- a/src/core/hle/kernel/handle_table.h +++ b/src/core/hle/kernel/handle_table.h | |||
| @@ -93,7 +93,7 @@ private: | |||
| 93 | * This is the maximum limit of handles allowed per process in CTR-OS. It can be further | 93 | * This is the maximum limit of handles allowed per process in CTR-OS. It can be further |
| 94 | * reduced by ExHeader values, but this is not emulated here. | 94 | * reduced by ExHeader values, but this is not emulated here. |
| 95 | */ | 95 | */ |
| 96 | static const size_t MAX_COUNT = 4096; | 96 | static const std::size_t MAX_COUNT = 4096; |
| 97 | 97 | ||
| 98 | static u16 GetSlot(Handle handle) { | 98 | static u16 GetSlot(Handle handle) { |
| 99 | return handle >> 15; | 99 | return handle >> 15; |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 7264be906..72fb9d250 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -42,9 +42,9 @@ SharedPtr<Event> HLERequestContext::SleepClientThread(SharedPtr<Thread> thread, | |||
| 42 | Kernel::SharedPtr<Kernel::Event> event) { | 42 | Kernel::SharedPtr<Kernel::Event> event) { |
| 43 | 43 | ||
| 44 | // Put the client thread to sleep until the wait event is signaled or the timeout expires. | 44 | // Put the client thread to sleep until the wait event is signaled or the timeout expires. |
| 45 | thread->wakeup_callback = | 45 | thread->wakeup_callback = [context = *this, callback]( |
| 46 | [context = *this, callback](ThreadWakeupReason reason, SharedPtr<Thread> thread, | 46 | ThreadWakeupReason reason, SharedPtr<Thread> thread, |
| 47 | SharedPtr<WaitObject> object, size_t index) mutable -> bool { | 47 | SharedPtr<WaitObject> object, std::size_t index) mutable -> bool { |
| 48 | ASSERT(thread->status == ThreadStatus::WaitHLEEvent); | 48 | ASSERT(thread->status == ThreadStatus::WaitHLEEvent); |
| 49 | callback(thread, context, reason); | 49 | callback(thread, context, reason); |
| 50 | context.WriteToOutgoingCommandBuffer(*thread); | 50 | context.WriteToOutgoingCommandBuffer(*thread); |
| @@ -199,8 +199,8 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(u32_le* src_cmdb | |||
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | // The data_size already includes the payload header, the padding and the domain header. | 201 | // The data_size already includes the payload header, the padding and the domain header. |
| 202 | size_t size = data_payload_offset + command_header->data_size - | 202 | std::size_t size = data_payload_offset + command_header->data_size - |
| 203 | sizeof(IPC::DataPayloadHeader) / sizeof(u32) - 4; | 203 | sizeof(IPC::DataPayloadHeader) / sizeof(u32) - 4; |
| 204 | if (domain_message_header) | 204 | if (domain_message_header) |
| 205 | size -= sizeof(IPC::DomainMessageHeader) / sizeof(u32); | 205 | size -= sizeof(IPC::DomainMessageHeader) / sizeof(u32); |
| 206 | std::copy_n(src_cmdbuf, size, cmd_buf.begin()); | 206 | std::copy_n(src_cmdbuf, size, cmd_buf.begin()); |
| @@ -217,8 +217,8 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(const Thread& thread) | |||
| 217 | ParseCommandBuffer(cmd_buf.data(), false); | 217 | ParseCommandBuffer(cmd_buf.data(), false); |
| 218 | 218 | ||
| 219 | // The data_size already includes the payload header, the padding and the domain header. | 219 | // The data_size already includes the payload header, the padding and the domain header. |
| 220 | size_t size = data_payload_offset + command_header->data_size - | 220 | std::size_t size = data_payload_offset + command_header->data_size - |
| 221 | sizeof(IPC::DataPayloadHeader) / sizeof(u32) - 4; | 221 | sizeof(IPC::DataPayloadHeader) / sizeof(u32) - 4; |
| 222 | if (domain_message_header) | 222 | if (domain_message_header) |
| 223 | size -= sizeof(IPC::DomainMessageHeader) / sizeof(u32); | 223 | size -= sizeof(IPC::DomainMessageHeader) / sizeof(u32); |
| 224 | 224 | ||
| @@ -229,7 +229,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(const Thread& thread) | |||
| 229 | "Handle descriptor bit set but no handles to translate"); | 229 | "Handle descriptor bit set but no handles to translate"); |
| 230 | // We write the translated handles at a specific offset in the command buffer, this space | 230 | // We write the translated handles at a specific offset in the command buffer, this space |
| 231 | // was already reserved when writing the header. | 231 | // was already reserved when writing the header. |
| 232 | size_t current_offset = | 232 | std::size_t current_offset = |
| 233 | (sizeof(IPC::CommandHeader) + sizeof(IPC::HandleDescriptorHeader)) / sizeof(u32); | 233 | (sizeof(IPC::CommandHeader) + sizeof(IPC::HandleDescriptorHeader)) / sizeof(u32); |
| 234 | ASSERT_MSG(!handle_descriptor_header->send_current_pid, "Sending PID is not implemented"); | 234 | ASSERT_MSG(!handle_descriptor_header->send_current_pid, "Sending PID is not implemented"); |
| 235 | 235 | ||
| @@ -258,7 +258,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(const Thread& thread) | |||
| 258 | ASSERT(domain_message_header->num_objects == domain_objects.size()); | 258 | ASSERT(domain_message_header->num_objects == domain_objects.size()); |
| 259 | // Write the domain objects to the command buffer, these go after the raw untranslated data. | 259 | // Write the domain objects to the command buffer, these go after the raw untranslated data. |
| 260 | // TODO(Subv): This completely ignores C buffers. | 260 | // TODO(Subv): This completely ignores C buffers. |
| 261 | size_t domain_offset = size - domain_message_header->num_objects; | 261 | std::size_t domain_offset = size - domain_message_header->num_objects; |
| 262 | auto& request_handlers = server_session->domain_request_handlers; | 262 | auto& request_handlers = server_session->domain_request_handlers; |
| 263 | 263 | ||
| 264 | for (auto& object : domain_objects) { | 264 | for (auto& object : domain_objects) { |
| @@ -291,14 +291,15 @@ std::vector<u8> HLERequestContext::ReadBuffer(int buffer_index) const { | |||
| 291 | return buffer; | 291 | return buffer; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffer_index) const { | 294 | std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, |
| 295 | int buffer_index) const { | ||
| 295 | if (size == 0) { | 296 | if (size == 0) { |
| 296 | LOG_WARNING(Core, "skip empty buffer write"); | 297 | LOG_WARNING(Core, "skip empty buffer write"); |
| 297 | return 0; | 298 | return 0; |
| 298 | } | 299 | } |
| 299 | 300 | ||
| 300 | const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; | 301 | const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; |
| 301 | const size_t buffer_size{GetWriteBufferSize(buffer_index)}; | 302 | const std::size_t buffer_size{GetWriteBufferSize(buffer_index)}; |
| 302 | if (size > buffer_size) { | 303 | if (size > buffer_size) { |
| 303 | LOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, | 304 | LOG_CRITICAL(Core, "size ({:016X}) is greater than buffer_size ({:016X})", size, |
| 304 | buffer_size); | 305 | buffer_size); |
| @@ -314,13 +315,13 @@ size_t HLERequestContext::WriteBuffer(const void* buffer, size_t size, int buffe | |||
| 314 | return size; | 315 | return size; |
| 315 | } | 316 | } |
| 316 | 317 | ||
| 317 | size_t HLERequestContext::GetReadBufferSize(int buffer_index) const { | 318 | std::size_t HLERequestContext::GetReadBufferSize(int buffer_index) const { |
| 318 | const bool is_buffer_a{BufferDescriptorA().size() && BufferDescriptorA()[buffer_index].Size()}; | 319 | const bool is_buffer_a{BufferDescriptorA().size() && BufferDescriptorA()[buffer_index].Size()}; |
| 319 | return is_buffer_a ? BufferDescriptorA()[buffer_index].Size() | 320 | return is_buffer_a ? BufferDescriptorA()[buffer_index].Size() |
| 320 | : BufferDescriptorX()[buffer_index].Size(); | 321 | : BufferDescriptorX()[buffer_index].Size(); |
| 321 | } | 322 | } |
| 322 | 323 | ||
| 323 | size_t HLERequestContext::GetWriteBufferSize(int buffer_index) const { | 324 | std::size_t HLERequestContext::GetWriteBufferSize(int buffer_index) const { |
| 324 | const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; | 325 | const bool is_buffer_b{BufferDescriptorB().size() && BufferDescriptorB()[buffer_index].Size()}; |
| 325 | return is_buffer_b ? BufferDescriptorB()[buffer_index].Size() | 326 | return is_buffer_b ? BufferDescriptorB()[buffer_index].Size() |
| 326 | : BufferDescriptorC()[buffer_index].Size(); | 327 | : BufferDescriptorC()[buffer_index].Size(); |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index f0d07f1b6..894479ee0 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -170,7 +170,7 @@ public: | |||
| 170 | std::vector<u8> ReadBuffer(int buffer_index = 0) const; | 170 | std::vector<u8> ReadBuffer(int buffer_index = 0) const; |
| 171 | 171 | ||
| 172 | /// Helper function to write a buffer using the appropriate buffer descriptor | 172 | /// Helper function to write a buffer using the appropriate buffer descriptor |
| 173 | size_t WriteBuffer(const void* buffer, size_t size, int buffer_index = 0) const; | 173 | std::size_t WriteBuffer(const void* buffer, std::size_t size, int buffer_index = 0) const; |
| 174 | 174 | ||
| 175 | /* Helper function to write a buffer using the appropriate buffer descriptor | 175 | /* Helper function to write a buffer using the appropriate buffer descriptor |
| 176 | * | 176 | * |
| @@ -182,7 +182,7 @@ public: | |||
| 182 | */ | 182 | */ |
| 183 | template <typename ContiguousContainer, | 183 | template <typename ContiguousContainer, |
| 184 | typename = std::enable_if_t<!std::is_pointer_v<ContiguousContainer>>> | 184 | typename = std::enable_if_t<!std::is_pointer_v<ContiguousContainer>>> |
| 185 | size_t WriteBuffer(const ContiguousContainer& container, int buffer_index = 0) const { | 185 | std::size_t WriteBuffer(const ContiguousContainer& container, int buffer_index = 0) const { |
| 186 | using ContiguousType = typename ContiguousContainer::value_type; | 186 | using ContiguousType = typename ContiguousContainer::value_type; |
| 187 | 187 | ||
| 188 | static_assert(std::is_trivially_copyable_v<ContiguousType>, | 188 | static_assert(std::is_trivially_copyable_v<ContiguousType>, |
| @@ -193,19 +193,19 @@ public: | |||
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | /// Helper function to get the size of the input buffer | 195 | /// Helper function to get the size of the input buffer |
| 196 | size_t GetReadBufferSize(int buffer_index = 0) const; | 196 | std::size_t GetReadBufferSize(int buffer_index = 0) const; |
| 197 | 197 | ||
| 198 | /// Helper function to get the size of the output buffer | 198 | /// Helper function to get the size of the output buffer |
| 199 | size_t GetWriteBufferSize(int buffer_index = 0) const; | 199 | std::size_t GetWriteBufferSize(int buffer_index = 0) const; |
| 200 | 200 | ||
| 201 | template <typename T> | 201 | template <typename T> |
| 202 | SharedPtr<T> GetCopyObject(size_t index) { | 202 | SharedPtr<T> GetCopyObject(std::size_t index) { |
| 203 | ASSERT(index < copy_objects.size()); | 203 | ASSERT(index < copy_objects.size()); |
| 204 | return DynamicObjectCast<T>(copy_objects[index]); | 204 | return DynamicObjectCast<T>(copy_objects[index]); |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | template <typename T> | 207 | template <typename T> |
| 208 | SharedPtr<T> GetMoveObject(size_t index) { | 208 | SharedPtr<T> GetMoveObject(std::size_t index) { |
| 209 | ASSERT(index < move_objects.size()); | 209 | ASSERT(index < move_objects.size()); |
| 210 | return DynamicObjectCast<T>(move_objects[index]); | 210 | return DynamicObjectCast<T>(move_objects[index]); |
| 211 | } | 211 | } |
| @@ -223,7 +223,7 @@ public: | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | template <typename T> | 225 | template <typename T> |
| 226 | std::shared_ptr<T> GetDomainRequestHandler(size_t index) const { | 226 | std::shared_ptr<T> GetDomainRequestHandler(std::size_t index) const { |
| 227 | return std::static_pointer_cast<T>(domain_request_handlers[index]); | 227 | return std::static_pointer_cast<T>(domain_request_handlers[index]); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| @@ -240,15 +240,15 @@ public: | |||
| 240 | domain_objects.clear(); | 240 | domain_objects.clear(); |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | size_t NumMoveObjects() const { | 243 | std::size_t NumMoveObjects() const { |
| 244 | return move_objects.size(); | 244 | return move_objects.size(); |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | size_t NumCopyObjects() const { | 247 | std::size_t NumCopyObjects() const { |
| 248 | return copy_objects.size(); | 248 | return copy_objects.size(); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | size_t NumDomainObjects() const { | 251 | std::size_t NumDomainObjects() const { |
| 252 | return domain_objects.size(); | 252 | return domain_objects.size(); |
| 253 | } | 253 | } |
| 254 | 254 | ||
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index b025e323f..7a272d031 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -40,8 +40,8 @@ SharedPtr<Process> Process::Create(KernelCore& kernel, std::string&& name) { | |||
| 40 | return process; | 40 | return process; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) { | 43 | void Process::ParseKernelCaps(const u32* kernel_caps, std::size_t len) { |
| 44 | for (size_t i = 0; i < len; ++i) { | 44 | for (std::size_t i = 0; i < len; ++i) { |
| 45 | u32 descriptor = kernel_caps[i]; | 45 | u32 descriptor = kernel_caps[i]; |
| 46 | u32 type = descriptor >> 20; | 46 | u32 type = descriptor >> 20; |
| 47 | 47 | ||
| @@ -211,7 +211,7 @@ ResultCode Process::MirrorMemory(VAddr dst_addr, VAddr src_addr, u64 size) { | |||
| 211 | "Shared memory exceeds bounds of mapped block"); | 211 | "Shared memory exceeds bounds of mapped block"); |
| 212 | 212 | ||
| 213 | const std::shared_ptr<std::vector<u8>>& backing_block = vma->second.backing_block; | 213 | const std::shared_ptr<std::vector<u8>>& backing_block = vma->second.backing_block; |
| 214 | size_t backing_block_offset = vma->second.offset + vma_offset; | 214 | std::size_t backing_block_offset = vma->second.offset + vma_offset; |
| 215 | 215 | ||
| 216 | CASCADE_RESULT(auto new_vma, | 216 | CASCADE_RESULT(auto new_vma, |
| 217 | vm_manager.MapMemoryBlock(dst_addr, backing_block, backing_block_offset, size, | 217 | vm_manager.MapMemoryBlock(dst_addr, backing_block, backing_block_offset, size, |
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 1587d40c1..81538f70c 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -59,7 +59,7 @@ class ResourceLimit; | |||
| 59 | 59 | ||
| 60 | struct CodeSet final : public Object { | 60 | struct CodeSet final : public Object { |
| 61 | struct Segment { | 61 | struct Segment { |
| 62 | size_t offset = 0; | 62 | std::size_t offset = 0; |
| 63 | VAddr addr = 0; | 63 | VAddr addr = 0; |
| 64 | u32 size = 0; | 64 | u32 size = 0; |
| 65 | }; | 65 | }; |
| @@ -164,7 +164,7 @@ public: | |||
| 164 | * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them | 164 | * Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them |
| 165 | * to this process. | 165 | * to this process. |
| 166 | */ | 166 | */ |
| 167 | void ParseKernelCaps(const u32* kernel_caps, size_t len); | 167 | void ParseKernelCaps(const u32* kernel_caps, std::size_t len); |
| 168 | 168 | ||
| 169 | /** | 169 | /** |
| 170 | * Applies address space changes and launches the process main thread. | 170 | * Applies address space changes and launches the process main thread. |
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index 2c729afe3..2c06bb7ce 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h | |||
| @@ -119,7 +119,7 @@ public: | |||
| 119 | /// Backing memory for this shared memory block. | 119 | /// Backing memory for this shared memory block. |
| 120 | std::shared_ptr<std::vector<u8>> backing_block; | 120 | std::shared_ptr<std::vector<u8>> backing_block; |
| 121 | /// Offset into the backing block for this shared memory. | 121 | /// Offset into the backing block for this shared memory. |
| 122 | size_t backing_block_offset; | 122 | std::size_t backing_block_offset; |
| 123 | /// Size of the memory block. Page-aligned. | 123 | /// Size of the memory block. Page-aligned. |
| 124 | u64 size; | 124 | u64 size; |
| 125 | /// Permission restrictions applied to the process which created the block. | 125 | /// Permission restrictions applied to the process which created the block. |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index f500fd2e7..a5aaa089d 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -146,7 +146,7 @@ static ResultCode GetProcessId(u32* process_id, Handle process_handle) { | |||
| 146 | 146 | ||
| 147 | /// Default thread wakeup callback for WaitSynchronization | 147 | /// Default thread wakeup callback for WaitSynchronization |
| 148 | static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> thread, | 148 | static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, SharedPtr<Thread> thread, |
| 149 | SharedPtr<WaitObject> object, size_t index) { | 149 | SharedPtr<WaitObject> object, std::size_t index) { |
| 150 | ASSERT(thread->status == ThreadStatus::WaitSynchAny); | 150 | ASSERT(thread->status == ThreadStatus::WaitSynchAny); |
| 151 | 151 | ||
| 152 | if (reason == ThreadWakeupReason::Timeout) { | 152 | if (reason == ThreadWakeupReason::Timeout) { |
| @@ -647,16 +647,17 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target | |||
| 647 | LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}", | 647 | LOG_TRACE(Kernel_SVC, "called, condition_variable_addr=0x{:X}, target=0x{:08X}", |
| 648 | condition_variable_addr, target); | 648 | condition_variable_addr, target); |
| 649 | 649 | ||
| 650 | auto RetrieveWaitingThreads = | 650 | auto RetrieveWaitingThreads = [](std::size_t core_index, |
| 651 | [](size_t core_index, std::vector<SharedPtr<Thread>>& waiting_threads, VAddr condvar_addr) { | 651 | std::vector<SharedPtr<Thread>>& waiting_threads, |
| 652 | const auto& scheduler = Core::System::GetInstance().Scheduler(core_index); | 652 | VAddr condvar_addr) { |
| 653 | auto& thread_list = scheduler->GetThreadList(); | 653 | const auto& scheduler = Core::System::GetInstance().Scheduler(core_index); |
| 654 | auto& thread_list = scheduler->GetThreadList(); | ||
| 654 | 655 | ||
| 655 | for (auto& thread : thread_list) { | 656 | for (auto& thread : thread_list) { |
| 656 | if (thread->condvar_wait_address == condvar_addr) | 657 | if (thread->condvar_wait_address == condvar_addr) |
| 657 | waiting_threads.push_back(thread); | 658 | waiting_threads.push_back(thread); |
| 658 | } | 659 | } |
| 659 | }; | 660 | }; |
| 660 | 661 | ||
| 661 | // Retrieve a list of all threads that are waiting for this condition variable. | 662 | // Retrieve a list of all threads that are waiting for this condition variable. |
| 662 | std::vector<SharedPtr<Thread>> waiting_threads; | 663 | std::vector<SharedPtr<Thread>> waiting_threads; |
| @@ -672,7 +673,7 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target | |||
| 672 | 673 | ||
| 673 | // Only process up to 'target' threads, unless 'target' is -1, in which case process | 674 | // Only process up to 'target' threads, unless 'target' is -1, in which case process |
| 674 | // them all. | 675 | // them all. |
| 675 | size_t last = waiting_threads.size(); | 676 | std::size_t last = waiting_threads.size(); |
| 676 | if (target != -1) | 677 | if (target != -1) |
| 677 | last = target; | 678 | last = target; |
| 678 | 679 | ||
| @@ -680,12 +681,12 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target | |||
| 680 | if (last > waiting_threads.size()) | 681 | if (last > waiting_threads.size()) |
| 681 | return RESULT_SUCCESS; | 682 | return RESULT_SUCCESS; |
| 682 | 683 | ||
| 683 | for (size_t index = 0; index < last; ++index) { | 684 | for (std::size_t index = 0; index < last; ++index) { |
| 684 | auto& thread = waiting_threads[index]; | 685 | auto& thread = waiting_threads[index]; |
| 685 | 686 | ||
| 686 | ASSERT(thread->condvar_wait_address == condition_variable_addr); | 687 | ASSERT(thread->condvar_wait_address == condition_variable_addr); |
| 687 | 688 | ||
| 688 | size_t current_core = Core::System::GetInstance().CurrentCoreIndex(); | 689 | std::size_t current_core = Core::System::GetInstance().CurrentCoreIndex(); |
| 689 | 690 | ||
| 690 | auto& monitor = Core::System::GetInstance().Monitor(); | 691 | auto& monitor = Core::System::GetInstance().Monitor(); |
| 691 | 692 | ||
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 3f12a84dc..89cd5f401 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -275,7 +275,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(KernelCore& kernel, std::string name | |||
| 275 | available_slot = 0; // Use the first slot in the new page | 275 | available_slot = 0; // Use the first slot in the new page |
| 276 | 276 | ||
| 277 | // Allocate some memory from the end of the linear heap for this region. | 277 | // Allocate some memory from the end of the linear heap for this region. |
| 278 | const size_t offset = thread->tls_memory->size(); | 278 | const std::size_t offset = thread->tls_memory->size(); |
| 279 | thread->tls_memory->insert(thread->tls_memory->end(), Memory::PAGE_SIZE, 0); | 279 | thread->tls_memory->insert(thread->tls_memory->end(), Memory::PAGE_SIZE, 0); |
| 280 | 280 | ||
| 281 | auto& vm_manager = owner_process->vm_manager; | 281 | auto& vm_manager = owner_process->vm_manager; |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index cb57ee78a..df4748942 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -254,7 +254,7 @@ public: | |||
| 254 | Handle callback_handle; | 254 | Handle callback_handle; |
| 255 | 255 | ||
| 256 | using WakeupCallback = bool(ThreadWakeupReason reason, SharedPtr<Thread> thread, | 256 | using WakeupCallback = bool(ThreadWakeupReason reason, SharedPtr<Thread> thread, |
| 257 | SharedPtr<WaitObject> object, size_t index); | 257 | SharedPtr<WaitObject> object, std::size_t index); |
| 258 | // Callback that will be invoked when the thread is resumed from a waiting state. If the thread | 258 | // Callback that will be invoked when the thread is resumed from a waiting state. If the thread |
| 259 | // was waiting via WaitSynchronizationN then the object will be the last object that became | 259 | // was waiting via WaitSynchronizationN then the object will be the last object that became |
| 260 | // available. In case of a timeout, the object will be nullptr. | 260 | // available. In case of a timeout, the object will be nullptr. |
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 479cacb62..608cbd57b 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp | |||
| @@ -86,7 +86,7 @@ VMManager::VMAHandle VMManager::FindVMA(VAddr target) const { | |||
| 86 | 86 | ||
| 87 | ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target, | 87 | ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target, |
| 88 | std::shared_ptr<std::vector<u8>> block, | 88 | std::shared_ptr<std::vector<u8>> block, |
| 89 | size_t offset, u64 size, | 89 | std::size_t offset, u64 size, |
| 90 | MemoryState state) { | 90 | MemoryState state) { |
| 91 | ASSERT(block != nullptr); | 91 | ASSERT(block != nullptr); |
| 92 | ASSERT(offset + size <= block->size()); | 92 | ASSERT(offset + size <= block->size()); |
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h index 98bd04bea..de75036c0 100644 --- a/src/core/hle/kernel/vm_manager.h +++ b/src/core/hle/kernel/vm_manager.h | |||
| @@ -81,7 +81,7 @@ struct VirtualMemoryArea { | |||
| 81 | /// Memory block backing this VMA. | 81 | /// Memory block backing this VMA. |
| 82 | std::shared_ptr<std::vector<u8>> backing_block = nullptr; | 82 | std::shared_ptr<std::vector<u8>> backing_block = nullptr; |
| 83 | /// Offset into the backing_memory the mapping starts from. | 83 | /// Offset into the backing_memory the mapping starts from. |
| 84 | size_t offset = 0; | 84 | std::size_t offset = 0; |
| 85 | 85 | ||
| 86 | // Settings for type = BackingMemory | 86 | // Settings for type = BackingMemory |
| 87 | /// Pointer backing this VMA. It will not be destroyed or freed when the VMA is removed. | 87 | /// Pointer backing this VMA. It will not be destroyed or freed when the VMA is removed. |
| @@ -147,7 +147,7 @@ public: | |||
| 147 | * @param state MemoryState tag to attach to the VMA. | 147 | * @param state MemoryState tag to attach to the VMA. |
| 148 | */ | 148 | */ |
| 149 | ResultVal<VMAHandle> MapMemoryBlock(VAddr target, std::shared_ptr<std::vector<u8>> block, | 149 | ResultVal<VMAHandle> MapMemoryBlock(VAddr target, std::shared_ptr<std::vector<u8>> block, |
| 150 | size_t offset, u64 size, MemoryState state); | 150 | std::size_t offset, u64 size, MemoryState state); |
| 151 | 151 | ||
| 152 | /** | 152 | /** |
| 153 | * Maps an unmanaged host memory pointer at a given address. | 153 | * Maps an unmanaged host memory pointer at a given address. |
diff --git a/src/core/hle/kernel/wait_object.cpp b/src/core/hle/kernel/wait_object.cpp index eef00b729..b190ceb98 100644 --- a/src/core/hle/kernel/wait_object.cpp +++ b/src/core/hle/kernel/wait_object.cpp | |||
| @@ -81,7 +81,7 @@ void WaitObject::WakeupWaitingThread(SharedPtr<Thread> thread) { | |||
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | size_t index = thread->GetWaitObjectIndex(this); | 84 | std::size_t index = thread->GetWaitObjectIndex(this); |
| 85 | 85 | ||
| 86 | for (auto& object : thread->wait_objects) | 86 | for (auto& object : thread->wait_objects) |
| 87 | object->RemoveWaitingThread(thread.get()); | 87 | object->RemoveWaitingThread(thread.get()); |
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 4ccebef23..0071ca613 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -33,7 +33,7 @@ ProfileManager::~ProfileManager() = default; | |||
| 33 | 33 | ||
| 34 | /// After a users creation it needs to be "registered" to the system. AddToProfiles handles the | 34 | /// After a users creation it needs to be "registered" to the system. AddToProfiles handles the |
| 35 | /// internal management of the users profiles | 35 | /// internal management of the users profiles |
| 36 | boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { | 36 | boost::optional<std::size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { |
| 37 | if (user_count >= MAX_USERS) { | 37 | if (user_count >= MAX_USERS) { |
| 38 | return boost::none; | 38 | return boost::none; |
| 39 | } | 39 | } |
| @@ -42,7 +42,7 @@ boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | /// Deletes a specific profile based on it's profile index | 44 | /// Deletes a specific profile based on it's profile index |
| 45 | bool ProfileManager::RemoveProfileAtIndex(size_t index) { | 45 | bool ProfileManager::RemoveProfileAtIndex(std::size_t index) { |
| 46 | if (index >= MAX_USERS || index >= user_count) { | 46 | if (index >= MAX_USERS || index >= user_count) { |
| 47 | return false; | 47 | return false; |
| 48 | } | 48 | } |
| @@ -101,7 +101,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | /// Returns a users profile index based on their user id. | 103 | /// Returns a users profile index based on their user id. |
| 104 | boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { | 104 | boost::optional<std::size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { |
| 105 | if (!uuid) { | 105 | if (!uuid) { |
| 106 | return boost::none; | 106 | return boost::none; |
| 107 | } | 107 | } |
| @@ -110,16 +110,17 @@ boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { | |||
| 110 | if (iter == profiles.end()) { | 110 | if (iter == profiles.end()) { |
| 111 | return boost::none; | 111 | return boost::none; |
| 112 | } | 112 | } |
| 113 | return static_cast<size_t>(std::distance(profiles.begin(), iter)); | 113 | return static_cast<std::size_t>(std::distance(profiles.begin(), iter)); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | /// Returns a users profile index based on their profile | 116 | /// Returns a users profile index based on their profile |
| 117 | boost::optional<size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const { | 117 | boost::optional<std::size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const { |
| 118 | return GetUserIndex(user.user_uuid); | 118 | return GetUserIndex(user.user_uuid); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* | 121 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* |
| 122 | bool ProfileManager::GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const { | 122 | bool ProfileManager::GetProfileBase(boost::optional<std::size_t> index, |
| 123 | ProfileBase& profile) const { | ||
| 123 | if (index == boost::none || index >= MAX_USERS) { | 124 | if (index == boost::none || index >= MAX_USERS) { |
| 124 | return false; | 125 | return false; |
| 125 | } | 126 | } |
| @@ -143,14 +144,16 @@ bool ProfileManager::GetProfileBase(const ProfileInfo& user, ProfileBase& profil | |||
| 143 | 144 | ||
| 144 | /// Returns the current user count on the system. We keep a variable which tracks the count so we | 145 | /// Returns the current user count on the system. We keep a variable which tracks the count so we |
| 145 | /// don't have to loop the internal profile array every call. | 146 | /// don't have to loop the internal profile array every call. |
| 146 | size_t ProfileManager::GetUserCount() const { | 147 | |
| 148 | std::size_t ProfileManager::GetUserCount() const { | ||
| 147 | return user_count; | 149 | return user_count; |
| 148 | } | 150 | } |
| 149 | 151 | ||
| 150 | /// Lists the current "opened" users on the system. Users are typically not open until they sign | 152 | /// Lists the current "opened" users on the system. Users are typically not open until they sign |
| 151 | /// into something or pick a profile. As of right now users should all be open until qlaunch is | 153 | /// into something or pick a profile. As of right now users should all be open until qlaunch is |
| 152 | /// booting | 154 | /// booting |
| 153 | size_t ProfileManager::GetOpenUserCount() const { | 155 | |
| 156 | std::size_t ProfileManager::GetOpenUserCount() const { | ||
| 154 | return std::count_if(profiles.begin(), profiles.end(), | 157 | return std::count_if(profiles.begin(), profiles.end(), |
| 155 | [](const ProfileInfo& p) { return p.is_open; }); | 158 | [](const ProfileInfo& p) { return p.is_open; }); |
| 156 | } | 159 | } |
| @@ -206,7 +209,7 @@ UUID ProfileManager::GetLastOpenedUser() const { | |||
| 206 | } | 209 | } |
| 207 | 210 | ||
| 208 | /// Return the users profile base and the unknown arbitary data. | 211 | /// Return the users profile base and the unknown arbitary data. |
| 209 | bool ProfileManager::GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile, | 212 | bool ProfileManager::GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile, |
| 210 | ProfileData& data) const { | 213 | ProfileData& data) const { |
| 211 | if (GetProfileBase(index, profile)) { | 214 | if (GetProfileBase(index, profile)) { |
| 212 | data = profiles[index.get()].data; | 215 | data = profiles[index.get()].data; |
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index cd8df93a5..bffd4cf4d 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | #include "core/hle/result.h" | 12 | #include "core/hle/result.h" |
| 13 | 13 | ||
| 14 | namespace Service::Account { | 14 | namespace Service::Account { |
| 15 | constexpr size_t MAX_USERS = 8; | 15 | constexpr std::size_t MAX_USERS = 8; |
| 16 | constexpr size_t MAX_DATA = 128; | 16 | constexpr std::size_t MAX_DATA = 128; |
| 17 | constexpr u128 INVALID_UUID{{0, 0}}; | 17 | constexpr u128 INVALID_UUID{{0, 0}}; |
| 18 | 18 | ||
| 19 | struct UUID { | 19 | struct UUID { |
| @@ -87,18 +87,18 @@ public: | |||
| 87 | ResultCode AddUser(const ProfileInfo& user); | 87 | ResultCode AddUser(const ProfileInfo& user); |
| 88 | ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username); | 88 | ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username); |
| 89 | ResultCode CreateNewUser(UUID uuid, const std::string& username); | 89 | ResultCode CreateNewUser(UUID uuid, const std::string& username); |
| 90 | boost::optional<size_t> GetUserIndex(const UUID& uuid) const; | 90 | boost::optional<std::size_t> GetUserIndex(const UUID& uuid) const; |
| 91 | boost::optional<size_t> GetUserIndex(const ProfileInfo& user) const; | 91 | boost::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const; |
| 92 | bool GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const; | 92 | bool GetProfileBase(boost::optional<std::size_t> index, ProfileBase& profile) const; |
| 93 | bool GetProfileBase(UUID uuid, ProfileBase& profile) const; | 93 | bool GetProfileBase(UUID uuid, ProfileBase& profile) const; |
| 94 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; | 94 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; |
| 95 | bool GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile, | 95 | bool GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile, |
| 96 | ProfileData& data) const; | 96 | ProfileData& data) const; |
| 97 | bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const; | 97 | bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const; |
| 98 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, | 98 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, |
| 99 | ProfileData& data) const; | 99 | ProfileData& data) const; |
| 100 | size_t GetUserCount() const; | 100 | std::size_t GetUserCount() const; |
| 101 | size_t GetOpenUserCount() const; | 101 | std::size_t GetOpenUserCount() const; |
| 102 | bool UserExists(UUID uuid) const; | 102 | bool UserExists(UUID uuid) const; |
| 103 | void OpenUser(UUID uuid); | 103 | void OpenUser(UUID uuid); |
| 104 | void CloseUser(UUID uuid); | 104 | void CloseUser(UUID uuid); |
| @@ -110,9 +110,9 @@ public: | |||
| 110 | 110 | ||
| 111 | private: | 111 | private: |
| 112 | std::array<ProfileInfo, MAX_USERS> profiles{}; | 112 | std::array<ProfileInfo, MAX_USERS> profiles{}; |
| 113 | size_t user_count = 0; | 113 | std::size_t user_count = 0; |
| 114 | boost::optional<size_t> AddToProfiles(const ProfileInfo& profile); | 114 | boost::optional<std::size_t> AddToProfiles(const ProfileInfo& profile); |
| 115 | bool RemoveProfileAtIndex(size_t index); | 115 | bool RemoveProfileAtIndex(std::size_t index); |
| 116 | UUID last_opened_user{INVALID_UUID}; | 116 | UUID last_opened_user{INVALID_UUID}; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index a57ed3042..d1f7007ec 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -456,7 +456,7 @@ private: | |||
| 456 | IPC::RequestParser rp{ctx}; | 456 | IPC::RequestParser rp{ctx}; |
| 457 | 457 | ||
| 458 | const u64 offset{rp.Pop<u64>()}; | 458 | const u64 offset{rp.Pop<u64>()}; |
| 459 | const size_t size{ctx.GetWriteBufferSize()}; | 459 | const std::size_t size{ctx.GetWriteBufferSize()}; |
| 460 | 460 | ||
| 461 | ASSERT(offset + size <= buffer.size()); | 461 | ASSERT(offset + size <= buffer.size()); |
| 462 | 462 | ||
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index 668fef145..fc6067e59 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp | |||
| @@ -61,7 +61,7 @@ private: | |||
| 61 | 61 | ||
| 62 | bool Decoder_DecodeInterleaved(u32& consumed, u32& sample_count, const std::vector<u8>& input, | 62 | bool Decoder_DecodeInterleaved(u32& consumed, u32& sample_count, const std::vector<u8>& input, |
| 63 | std::vector<opus_int16>& output) { | 63 | std::vector<opus_int16>& output) { |
| 64 | size_t raw_output_sz = output.size() * sizeof(opus_int16); | 64 | std::size_t raw_output_sz = output.size() * sizeof(opus_int16); |
| 65 | if (sizeof(OpusHeader) > input.size()) | 65 | if (sizeof(OpusHeader) > input.size()) |
| 66 | return false; | 66 | return false; |
| 67 | OpusHeader hdr{}; | 67 | OpusHeader hdr{}; |
| @@ -96,7 +96,7 @@ private: | |||
| 96 | u32 channel_count; | 96 | u32 channel_count; |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | static size_t WorkerBufferSize(u32 channel_count) { | 99 | static std::size_t WorkerBufferSize(u32 channel_count) { |
| 100 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); | 100 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); |
| 101 | return opus_decoder_get_size(static_cast<int>(channel_count)); | 101 | return opus_decoder_get_size(static_cast<int>(channel_count)); |
| 102 | } | 102 | } |
| @@ -129,7 +129,7 @@ void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) { | |||
| 129 | "Invalid sample rate"); | 129 | "Invalid sample rate"); |
| 130 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); | 130 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); |
| 131 | 131 | ||
| 132 | size_t worker_sz = WorkerBufferSize(channel_count); | 132 | std::size_t worker_sz = WorkerBufferSize(channel_count); |
| 133 | ASSERT_MSG(buffer_sz < worker_sz, "Worker buffer too large"); | 133 | ASSERT_MSG(buffer_sz < worker_sz, "Worker buffer too large"); |
| 134 | std::unique_ptr<OpusDecoder, OpusDeleter> decoder{ | 134 | std::unique_ptr<OpusDecoder, OpusDeleter> decoder{ |
| 135 | static_cast<OpusDecoder*>(operator new(worker_sz))}; | 135 | static_cast<OpusDecoder*>(operator new(worker_sz))}; |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index a8e0c869f..ab2f17db9 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -89,7 +89,7 @@ private: | |||
| 89 | controller_header.left_color_body = JOYCON_BODY_NEON_BLUE; | 89 | controller_header.left_color_body = JOYCON_BODY_NEON_BLUE; |
| 90 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; | 90 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; |
| 91 | 91 | ||
| 92 | for (size_t controller = 0; controller < mem.controllers.size(); controller++) { | 92 | for (std::size_t controller = 0; controller < mem.controllers.size(); controller++) { |
| 93 | for (auto& layout : mem.controllers[controller].layouts) { | 93 | for (auto& layout : mem.controllers[controller].layouts) { |
| 94 | layout.header.num_entries = HID_NUM_ENTRIES; | 94 | layout.header.num_entries = HID_NUM_ENTRIES; |
| 95 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; | 95 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; |
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 098da2a41..c89157a4d 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp | |||
| @@ -99,7 +99,7 @@ private: | |||
| 99 | std::string thread; | 99 | std::string thread; |
| 100 | while (addr < end_addr) { | 100 | while (addr < end_addr) { |
| 101 | const Field field{static_cast<Field>(Memory::Read8(addr++))}; | 101 | const Field field{static_cast<Field>(Memory::Read8(addr++))}; |
| 102 | const size_t length{Memory::Read8(addr++)}; | 102 | const std::size_t length{Memory::Read8(addr++)}; |
| 103 | 103 | ||
| 104 | if (static_cast<Field>(Memory::Read8(addr)) == Field::Skip) { | 104 | if (static_cast<Field>(Memory::Read8(addr)) == Field::Skip) { |
| 105 | ++addr; | 105 | ++addr; |
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index 447689a1a..1069d103f 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp | |||
| @@ -78,7 +78,7 @@ enum class LoadState : u32 { | |||
| 78 | }; | 78 | }; |
| 79 | 79 | ||
| 80 | static void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, | 80 | static void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, |
| 81 | size_t& offset) { | 81 | std::size_t& offset) { |
| 82 | ASSERT_MSG(offset + (input.size() * sizeof(u32)) < SHARED_FONT_MEM_SIZE, | 82 | ASSERT_MSG(offset + (input.size() * sizeof(u32)) < SHARED_FONT_MEM_SIZE, |
| 83 | "Shared fonts exceeds 17mb!"); | 83 | "Shared fonts exceeds 17mb!"); |
| 84 | ASSERT_MSG(input[0] == EXPECTED_MAGIC, "Failed to derive key, unexpected magic number"); | 84 | ASSERT_MSG(input[0] == EXPECTED_MAGIC, "Failed to derive key, unexpected magic number"); |
| @@ -95,7 +95,7 @@ static void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& ou | |||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static void EncryptSharedFont(const std::vector<u8>& input, std::vector<u8>& output, | 97 | static void EncryptSharedFont(const std::vector<u8>& input, std::vector<u8>& output, |
| 98 | size_t& offset) { | 98 | std::size_t& offset) { |
| 99 | ASSERT_MSG(offset + input.size() + 8 < SHARED_FONT_MEM_SIZE, "Shared fonts exceeds 17mb!"); | 99 | ASSERT_MSG(offset + input.size() + 8 < SHARED_FONT_MEM_SIZE, "Shared fonts exceeds 17mb!"); |
| 100 | const u32 KEY = EXPECTED_MAGIC ^ EXPECTED_RESULT; | 100 | const u32 KEY = EXPECTED_MAGIC ^ EXPECTED_RESULT; |
| 101 | std::memcpy(output.data() + offset, &EXPECTED_RESULT, sizeof(u32)); // Magic header | 101 | std::memcpy(output.data() + offset, &EXPECTED_RESULT, sizeof(u32)); // Magic header |
| @@ -113,7 +113,7 @@ static u32 GetU32Swapped(const u8* data) { | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | struct PL_U::Impl { | 115 | struct PL_U::Impl { |
| 116 | const FontRegion& GetSharedFontRegion(size_t index) const { | 116 | const FontRegion& GetSharedFontRegion(std::size_t index) const { |
| 117 | if (index >= shared_font_regions.size() || shared_font_regions.empty()) { | 117 | if (index >= shared_font_regions.size() || shared_font_regions.empty()) { |
| 118 | // No font fallback | 118 | // No font fallback |
| 119 | return EMPTY_REGION; | 119 | return EMPTY_REGION; |
| @@ -126,7 +126,7 @@ struct PL_U::Impl { | |||
| 126 | // based on the shared memory dump | 126 | // based on the shared memory dump |
| 127 | unsigned cur_offset = 0; | 127 | unsigned cur_offset = 0; |
| 128 | 128 | ||
| 129 | for (size_t i = 0; i < SHARED_FONTS.size(); i++) { | 129 | for (std::size_t i = 0; i < SHARED_FONTS.size(); i++) { |
| 130 | // Out of shared fonts/invalid font | 130 | // Out of shared fonts/invalid font |
| 131 | if (GetU32Swapped(input.data() + cur_offset) != EXPECTED_RESULT) { | 131 | if (GetU32Swapped(input.data() + cur_offset) != EXPECTED_RESULT) { |
| 132 | break; | 132 | break; |
| @@ -162,7 +162,7 @@ PL_U::PL_U() : ServiceFramework("pl:u"), impl{std::make_unique<Impl>()} { | |||
| 162 | RegisterHandlers(functions); | 162 | RegisterHandlers(functions); |
| 163 | // Attempt to load shared font data from disk | 163 | // Attempt to load shared font data from disk |
| 164 | const auto nand = FileSystem::GetSystemNANDContents(); | 164 | const auto nand = FileSystem::GetSystemNANDContents(); |
| 165 | size_t offset = 0; | 165 | std::size_t offset = 0; |
| 166 | // Rebuild shared fonts from data ncas | 166 | // Rebuild shared fonts from data ncas |
| 167 | if (nand->HasEntry(static_cast<u64>(FontArchives::Standard), | 167 | if (nand->HasEntry(static_cast<u64>(FontArchives::Standard), |
| 168 | FileSys::ContentRecordType::Data)) { | 168 | FileSys::ContentRecordType::Data)) { |
| @@ -344,7 +344,7 @@ void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { | |||
| 344 | std::vector<u32> font_sizes; | 344 | std::vector<u32> font_sizes; |
| 345 | 345 | ||
| 346 | // TODO(ogniK): Have actual priority order | 346 | // TODO(ogniK): Have actual priority order |
| 347 | for (size_t i = 0; i < impl->shared_font_regions.size(); i++) { | 347 | for (std::size_t i = 0; i < impl->shared_font_regions.size(); i++) { |
| 348 | font_codes.push_back(static_cast<u32>(i)); | 348 | font_codes.push_back(static_cast<u32>(i)); |
| 349 | auto region = impl->GetSharedFontRegion(i); | 349 | auto region = impl->GetSharedFontRegion(i); |
| 350 | font_offsets.push_back(region.offset); | 350 | font_offsets.push_back(region.offset); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index 25d5a93fa..d8b8037a8 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | |||
| @@ -71,7 +71,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) { | 73 | u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) { |
| 74 | size_t num_entries = input.size() / sizeof(IoctlRemapEntry); | 74 | std::size_t num_entries = input.size() / sizeof(IoctlRemapEntry); |
| 75 | 75 | ||
| 76 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries); | 76 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries); |
| 77 | 77 | ||
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 7455ddd19..d47b6f659 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | namespace Service::NVFlinger { | 24 | namespace Service::NVFlinger { |
| 25 | 25 | ||
| 26 | constexpr size_t SCREEN_REFRESH_RATE = 60; | 26 | constexpr std::size_t SCREEN_REFRESH_RATE = 60; |
| 27 | constexpr u64 frame_ticks = static_cast<u64>(CoreTiming::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE); | 27 | constexpr u64 frame_ticks = static_cast<u64>(CoreTiming::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE); |
| 28 | 28 | ||
| 29 | NVFlinger::NVFlinger() { | 29 | NVFlinger::NVFlinger() { |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 9bb7c7b26..5c007d9f1 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -129,9 +129,9 @@ Kernel::SharedPtr<Kernel::ClientPort> ServiceFrameworkBase::CreatePort() { | |||
| 129 | return client_port; | 129 | return client_port; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, size_t n) { | 132 | void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) { |
| 133 | handlers.reserve(handlers.size() + n); | 133 | handlers.reserve(handlers.size() + n); |
| 134 | for (size_t i = 0; i < n; ++i) { | 134 | for (std::size_t i = 0; i < n; ++i) { |
| 135 | // Usually this array is sorted by id already, so hint to insert at the end | 135 | // Usually this array is sorted by id already, so hint to insert at the end |
| 136 | handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]); | 136 | handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]); |
| 137 | } | 137 | } |
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 7a051523e..2fc57a82e 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -88,7 +88,7 @@ private: | |||
| 88 | ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker); | 88 | ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker); |
| 89 | ~ServiceFrameworkBase(); | 89 | ~ServiceFrameworkBase(); |
| 90 | 90 | ||
| 91 | void RegisterHandlersBase(const FunctionInfoBase* functions, size_t n); | 91 | void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n); |
| 92 | void ReportUnimplementedFunction(Kernel::HLERequestContext& ctx, const FunctionInfoBase* info); | 92 | void ReportUnimplementedFunction(Kernel::HLERequestContext& ctx, const FunctionInfoBase* info); |
| 93 | 93 | ||
| 94 | /// Identifier string used to connect to the service. | 94 | /// Identifier string used to connect to the service. |
| @@ -152,7 +152,7 @@ protected: | |||
| 152 | : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} | 152 | : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} |
| 153 | 153 | ||
| 154 | /// Registers handlers in the service. | 154 | /// Registers handlers in the service. |
| 155 | template <size_t N> | 155 | template <std::size_t N> |
| 156 | void RegisterHandlers(const FunctionInfo (&functions)[N]) { | 156 | void RegisterHandlers(const FunctionInfo (&functions)[N]) { |
| 157 | RegisterHandlers(functions, N); | 157 | RegisterHandlers(functions, N); |
| 158 | } | 158 | } |
| @@ -161,7 +161,7 @@ protected: | |||
| 161 | * Registers handlers in the service. Usually prefer using the other RegisterHandlers | 161 | * Registers handlers in the service. Usually prefer using the other RegisterHandlers |
| 162 | * overload in order to avoid needing to specify the array size. | 162 | * overload in order to avoid needing to specify the array size. |
| 163 | */ | 163 | */ |
| 164 | void RegisterHandlers(const FunctionInfo* functions, size_t n) { | 164 | void RegisterHandlers(const FunctionInfo* functions, std::size_t n) { |
| 165 | RegisterHandlersBase(functions, n); | 165 | RegisterHandlersBase(functions, n); |
| 166 | } | 166 | } |
| 167 | 167 | ||
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 59eb20155..9e5af7839 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp | |||
| @@ -32,21 +32,21 @@ constexpr std::array<LanguageCode, 17> available_language_codes = {{ | |||
| 32 | LanguageCode::ZH_HANT, | 32 | LanguageCode::ZH_HANT, |
| 33 | }}; | 33 | }}; |
| 34 | 34 | ||
| 35 | constexpr size_t pre4_0_0_max_entries = 0xF; | 35 | constexpr std::size_t pre4_0_0_max_entries = 0xF; |
| 36 | constexpr size_t post4_0_0_max_entries = 0x40; | 36 | constexpr std::size_t post4_0_0_max_entries = 0x40; |
| 37 | 37 | ||
| 38 | LanguageCode GetLanguageCodeFromIndex(size_t index) { | 38 | LanguageCode GetLanguageCodeFromIndex(std::size_t index) { |
| 39 | return available_language_codes.at(index); | 39 | return available_language_codes.at(index); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | template <size_t size> | 42 | template <std::size_t size> |
| 43 | static std::array<LanguageCode, size> MakeLanguageCodeSubset() { | 43 | static std::array<LanguageCode, size> MakeLanguageCodeSubset() { |
| 44 | std::array<LanguageCode, size> arr; | 44 | std::array<LanguageCode, size> arr; |
| 45 | std::copy_n(available_language_codes.begin(), size, arr.begin()); | 45 | std::copy_n(available_language_codes.begin(), size, arr.begin()); |
| 46 | return arr; | 46 | return arr; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | static void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, size_t max_size) { | 49 | static void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, std::size_t max_size) { |
| 50 | IPC::ResponseBuilder rb{ctx, 3}; | 50 | IPC::ResponseBuilder rb{ctx, 3}; |
| 51 | rb.Push(RESULT_SUCCESS); | 51 | rb.Push(RESULT_SUCCESS); |
| 52 | if (available_language_codes.size() > max_size) | 52 | if (available_language_codes.size() > max_size) |
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h index 5f0214359..266f13e46 100644 --- a/src/core/hle/service/set/set.h +++ b/src/core/hle/service/set/set.h | |||
| @@ -28,7 +28,7 @@ enum class LanguageCode : u64 { | |||
| 28 | ZH_HANS = 0x00736E61482D687A, | 28 | ZH_HANS = 0x00736E61482D687A, |
| 29 | ZH_HANT = 0x00746E61482D687A, | 29 | ZH_HANT = 0x00746E61482D687A, |
| 30 | }; | 30 | }; |
| 31 | LanguageCode GetLanguageCodeFromIndex(size_t idx); | 31 | LanguageCode GetLanguageCodeFromIndex(std::size_t idx); |
| 32 | 32 | ||
| 33 | class SET final : public ServiceFramework<SET> { | 33 | class SET final : public ServiceFramework<SET> { |
| 34 | public: | 34 | public: |
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index 0d8441fb1..44a6717d0 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp | |||
| @@ -21,7 +21,7 @@ Module::Interface::~Interface() = default; | |||
| 21 | void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { | 21 | void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { |
| 22 | IPC::RequestParser rp{ctx}; | 22 | IPC::RequestParser rp{ctx}; |
| 23 | 23 | ||
| 24 | size_t size = ctx.GetWriteBufferSize(); | 24 | std::size_t size = ctx.GetWriteBufferSize(); |
| 25 | 25 | ||
| 26 | std::vector<u8> data(size); | 26 | std::vector<u8> data(size); |
| 27 | std::generate(data.begin(), data.end(), std::rand); | 27 | std::generate(data.begin(), data.end(), std::rand); |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index cf94b00e6..13545d50a 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -38,7 +38,7 @@ static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size"); | |||
| 38 | class Parcel { | 38 | class Parcel { |
| 39 | public: | 39 | public: |
| 40 | // This default size was chosen arbitrarily. | 40 | // This default size was chosen arbitrarily. |
| 41 | static constexpr size_t DefaultBufferSize = 0x40; | 41 | static constexpr std::size_t DefaultBufferSize = 0x40; |
| 42 | Parcel() : buffer(DefaultBufferSize) {} | 42 | Parcel() : buffer(DefaultBufferSize) {} |
| 43 | explicit Parcel(std::vector<u8> data) : buffer(std::move(data)) {} | 43 | explicit Parcel(std::vector<u8> data) : buffer(std::move(data)) {} |
| 44 | virtual ~Parcel() = default; | 44 | virtual ~Parcel() = default; |
| @@ -66,7 +66,7 @@ public: | |||
| 66 | return val; | 66 | return val; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | std::vector<u8> ReadBlock(size_t length) { | 69 | std::vector<u8> ReadBlock(std::size_t length) { |
| 70 | ASSERT(read_index + length <= buffer.size()); | 70 | ASSERT(read_index + length <= buffer.size()); |
| 71 | const u8* const begin = buffer.data() + read_index; | 71 | const u8* const begin = buffer.data() + read_index; |
| 72 | const u8* const end = begin + length; | 72 | const u8* const end = begin + length; |
| @@ -156,8 +156,8 @@ private: | |||
| 156 | static_assert(sizeof(Header) == 16, "ParcelHeader has wrong size"); | 156 | static_assert(sizeof(Header) == 16, "ParcelHeader has wrong size"); |
| 157 | 157 | ||
| 158 | std::vector<u8> buffer; | 158 | std::vector<u8> buffer; |
| 159 | size_t read_index = 0; | 159 | std::size_t read_index = 0; |
| 160 | size_t write_index = 0; | 160 | std::size_t write_index = 0; |
| 161 | }; | 161 | }; |
| 162 | 162 | ||
| 163 | class NativeWindow : public Parcel { | 163 | class NativeWindow : public Parcel { |