mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Apply suggestions from code review
Co-Authored-By: Mat M. <mathew1800@gmail.com>
This commit is contained in:
		
							parent
							
								
									841255cd16
								
							
						
					
					
						commit
						8f059ae398
					
				
					 9 changed files with 23 additions and 22 deletions
				
			
		|  | @ -4,7 +4,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include "boost/archive/binary_iarchive.hpp" | ||||
| #include <boost/archive/binary_iarchive.hpp> | ||||
| #include "boost/archive/binary_oarchive.hpp" | ||||
| #include "boost/serialization/export.hpp" | ||||
| 
 | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ private: | |||
| class BufferMem : public BackingMem { | ||||
| public: | ||||
|     BufferMem() = default; | ||||
|     BufferMem(u32 size) : data(std::vector<u8>(size)) {} | ||||
|     explicit BufferMem(std::size_t size) : data(size) {} | ||||
| 
 | ||||
|     u8* GetPtr() override { | ||||
|         return data.data(); | ||||
|  | @ -77,7 +77,7 @@ public: | |||
|     inline u8* GetPtr() { | ||||
|         return cptr; | ||||
|     } | ||||
|     inline operator bool() const { | ||||
|     explicit operator bool() const { | ||||
|         return cptr != nullptr; | ||||
|     } | ||||
|     inline const u8* GetPtr() const { | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ void load(Archive& ar, boost::container::flat_set<T>& set, const unsigned int fi | |||
|     u64 count{}; | ||||
|     ar >> count; | ||||
|     set.clear(); | ||||
|     for (auto i = 0; i < count; i++) { | ||||
|     for (u64 i = 0; i < count; i++) { | ||||
|         T value{}; | ||||
|         ar >> value; | ||||
|         set.insert(value); | ||||
|  |  | |||
|  | @ -167,7 +167,7 @@ private: | |||
|         } else if (q == UnlinkedTag()) { | ||||
|             return -1; | ||||
|         } else { | ||||
|             return static_cast<s32>(q - &queues[0]); | ||||
|             return q - queues.data(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | @ -186,8 +186,8 @@ private: | |||
|     void save(Archive& ar, const unsigned int file_version) const { | ||||
|         s32 idx = ToIndex(first); | ||||
|         ar << idx; | ||||
|         for (auto i = 0; i < NUM_QUEUES; i++) { | ||||
|             s32 idx1 = ToIndex(queues[i].next_nonempty); | ||||
|         for (size_t i = 0; i < NUM_QUEUES; i++) { | ||||
|             const s32 idx1 = ToIndex(queues[i].next_nonempty); | ||||
|             ar << idx1; | ||||
|             ar << queues[i].data; | ||||
|         } | ||||
|  |  | |||
|  | @ -28,12 +28,12 @@ public: | |||
| 
 | ||||
|         template <class Archive> | ||||
|         void save(Archive& ar, const unsigned int file_version) const { | ||||
|             for (auto i = 0; i < 16; i++) { | ||||
|                 auto r = GetCpuRegister(i); | ||||
|             for (size_t i = 0; i < 16; i++) { | ||||
|                 const auto r = GetCpuRegister(i); | ||||
|                 ar << r; | ||||
|             } | ||||
|             for (auto i = 0; i < 16; i++) { | ||||
|                 auto r = GetFpuRegister(i); | ||||
|             for (size_t i = 0; i < 16; i++) { | ||||
|                 const auto r = GetFpuRegister(i); | ||||
|                 ar << r; | ||||
|             } | ||||
|             auto r1 = GetCpsr(); | ||||
|  | @ -47,11 +47,11 @@ public: | |||
|         template <class Archive> | ||||
|         void load(Archive& ar, const unsigned int file_version) { | ||||
|             u32 r; | ||||
|             for (auto i = 0; i < 16; i++) { | ||||
|             for (size_t i = 0; i < 16; i++) { | ||||
|                 ar >> r; | ||||
|                 SetCpuRegister(i, r); | ||||
|             } | ||||
|             for (auto i = 0; i < 16; i++) { | ||||
|             for (size_t i = 0; i < 16; i++) { | ||||
|                 ar >> r; | ||||
|                 SetFpuRegister(i, r); | ||||
|             } | ||||
|  | @ -247,7 +247,7 @@ private: | |||
|         ar << id; | ||||
|         auto page_table = GetPageTable(); | ||||
|         ar << page_table; | ||||
|         for (auto i = 0; i < 15; i++) { | ||||
|         for (size_t i = 0; i < 15; i++) { | ||||
|             auto r = GetReg(i); | ||||
|             ar << r; | ||||
|         } | ||||
|  | @ -255,7 +255,7 @@ private: | |||
|         ar << pc; | ||||
|         auto cpsr = GetCPSR(); | ||||
|         ar << cpsr; | ||||
|         for (auto i = 0; i < 32; i++) { | ||||
|         for (size_t i = 0; i < 32; i++) { | ||||
|             auto r = GetVFPReg(i); | ||||
|             ar << r; | ||||
|         } | ||||
|  | @ -278,7 +278,7 @@ private: | |||
|         ar >> page_table; | ||||
|         SetPageTable(page_table); | ||||
|         u32 r; | ||||
|         for (auto i = 0; i < 15; i++) { | ||||
|         for (size_t = 0; i < 15; i++) { | ||||
|             ar >> r; | ||||
|             SetReg(i, r); | ||||
|         } | ||||
|  |  | |||
|  | @ -58,7 +58,7 @@ public: | |||
|     ConfigMemDef& GetConfigMem(); | ||||
| 
 | ||||
|     u8* GetPtr() override { | ||||
|         return static_cast<u8*>(static_cast<void*>(&config_mem)); | ||||
|         return reinterpret_cast<u8*>(&config_mem)); | ||||
|     } | ||||
| 
 | ||||
|     u32 GetSize() const override { | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ class HLERequestContext::ThreadCallback : public Kernel::WakeupCallback { | |||
| public: | ||||
|     ThreadCallback(std::shared_ptr<HLERequestContext> context_, | ||||
|                    std::shared_ptr<HLERequestContext::WakeupCallback> callback_) | ||||
|         : context(context_), callback(callback_) {} | ||||
|         : context(std::move(context_)), callback(std::move(callback_)) {} | ||||
|     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||||
|                 std::shared_ptr<WaitObject> object) { | ||||
|         ASSERT(thread->status == ThreadStatus::WaitHleEvent); | ||||
|  | @ -296,7 +296,7 @@ MappedBuffer::MappedBuffer() : memory(&Core::Global<Core::System>().Memory()) {} | |||
| 
 | ||||
| MappedBuffer::MappedBuffer(Memory::MemorySystem& memory, std::shared_ptr<Process> process, | ||||
|                            u32 descriptor, VAddr address, u32 id) | ||||
|     : memory(&memory), id(id), address(address), process(process) { | ||||
|     : memory(&memory), id(id), address(address), process(std::move(process)) { | ||||
|     IPC::MappedBufferDescInfo desc{descriptor}; | ||||
|     size = desc.size; | ||||
|     perms = desc.perms; | ||||
|  |  | |||
|  | @ -24,7 +24,8 @@ KernelSystem::KernelSystem(Memory::MemorySystem& memory, Core::Timing& timing, | |||
|                            u32 num_cores, u8 n3ds_mode) | ||||
|     : memory(memory), timing(timing), | ||||
|       prepare_reschedule_callback(std::move(prepare_reschedule_callback)) { | ||||
|     for (auto i = 0; i < memory_regions.size(); i++) { | ||||
| std::generate(memory_regions.begin(), memory_regions.end(), | ||||
|               [] { return std::make_shared<MemoryRegionInfo>(); }); | ||||
|         memory_regions[i] = std::make_shared<MemoryRegionInfo>(); | ||||
|     } | ||||
|     MemoryInit(system_mode, n3ds_mode); | ||||
|  |  | |||
|  | @ -409,7 +409,7 @@ static ResultCode ReceiveIPCRequest(Kernel::KernelSystem& kernel, Memory::Memory | |||
| 
 | ||||
| class SVC_SyncCallback : public Kernel::WakeupCallback { | ||||
| public: | ||||
|     SVC_SyncCallback(bool do_output_) : do_output(do_output_) {} | ||||
|     explicit SVC_SyncCallback(bool do_output_) : do_output(do_output_) {} | ||||
|     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||||
|                 std::shared_ptr<WaitObject> object) { | ||||
| 
 | ||||
|  | @ -442,7 +442,7 @@ private: | |||
| 
 | ||||
| class SVC_IPCCallback : public Kernel::WakeupCallback { | ||||
| public: | ||||
|     SVC_IPCCallback(Core::System& system_) : system(system_) {} | ||||
|     explicit SVC_IPCCallback(Core::System& system_) : system(system_) {} | ||||
| 
 | ||||
|     void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||||
|                 std::shared_ptr<WaitObject> object) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue