From 63c2e32e207d31ecadd9022e1d7cd705c9febac8 Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Sat, 15 Sep 2018 15:21:06 +0200 Subject: Port #4182 from Citra: "Prefix all size_t with std::" --- src/core/file_sys/vfs.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/core/file_sys/vfs.h') diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h index 5142a3e86..74489b452 100644 --- a/src/core/file_sys/vfs.h +++ b/src/core/file_sys/vfs.h @@ -92,9 +92,9 @@ public: // Retrieves the extension of the file name. virtual std::string GetExtension() const; // Retrieves the size of the file. - virtual size_t GetSize() const = 0; + virtual std::size_t GetSize() const = 0; // Resizes the file to new_size. Returns whether or not the operation was successful. - virtual bool Resize(size_t new_size) = 0; + virtual bool Resize(std::size_t new_size) = 0; // Gets a pointer to the directory containing this file, returning nullptr if there is none. virtual std::shared_ptr GetContainingDirectory() const = 0; @@ -105,15 +105,15 @@ public: // The primary method of reading from the file. Reads length bytes into data starting at offset // into file. Returns number of bytes successfully read. - virtual size_t Read(u8* data, size_t length, size_t offset = 0) const = 0; + virtual std::size_t Read(u8* data, std::size_t length, std::size_t offset = 0) const = 0; // The primary method of writing to the file. Writes length bytes from data starting at offset // into file. Returns number of bytes successfully written. - virtual size_t Write(const u8* data, size_t length, size_t offset = 0) = 0; + virtual std::size_t Write(const u8* data, std::size_t length, std::size_t offset = 0) = 0; // Reads exactly one byte at the offset provided, returning boost::none on error. - virtual boost::optional ReadByte(size_t offset = 0) const; + virtual boost::optional ReadByte(std::size_t offset = 0) const; // Reads size bytes starting at offset in file into a vector. - virtual std::vector ReadBytes(size_t size, size_t offset = 0) const; + virtual std::vector ReadBytes(std::size_t size, std::size_t offset = 0) const; // Reads all the bytes from the file into a vector. Equivalent to 'file->Read(file->GetSize(), // 0)' virtual std::vector ReadAllBytes() const; @@ -121,7 +121,7 @@ public: // Reads an array of type T, size number_elements starting at offset. // Returns the number of bytes (sizeof(T)*number_elements) read successfully. template - size_t ReadArray(T* data, size_t number_elements, size_t offset = 0) const { + std::size_t ReadArray(T* data, std::size_t number_elements, std::size_t offset = 0) const { static_assert(std::is_trivially_copyable_v, "Data type must be trivially copyable."); return Read(reinterpret_cast(data), number_elements * sizeof(T), offset); @@ -130,7 +130,7 @@ public: // Reads size bytes into the memory starting at data starting at offset into the file. // Returns the number of bytes read successfully. template - size_t ReadBytes(T* data, size_t size, size_t offset = 0) const { + std::size_t ReadBytes(T* data, std::size_t size, std::size_t offset = 0) const { static_assert(std::is_trivially_copyable_v, "Data type must be trivially copyable."); return Read(reinterpret_cast(data), size, offset); } @@ -138,22 +138,22 @@ public: // Reads one object of type T starting at offset in file. // Returns the number of bytes read successfully (sizeof(T)). template - size_t ReadObject(T* data, size_t offset = 0) const { + std::size_t ReadObject(T* data, std::size_t offset = 0) const { static_assert(std::is_trivially_copyable_v, "Data type must be trivially copyable."); return Read(reinterpret_cast(data), sizeof(T), offset); } // Writes exactly one byte to offset in file and retuns whether or not the byte was written // successfully. - virtual bool WriteByte(u8 data, size_t offset = 0); + virtual bool WriteByte(u8 data, std::size_t offset = 0); // Writes a vector of bytes to offset in file and returns the number of bytes successfully // written. - virtual size_t WriteBytes(const std::vector& data, size_t offset = 0); + virtual std::size_t WriteBytes(const std::vector& data, std::size_t offset = 0); // Writes an array of type T, size number_elements to offset in file. // Returns the number of bytes (sizeof(T)*number_elements) written successfully. template - size_t WriteArray(const T* data, size_t number_elements, size_t offset = 0) { + std::size_t WriteArray(const T* data, std::size_t number_elements, std::size_t offset = 0) { static_assert(std::is_trivially_copyable_v, "Data type must be trivially copyable."); return Write(data, number_elements * sizeof(T), offset); } @@ -161,7 +161,7 @@ public: // Writes size bytes starting at memory location data to offset in file. // Returns the number of bytes written successfully. template - size_t WriteBytes(const T* data, size_t size, size_t offset = 0) { + std::size_t WriteBytes(const T* data, std::size_t size, std::size_t offset = 0) { static_assert(std::is_trivially_copyable_v, "Data type must be trivially copyable."); return Write(reinterpret_cast(data), size, offset); } @@ -169,7 +169,7 @@ public: // Writes one object of type T to offset in file. // Returns the number of bytes written successfully (sizeof(T)). template - size_t WriteObject(const T& data, size_t offset = 0) { + std::size_t WriteObject(const T& data, std::size_t offset = 0) { static_assert(std::is_trivially_copyable_v, "Data type must be trivially copyable."); return Write(&data, sizeof(T), offset); } @@ -221,7 +221,7 @@ public: // Returns the name of the directory. virtual std::string GetName() const = 0; // Returns the total size of all files and subdirectories in this directory. - virtual size_t GetSize() const; + virtual std::size_t GetSize() const; // Returns the parent directory of this directory. Returns nullptr if this directory is root or // has no parent. virtual std::shared_ptr GetParentDirectory() const = 0; @@ -311,7 +311,7 @@ public: }; // Compare the two files, byte-for-byte, in increments specificed by block_size -bool DeepEquals(const VirtualFile& file1, const VirtualFile& file2, size_t block_size = 0x200); +bool DeepEquals(const VirtualFile& file1, const VirtualFile& file2, std::size_t block_size = 0x200); // A method that copies the raw data between two different implementations of VirtualFile. If you // are using the same implementation, it is probably better to use the Copy method in the parent -- cgit v1.2.3