mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	misc: fix issues pointed out by msvc (#7316)
* do not move constant variables
* applet_manager: avoid possible use after move
* use constant references where pointed out by msvc
* extra_hid: initialize response
* ValidateSaveState: passing slot separately is not necessary
* common: mark HashCombine as nodiscard
* cityhash: remove use of using namespace std
* Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
based on 7d8f115
* shared_memory.cpp: fix log error format
* fix compiling with pch off
			
			
This commit is contained in:
		
							parent
							
								
									6069fac76d
								
							
						
					
					
						commit
						c8c2beaeff
					
				
					 73 changed files with 181 additions and 167 deletions
				
			
		|  | @ -57,9 +57,9 @@ static bool LZSS_Decompress(std::span<const u8> compressed, std::span<u8> decomp | |||
|     u32 buffer_top_and_bottom; | ||||
|     std::memcpy(&buffer_top_and_bottom, footer, sizeof(u32)); | ||||
| 
 | ||||
|     size_t out = decompressed.size(); | ||||
|     size_t index = compressed.size() - ((buffer_top_and_bottom >> 24) & 0xFF); | ||||
|     size_t stop_index = compressed.size() - (buffer_top_and_bottom & 0xFFFFFF); | ||||
|     std::size_t out = decompressed.size(); | ||||
|     std::size_t index = compressed.size() - ((buffer_top_and_bottom >> 24) & 0xFF); | ||||
|     std::size_t stop_index = compressed.size() - (buffer_top_and_bottom & 0xFFFFFF); | ||||
| 
 | ||||
|     std::memset(decompressed.data(), 0, decompressed.size()); | ||||
|     std::memcpy(decompressed.data(), compressed.data(), compressed.size()); | ||||
|  |  | |||
|  | @ -131,7 +131,7 @@ public: | |||
|         return m_offset; | ||||
|     } | ||||
| 
 | ||||
|     bool Seek(size_t offset) { | ||||
|     bool Seek(std::size_t offset) { | ||||
|         if (offset > m_size) | ||||
|             return false; | ||||
|         m_offset = offset; | ||||
|  | @ -242,7 +242,7 @@ private: | |||
|         if (m_target_relative_offset + length > m_target.size()) | ||||
|             return false; | ||||
|         // Byte by byte copy.
 | ||||
|         for (size_t i = 0; i < length; ++i) | ||||
|         for (std::size_t i = 0; i < length; ++i) | ||||
|             m_target.data()[m_target.Tell() + i] = m_target.data()[m_target_relative_offset++]; | ||||
|         m_target.Seek(m_target.Tell() + length); | ||||
|         return true; | ||||
|  |  | |||
|  | @ -357,7 +357,7 @@ void FileSys::Plugin3GXLoader::MapBootloader(Kernel::Process& process, Kernel::K | |||
|     // Write bootloader
 | ||||
|     kernel.memory.WriteBlock( | ||||
|         process, _3GX_exe_load_addr - bootloader_memory_size, bootloader.data(), | ||||
|         std::min<size_t>(bootloader.size() * sizeof(u32), bootloader_memory_size)); | ||||
|         std::min<std::size_t>(bootloader.size() * sizeof(u32), bootloader_memory_size)); | ||||
| 
 | ||||
|     game_instructions[0] = 0xE51FF004; // ldr pc, [pc, #-4]
 | ||||
|     game_instructions[1] = _3GX_exe_load_addr - bootloader_memory_size; | ||||
|  |  | |||
|  | @ -72,7 +72,7 @@ private: | |||
|                              Kernel::Process& process, Kernel::KernelSystem& kernel, | ||||
|                              Service::PLGLDR::PLG_LDR& plg_ldr); | ||||
| 
 | ||||
|     static constexpr size_t bootloader_memory_size = 0x1000; | ||||
|     static constexpr std::size_t bootloader_memory_size = 0x1000; | ||||
|     static void MapBootloader(Kernel::Process& process, Kernel::KernelSystem& kernel, | ||||
|                               u32 memory_offset, std::span<const u32> exe_load_func, | ||||
|                               const u32_le* exe_load_args, u32 checksum_size, u32 exe_checksum, | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ std::size_t DirectRomFSReader::ReadFile(std::size_t offset, std::size_t length, | |||
|         return 0; // Crypto++ does not like zero size buffer
 | ||||
| 
 | ||||
|     const auto segments = BreakupRead(offset, length); | ||||
|     size_t read_progress = 0; | ||||
|     std::size_t read_progress = 0; | ||||
| 
 | ||||
|     // Skip cache if the read is too big
 | ||||
|     if (segments.size() == 1 && segments[0].second > cache_line_size) { | ||||
|  | @ -33,8 +33,8 @@ std::size_t DirectRomFSReader::ReadFile(std::size_t offset, std::size_t length, | |||
|     // TODO(PabloMK7): Make cache thread safe, read the comment in CacheReady function.
 | ||||
|     // std::unique_lock<std::shared_mutex> read_guard(cache_mutex);
 | ||||
|     for (const auto& seg : segments) { | ||||
|         size_t read_size = cache_line_size; | ||||
|         size_t page = OffsetToPage(seg.first); | ||||
|         std::size_t read_size = cache_line_size; | ||||
|         std::size_t page = OffsetToPage(seg.first); | ||||
|         // Check if segment is in cache
 | ||||
|         auto cache_entry = cache.request(page); | ||||
|         if (!cache_entry.first) { | ||||
|  | @ -51,7 +51,7 @@ std::size_t DirectRomFSReader::ReadFile(std::size_t offset, std::size_t length, | |||
|             LOG_TRACE(Service_FS, "RomFS Cache HIT: page={}, length={}, into={}", page, seg.second, | ||||
|                       (seg.first - page)); | ||||
|         } | ||||
|         size_t copy_amount = | ||||
|         std::size_t copy_amount = | ||||
|             (read_size > (seg.first - page)) | ||||
|                 ? std::min((seg.first - page) + seg.second, read_size) - (seg.first - page) | ||||
|                 : 0; | ||||
|  | @ -98,10 +98,10 @@ std::vector<std::pair<std::size_t, std::size_t>> DirectRomFSReader::BreakupRead( | |||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     size_t curr_offset = offset; | ||||
|     std::size_t curr_offset = offset; | ||||
|     while (length) { | ||||
|         size_t next_page = OffsetToPage(curr_offset + cache_line_size); | ||||
|         size_t curr_page_len = std::min(length, next_page - curr_offset); | ||||
|         std::size_t next_page = OffsetToPage(curr_offset + cache_line_size); | ||||
|         std::size_t curr_page_len = std::min(length, next_page - curr_offset); | ||||
|         ret.push_back(std::make_pair(curr_offset, curr_page_len)); | ||||
|         curr_offset = next_page; | ||||
|         length -= curr_page_len; | ||||
|  |  | |||
|  | @ -67,8 +67,8 @@ private: | |||
|     u64 data_size; | ||||
| 
 | ||||
|     // Total cache size: 128KB
 | ||||
|     static constexpr size_t cache_line_size = (1 << 13); // About 8KB
 | ||||
|     static constexpr size_t cache_line_count = 16; | ||||
|     static constexpr std::size_t cache_line_size = (1 << 13); // About 8KB
 | ||||
|     static constexpr std::size_t cache_line_count = 16; | ||||
| 
 | ||||
|     Common::StaticLRUCache<std::size_t, std::array<u8, cache_line_size>, cache_line_count> cache; | ||||
|     // TODO(PabloMK7): Make cache thread safe, read the comment in CacheReady function.
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue