mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	common: Port some changes from dolphin (#5127)
* IOFile: Make the move constructor and move assignment operator noexcept Certain parts of the standard library try to determine whether or not a transfer operation should either be a copy or a move. The prevalent notion of move constructors/assignment operators is that they should not throw, they simply move an already existing resource somewhere else. This is typically done with 'std::move_if_noexcept'. Like the name says, if a type's move constructor is noexcept, then the functions retrieves an r-value reference (for move semantics), or an l-value (for copy semantics) if it is not noexcept. As IOFile deletes the copy constructor and copy assignment operators, using IOFile with certain parts of the standard library can fail in unexcepted ways (especially when used with various container implementations). This prevents that. * fix various instances of -1 being assigned to unsigned types * do not assign in conditional statements * File/IOFile: Check _tfopen_s properly * common/file_util.cpp: address review comments Co-authored-by: Lioncash <mathew1800@gmail.com> Co-authored-by: Shawn Hoffman <godisgovernment@gmail.com> Co-authored-by: Sepalani <sepalani@hotmail.fr>
This commit is contained in:
		
							parent
							
								
									25ebf03c35
								
							
						
					
					
						commit
						480d3aaf19
					
				
					 3 changed files with 20 additions and 21 deletions
				
			
		|  | @ -216,10 +216,10 @@ public: | |||
| 
 | ||||
|     ~IOFile(); | ||||
| 
 | ||||
|     IOFile(IOFile&& other); | ||||
|     IOFile& operator=(IOFile&& other); | ||||
|     IOFile(IOFile&& other) noexcept; | ||||
|     IOFile& operator=(IOFile&& other) noexcept; | ||||
| 
 | ||||
|     void Swap(IOFile& other); | ||||
|     void Swap(IOFile& other) noexcept; | ||||
| 
 | ||||
|     bool Open(const std::string& filename, const char openmode[], int flags = 0); | ||||
|     bool Close(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue