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`
This commit is contained in:
Weiyi Wang 2018-09-06 16:03:28 -04:00
parent eca98eeb3e
commit 7d8f115185
158 changed files with 669 additions and 634 deletions

View file

@ -20,12 +20,12 @@ public:
virtual ~ThreadContext() = default;
virtual void Reset() = 0;
virtual u32 GetCpuRegister(size_t index) const = 0;
virtual void SetCpuRegister(size_t index, u32 value) = 0;
virtual u32 GetCpuRegister(std::size_t index) const = 0;
virtual void SetCpuRegister(std::size_t index, u32 value) = 0;
virtual u32 GetCpsr() const = 0;
virtual void SetCpsr(u32 value) = 0;
virtual u32 GetFpuRegister(size_t index) const = 0;
virtual void SetFpuRegister(size_t index, u32 value) = 0;
virtual u32 GetFpuRegister(std::size_t index) const = 0;
virtual void SetFpuRegister(std::size_t index, u32 value) = 0;
virtual u32 GetFpscr() const = 0;
virtual void SetFpscr(u32 value) = 0;
virtual u32 GetFpexc() const = 0;
@ -67,7 +67,7 @@ public:
* @param start_address The starting address of the range to invalidate.
* @param length The length (in bytes) of the range to invalidate.
*/
virtual void InvalidateCacheRange(u32 start_address, size_t length) = 0;
virtual void InvalidateCacheRange(u32 start_address, std::size_t length) = 0;
/// Notify CPU emulation that page tables have changed
virtual void PageTableChanged() = 0;

View file

@ -30,10 +30,10 @@ public:
fpexc = 0;
}
u32 GetCpuRegister(size_t index) const override {
u32 GetCpuRegister(std::size_t index) const override {
return ctx.Regs()[index];
}
void SetCpuRegister(size_t index, u32 value) override {
void SetCpuRegister(std::size_t index, u32 value) override {
ctx.Regs()[index] = value;
}
u32 GetCpsr() const override {
@ -42,10 +42,10 @@ public:
void SetCpsr(u32 value) override {
ctx.SetCpsr(value);
}
u32 GetFpuRegister(size_t index) const override {
u32 GetFpuRegister(std::size_t index) const override {
return ctx.ExtRegs()[index];
}
void SetFpuRegister(size_t index, u32 value) override {
void SetFpuRegister(std::size_t index, u32 value) override {
ctx.ExtRegs()[index] = value;
}
u32 GetFpscr() const override {
@ -99,7 +99,7 @@ public:
Memory::Write64(vaddr, value);
}
void InterpreterFallback(VAddr pc, size_t num_instructions) override {
void InterpreterFallback(VAddr pc, std::size_t num_instructions) override {
parent.interpreter_state->Reg = parent.jit->Regs();
parent.interpreter_state->Cpsr = parent.jit->Cpsr();
parent.interpreter_state->Reg[15] = pc;
@ -126,7 +126,7 @@ public:
void ExceptionRaised(VAddr pc, Dynarmic::A32::Exception exception) override {
ASSERT_MSG(false, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})",
static_cast<size_t>(exception), pc, MemoryReadCode(pc));
static_cast<std::size_t>(exception), pc, MemoryReadCode(pc));
}
void AddTicks(std::uint64_t ticks) override {
@ -253,7 +253,7 @@ void ARM_Dynarmic::ClearInstructionCache() {
interpreter_state->instruction_cache.clear();
}
void ARM_Dynarmic::InvalidateCacheRange(u32 start_address, size_t length) {
void ARM_Dynarmic::InvalidateCacheRange(u32 start_address, std::size_t length) {
jit->InvalidateCacheRange(start_address, length);
}

View file

@ -45,7 +45,7 @@ public:
void PrepareReschedule() override;
void ClearInstructionCache() override;
void InvalidateCacheRange(u32 start_address, size_t length) override;
void InvalidateCacheRange(u32 start_address, std::size_t length) override;
void PageTableChanged() override;
private:

View file

@ -27,10 +27,10 @@ public:
fpexc = 0;
}
u32 GetCpuRegister(size_t index) const override {
u32 GetCpuRegister(std::size_t index) const override {
return cpu_registers[index];
}
void SetCpuRegister(size_t index, u32 value) override {
void SetCpuRegister(std::size_t index, u32 value) override {
cpu_registers[index] = value;
}
u32 GetCpsr() const override {
@ -39,10 +39,10 @@ public:
void SetCpsr(u32 value) override {
cpsr = value;
}
u32 GetFpuRegister(size_t index) const override {
u32 GetFpuRegister(std::size_t index) const override {
return fpu_registers[index];
}
void SetFpuRegister(size_t index, u32 value) override {
void SetFpuRegister(std::size_t index, u32 value) override {
fpu_registers[index] = value;
}
u32 GetFpscr() const override {
@ -87,7 +87,7 @@ void ARM_DynCom::ClearInstructionCache() {
trans_cache_buf_top = 0;
}
void ARM_DynCom::InvalidateCacheRange(u32, size_t) {
void ARM_DynCom::InvalidateCacheRange(u32, std::size_t) {
ClearInstructionCache();
}

View file

@ -19,7 +19,7 @@ public:
void Step() override;
void ClearInstructionCache() override;
void InvalidateCacheRange(u32 start_address, size_t length) override;
void InvalidateCacheRange(u32 start_address, std::size_t length) override;
void PageTableChanged() override;
void SetPC(u32 pc) override;

View file

@ -293,7 +293,7 @@ ThumbDecodeStatus TranslateThumbInstruction(u32 addr, u32 instr, u32* ainstr, u3
0xE6FF0FB0, // REVSH
};
size_t subset_index = BITS(tinstr, 6, 7);
std::size_t subset_index = BITS(tinstr, 6, 7);
if (subset_index == 2) {
valid = ThumbDecodeStatus::UNDEFINED;

View file

@ -9,8 +9,8 @@
char trans_cache_buf[TRANS_CACHE_SIZE];
size_t trans_cache_buf_top = 0;
static void* AllocBuffer(size_t size) {
size_t start = trans_cache_buf_top;
static void* AllocBuffer(std::size_t size) {
std::size_t start = trans_cache_buf_top;
trans_cache_buf_top += size;
ASSERT_MSG(trans_cache_buf_top <= TRANS_CACHE_SIZE, "Translation cache is full!");
return static_cast<void*>(&trans_cache_buf[start]);
@ -2015,4 +2015,4 @@ const transop_fp_t arm_instruction_trans[] = {
INTERPRETER_TRANSLATE(blx_1_thumb),
};
const size_t arm_instruction_trans_len = sizeof(arm_instruction_trans) / sizeof(transop_fp_t);
const std::size_t arm_instruction_trans_len = sizeof(arm_instruction_trans) / sizeof(transop_fp_t);

View file

@ -491,8 +491,8 @@ typedef arm_inst* ARM_INST_PTR;
typedef ARM_INST_PTR (*transop_fp_t)(unsigned int, int);
extern const transop_fp_t arm_instruction_trans[];
extern const size_t arm_instruction_trans_len;
extern const std::size_t arm_instruction_trans_len;
#define TRANS_CACHE_SIZE (64 * 1024 * 2000)
extern char trans_cache_buf[TRANS_CACHE_SIZE];
extern size_t trans_cache_buf_top;
extern std::size_t trans_cache_buf_top;

View file

@ -102,7 +102,7 @@ std::vector<u8> Path::AsBinary() const {
case LowPathType::Wchar: {
// use two u8 for each character of u16str
std::vector<u8> to_return(u16str.size() * 2);
for (size_t i = 0; i < u16str.size(); ++i) {
for (std::size_t i = 0; i < u16str.size(); ++i) {
u16 tmp_char = u16str.at(i);
to_return[i * 2] = (tmp_char & 0xFF00) >> 8;
to_return[i * 2 + 1] = (tmp_char & 0x00FF);

View file

@ -37,11 +37,12 @@ public:
return false;
}
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override {
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override {
if (offset > size) {
return ERR_WRITE_BEYOND_END;
} else if (offset == size) {
return MakeResult<size_t>(0);
return MakeResult<std::size_t>(0);
}
if (offset + length > size) {
@ -57,7 +58,7 @@ private:
class ExtSaveDataDelayGenerator : public DelayGenerator {
public:
u64 GetReadDelayNs(size_t length) override {
u64 GetReadDelayNs(std::size_t length) override {
// This is the delay measured for a savedate read,
// not for extsaveData
// For now we will take that
@ -275,7 +276,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Pat
}
void ArchiveFactory_ExtSaveData::WriteIcon(const Path& path, const u8* icon_data,
size_t icon_size) {
std::size_t icon_size) {
std::string game_path = FileSys::GetExtSaveDataPath(GetMountPoint(), path);
FileUtil::IOFile icon_file(game_path + "icon", "wb");
icon_file.WriteBytes(icon_data, icon_size);

View file

@ -44,7 +44,7 @@ public:
* @param icon_data Binary data of the icon
* @param icon_size Size of the icon data
*/
void WriteIcon(const Path& path, const u8* icon_data, size_t icon_size);
void WriteIcon(const Path& path, const u8* icon_data, std::size_t icon_size);
private:
bool shared; ///< Whether this archive represents an ExtSaveData archive or a SharedExtSaveData

View file

@ -238,23 +238,24 @@ NCCHFile::NCCHFile(std::vector<u8> buffer, std::unique_ptr<DelayGenerator> delay
delay_generator = std::move(delay_generator_);
}
ResultVal<size_t> NCCHFile::Read(const u64 offset, const size_t length, u8* buffer) const {
ResultVal<std::size_t> NCCHFile::Read(const u64 offset, const std::size_t length,
u8* buffer) const {
LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
size_t length_left = static_cast<size_t>(data_size - offset);
size_t read_length = static_cast<size_t>(std::min(length, length_left));
std::size_t length_left = static_cast<std::size_t>(data_size - offset);
std::size_t read_length = static_cast<std::size_t>(std::min(length, length_left));
size_t available_size = static_cast<size_t>(file_buffer.size() - offset);
size_t copy_size = std::min(length, available_size);
std::size_t available_size = static_cast<std::size_t>(file_buffer.size() - offset);
std::size_t copy_size = std::min(length, available_size);
memcpy(buffer, file_buffer.data() + offset, copy_size);
return MakeResult<size_t>(copy_size);
return MakeResult<std::size_t>(copy_size);
}
ResultVal<size_t> NCCHFile::Write(const u64 offset, const size_t length, const bool flush,
const u8* buffer) {
ResultVal<std::size_t> NCCHFile::Write(const u64 offset, const std::size_t length, const bool flush,
const u8* buffer) {
LOG_ERROR(Service_FS, "Attempted to write to NCCH file");
// TODO(shinyquagsire23): Find error code
return MakeResult<size_t>(0);
return MakeResult<std::size_t>(0);
}
u64 NCCHFile::GetSize() const {

View file

@ -72,8 +72,9 @@ class NCCHFile : public FileBackend {
public:
explicit NCCHFile(std::vector<u8> buffer, std::unique_ptr<DelayGenerator> delay_generator_);
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override;
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override;
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override;
u64 GetSize() const override;
bool SetSize(u64 size) const override;
bool Close() const override {

View file

@ -19,7 +19,7 @@ namespace FileSys {
class SDMCDelayGenerator : public DelayGenerator {
public:
u64 GetReadDelayNs(size_t length) override {
u64 GetReadDelayNs(std::size_t length) override {
// This is the delay measured on O3DS and O2DS with
// https://gist.github.com/B3n30/ac40eac20603f519ff106107f4ac9182
// from the results the average of each length was taken.

View file

@ -36,7 +36,7 @@ class ExeFSSectionFile final : public FileBackend {
public:
explicit ExeFSSectionFile(std::shared_ptr<std::vector<u8>> data_) : data(std::move(data_)) {}
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override {
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override {
if (offset != 0) {
LOG_ERROR(Service_FS, "offset must be zero!");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
@ -48,10 +48,11 @@ public:
}
std::memcpy(buffer, data->data(), data->size());
return MakeResult<size_t>(data->size());
return MakeResult<std::size_t>(data->size());
}
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override {
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override {
LOG_ERROR(Service_FS, "The file is read-only!");
return ERROR_UNSUPPORTED_OPEN_FLAGS;
}

View file

@ -22,7 +22,7 @@ Loader::ResultStatus CIAContainer::Load(const FileBackend& backend) {
std::vector<u8> header_data(sizeof(Header));
// Load the CIA Header
ResultVal<size_t> read_result = backend.Read(0, sizeof(Header), header_data.data());
ResultVal<std::size_t> read_result = backend.Read(0, sizeof(Header), header_data.data());
if (read_result.Failed() || *read_result != sizeof(Header))
return Loader::ResultStatus::Error;
@ -114,7 +114,8 @@ Loader::ResultStatus CIAContainer::Load(const std::vector<u8>& file_data) {
return Loader::ResultStatus::Success;
}
Loader::ResultStatus CIAContainer::LoadHeader(const std::vector<u8>& header_data, size_t offset) {
Loader::ResultStatus CIAContainer::LoadHeader(const std::vector<u8>& header_data,
std::size_t offset) {
if (header_data.size() - offset < sizeof(Header))
return Loader::ResultStatus::Error;
@ -124,11 +125,12 @@ Loader::ResultStatus CIAContainer::LoadHeader(const std::vector<u8>& header_data
}
Loader::ResultStatus CIAContainer::LoadTitleMetadata(const std::vector<u8>& tmd_data,
size_t offset) {
std::size_t offset) {
return cia_tmd.Load(tmd_data, offset);
}
Loader::ResultStatus CIAContainer::LoadMetadata(const std::vector<u8>& meta_data, size_t offset) {
Loader::ResultStatus CIAContainer::LoadMetadata(const std::vector<u8>& meta_data,
std::size_t offset) {
if (meta_data.size() - offset < sizeof(Metadata))
return Loader::ResultStatus::Error;

View file

@ -23,11 +23,11 @@ namespace FileSys {
class FileBackend;
constexpr size_t CIA_CONTENT_MAX_COUNT = 0x10000;
constexpr size_t CIA_CONTENT_BITS_SIZE = (CIA_CONTENT_MAX_COUNT / 8);
constexpr size_t CIA_HEADER_SIZE = 0x2020;
constexpr size_t CIA_DEPENDENCY_SIZE = 0x300;
constexpr size_t CIA_METADATA_SIZE = 0x400;
constexpr std::size_t CIA_CONTENT_MAX_COUNT = 0x10000;
constexpr std::size_t CIA_CONTENT_BITS_SIZE = (CIA_CONTENT_MAX_COUNT / 8);
constexpr std::size_t CIA_HEADER_SIZE = 0x2020;
constexpr std::size_t CIA_DEPENDENCY_SIZE = 0x300;
constexpr std::size_t CIA_METADATA_SIZE = 0x400;
/**
* Helper which implements an interface to read and write CTR Installable Archive (CIA) files.
@ -43,9 +43,9 @@ public:
Loader::ResultStatus Load(const std::vector<u8>& header_data);
// Load parts of CIAs (for CIAs streamed in)
Loader::ResultStatus LoadHeader(const std::vector<u8>& header_data, size_t offset = 0);
Loader::ResultStatus LoadTitleMetadata(const std::vector<u8>& tmd_data, size_t offset = 0);
Loader::ResultStatus LoadMetadata(const std::vector<u8>& meta_data, size_t offset = 0);
Loader::ResultStatus LoadHeader(const std::vector<u8>& header_data, std::size_t offset = 0);
Loader::ResultStatus LoadTitleMetadata(const std::vector<u8>& tmd_data, std::size_t offset = 0);
Loader::ResultStatus LoadMetadata(const std::vector<u8>& meta_data, std::size_t offset = 0);
const TitleMetadata& GetTitleMetadata() const;
std::array<u64, 0x30>& GetDependencies();

View file

@ -8,14 +8,14 @@ namespace FileSys {
class DelayGenerator {
public:
virtual u64 GetReadDelayNs(size_t length) = 0;
virtual u64 GetReadDelayNs(std::size_t length) = 0;
// TODO (B3N30): Add getter for all other file/directory io operations
};
class DefaultDelayGenerator : public DelayGenerator {
public:
u64 GetReadDelayNs(size_t length) override {
u64 GetReadDelayNs(std::size_t length) override {
// This is the delay measured for a romfs read.
// For now we will take that as a default
static constexpr u64 slope(94);

View file

@ -14,7 +14,7 @@
namespace FileSys {
// Structure of a directory entry, from http://3dbrew.org/wiki/FSDir:Read#Entry_format
const size_t FILENAME_LENGTH = 0x20C / 2;
const std::size_t FILENAME_LENGTH = 0x20C / 2;
struct Entry {
char16_t filename[FILENAME_LENGTH]; // Entry name (UTF-16, null-terminated)
std::array<char, 9> short_name; // 8.3 file name ('longfilename' -> 'LONGFI~1', null-terminated)

View file

@ -16,24 +16,25 @@
namespace FileSys {
ResultVal<size_t> DiskFile::Read(const u64 offset, const size_t length, u8* buffer) const {
ResultVal<std::size_t> DiskFile::Read(const u64 offset, const std::size_t length,
u8* buffer) const {
if (!mode.read_flag)
return ERROR_INVALID_OPEN_FLAGS;
file->Seek(offset, SEEK_SET);
return MakeResult<size_t>(file->ReadBytes(buffer, length));
return MakeResult<std::size_t>(file->ReadBytes(buffer, length));
}
ResultVal<size_t> DiskFile::Write(const u64 offset, const size_t length, const bool flush,
const u8* buffer) {
ResultVal<std::size_t> DiskFile::Write(const u64 offset, const std::size_t length, const bool flush,
const u8* buffer) {
if (!mode.write_flag)
return ERROR_INVALID_OPEN_FLAGS;
file->Seek(offset, SEEK_SET);
size_t written = file->WriteBytes(buffer, length);
std::size_t written = file->WriteBytes(buffer, length);
if (flush)
file->Flush();
return MakeResult<size_t>(written);
return MakeResult<std::size_t>(written);
}
u64 DiskFile::GetSize() const {
@ -70,7 +71,7 @@ u32 DiskDirectory::Read(const u32 count, Entry* entries) {
LOG_TRACE(Service_FS, "File {}: size={} dir={}", filename, file.size, file.isDirectory);
// TODO(Link Mauve): use a proper conversion to UTF-16.
for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
for (std::size_t j = 0; j < FILENAME_LENGTH; ++j) {
entry.filename[j] = filename[j];
if (!filename[j])
break;

View file

@ -29,8 +29,9 @@ public:
mode.hex = mode_.hex;
}
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override;
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override;
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override;
u64 GetSize() const override;
bool SetSize(u64 size) const override;
bool Close() const override;

View file

@ -28,7 +28,7 @@ public:
* @param buffer Buffer to read data into
* @return Number of bytes read, or error code
*/
virtual ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const = 0;
virtual ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const = 0;
/**
* Write data to the file
@ -38,14 +38,15 @@ public:
* @param buffer Buffer to read data from
* @return Number of bytes written, or error code
*/
virtual ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) = 0;
virtual ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) = 0;
/**
* Get the amount of time a 3ds needs to read those data
* @param length Length in bytes of data read from file
* @return Nanoseconds for the delay
*/
u64 GetReadDelayNs(size_t length) {
u64 GetReadDelayNs(std::size_t length) {
if (delay_generator != nullptr) {
return delay_generator->GetReadDelayNs(length);
}

View file

@ -90,16 +90,17 @@ IVFCFile::IVFCFile(std::shared_ptr<RomFSReader> file,
delay_generator = std::move(delay_generator_);
}
ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
ResultVal<std::size_t> IVFCFile::Read(const u64 offset, const std::size_t length,
u8* buffer) const {
LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
return MakeResult<size_t>(romfs_file->ReadFile(offset, length, buffer));
return MakeResult<std::size_t>(romfs_file->ReadFile(offset, length, buffer));
}
ResultVal<size_t> IVFCFile::Write(const u64 offset, const size_t length, const bool flush,
const u8* buffer) {
ResultVal<std::size_t> IVFCFile::Write(const u64 offset, const std::size_t length, const bool flush,
const u8* buffer) {
LOG_ERROR(Service_FS, "Attempted to write to IVFC file");
// TODO(Subv): Find error code
return MakeResult<size_t>(0);
return MakeResult<std::size_t>(0);
}
u64 IVFCFile::GetSize() const {
@ -119,19 +120,20 @@ IVFCFileInMemory::IVFCFileInMemory(std::vector<u8> bytes, u64 offset, u64 size,
delay_generator = std::move(delay_generator_);
}
ResultVal<size_t> IVFCFileInMemory::Read(const u64 offset, const size_t length, u8* buffer) const {
ResultVal<std::size_t> IVFCFileInMemory::Read(const u64 offset, const std::size_t length,
u8* buffer) const {
LOG_TRACE(Service_FS, "called offset={}, length={}", offset, length);
size_t read_length = (size_t)std::min((u64)length, data_size - offset);
std::size_t read_length = (std::size_t)std::min((u64)length, data_size - offset);
std::memcpy(buffer, romfs_file.data() + data_offset + offset, read_length);
return MakeResult<size_t>(read_length);
return MakeResult<std::size_t>(read_length);
}
ResultVal<size_t> IVFCFileInMemory::Write(const u64 offset, const size_t length, const bool flush,
const u8* buffer) {
ResultVal<std::size_t> IVFCFileInMemory::Write(const u64 offset, const std::size_t length,
const bool flush, const u8* buffer) {
LOG_ERROR(Service_FS, "Attempted to write to IVFC file");
// TODO(Subv): Find error code
return MakeResult<size_t>(0);
return MakeResult<std::size_t>(0);
}
u64 IVFCFileInMemory::GetSize() const {

View file

@ -22,7 +22,7 @@
namespace FileSys {
class IVFCDelayGenerator : public DelayGenerator {
u64 GetReadDelayNs(size_t length) override {
u64 GetReadDelayNs(std::size_t length) override {
// This is the delay measured for a romfs read.
// For now we will take that as a default
static constexpr u64 slope(94);
@ -35,7 +35,7 @@ class IVFCDelayGenerator : public DelayGenerator {
class RomFSDelayGenerator : public DelayGenerator {
public:
u64 GetReadDelayNs(size_t length) override {
u64 GetReadDelayNs(std::size_t length) override {
// The delay was measured on O3DS and O2DS with
// https://gist.github.com/B3n30/ac40eac20603f519ff106107f4ac9182
// from the results the average of each length was taken.
@ -49,7 +49,7 @@ public:
class ExeFSDelayGenerator : public DelayGenerator {
public:
u64 GetReadDelayNs(size_t length) override {
u64 GetReadDelayNs(std::size_t length) override {
// The delay was measured on O3DS and O2DS with
// https://gist.github.com/B3n30/ac40eac20603f519ff106107f4ac9182
// from the results the average of each length was taken.
@ -92,8 +92,9 @@ class IVFCFile : public FileBackend {
public:
IVFCFile(std::shared_ptr<RomFSReader> file, std::unique_ptr<DelayGenerator> delay_generator_);
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override;
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override;
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override;
u64 GetSize() const override;
bool SetSize(u64 size) const override;
bool Close() const override {
@ -120,8 +121,9 @@ public:
IVFCFileInMemory(std::vector<u8> bytes, u64 offset, u64 size,
std::unique_ptr<DelayGenerator> delay_generator_);
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override;
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override;
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override;
u64 GetSize() const override;
bool SetSize(u64 size) const override;
bool Close() const override {

View file

@ -394,8 +394,8 @@ Loader::ResultStatus NCCHContainer::LoadSectionExeFS(const char* name, std::vect
// instead of the ExeFS.
if (std::strcmp(name, "logo") == 0) {
if (ncch_header.logo_region_offset && ncch_header.logo_region_size) {
size_t logo_offset = ncch_header.logo_region_offset * kBlockSize;
size_t logo_size = ncch_header.logo_region_size * kBlockSize;
std::size_t logo_offset = ncch_header.logo_region_offset * kBlockSize;
std::size_t logo_size = ncch_header.logo_region_size * kBlockSize;
buffer.resize(logo_size);
file.Seek(ncch_offset + logo_offset, SEEK_SET);

View file

@ -15,7 +15,7 @@ namespace FileSys {
class SaveDataDelayGenerator : public DelayGenerator {
public:
u64 GetReadDelayNs(size_t length) override {
u64 GetReadDelayNs(std::size_t length) override {
// The delay was measured on O3DS and O2DS with
// https://gist.github.com/B3n30/ac40eac20603f519ff106107f4ac9182
// from the results the average of each length was taken.

View file

@ -50,8 +50,8 @@ Loader::ResultStatus TitleMetadata::Load(const std::string& file_path) {
return result;
}
Loader::ResultStatus TitleMetadata::Load(const std::vector<u8> file_data, size_t offset) {
size_t total_size = static_cast<size_t>(file_data.size() - offset);
Loader::ResultStatus TitleMetadata::Load(const std::vector<u8> file_data, std::size_t offset) {
std::size_t total_size = static_cast<std::size_t>(file_data.size() - offset);
if (total_size < sizeof(u32_be))
return Loader::ResultStatus::Error;
@ -61,8 +61,8 @@ Loader::ResultStatus TitleMetadata::Load(const std::vector<u8> file_data, size_t
u32 signature_size = GetSignatureSize(signature_type);
// The TMD body start position is rounded to the nearest 0x40 after the signature
size_t body_start = Common::AlignUp(signature_size + sizeof(u32), 0x40);
size_t body_end = body_start + sizeof(Body);
std::size_t body_start = Common::AlignUp(signature_size + sizeof(u32), 0x40);
std::size_t body_end = body_start + sizeof(Body);
if (total_size < body_end)
return Loader::ResultStatus::Error;
@ -72,7 +72,7 @@ Loader::ResultStatus TitleMetadata::Load(const std::vector<u8> file_data, size_t
memcpy(tmd_signature.data(), &file_data[offset + sizeof(u32_be)], signature_size);
memcpy(&tmd_body, &file_data[offset + body_start], sizeof(TitleMetadata::Body));
size_t expected_size =
std::size_t expected_size =
body_start + sizeof(Body) + static_cast<u16>(tmd_body.content_count) * sizeof(ContentChunk);
if (total_size < expected_size) {
LOG_ERROR(Service_FS, "Malformed TMD, expected size 0x{:x}, got 0x{:x}!", expected_size,
@ -106,7 +106,7 @@ Loader::ResultStatus TitleMetadata::Save(const std::string& file_path) {
return Loader::ResultStatus::Error;
// The TMD body start position is rounded to the nearest 0x40 after the signature
size_t body_start = Common::AlignUp(signature_size + sizeof(u32), 0x40);
std::size_t body_start = Common::AlignUp(signature_size + sizeof(u32), 0x40);
file.Seek(body_start, SEEK_SET);
// Update our TMD body values and hashes
@ -126,7 +126,7 @@ Loader::ResultStatus TitleMetadata::Save(const std::string& file_path) {
chunk_hash.Final(tmd_body.contentinfo[0].hash.data());
CryptoPP::SHA256 contentinfo_hash;
for (size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
for (std::size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
chunk_hash.Update(reinterpret_cast<u8*>(&tmd_body.contentinfo[i]), sizeof(ContentInfo));
}
chunk_hash.Final(tmd_body.contentinfo_hash.data());
@ -213,7 +213,7 @@ void TitleMetadata::Print() const {
// Content info describes ranges of content chunks
LOG_DEBUG(Service_FS, "Content info:");
for (size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
for (std::size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
if (tmd_body.contentinfo[i].command_count == 0)
break;
@ -223,7 +223,7 @@ void TitleMetadata::Print() const {
}
// For each content info, print their content chunk range
for (size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
for (std::size_t i = 0; i < tmd_body.contentinfo.size(); i++) {
u16 index = static_cast<u16>(tmd_body.contentinfo[i].index);
u16 count = static_cast<u16>(tmd_body.contentinfo[i].command_count);

View file

@ -94,14 +94,14 @@ public:
#pragma pack(pop)
Loader::ResultStatus Load(const std::string& file_path);
Loader::ResultStatus Load(const std::vector<u8> file_data, size_t offset = 0);
Loader::ResultStatus Load(const std::vector<u8> file_data, std::size_t offset = 0);
Loader::ResultStatus Save(const std::string& file_path);
u64 GetTitleID() const;
u32 GetTitleType() const;
u16 GetTitleVersion() const;
u64 GetSystemVersion() const;
size_t GetContentCount() const;
std::size_t GetContentCount() const;
u32 GetBootContentID() const;
u32 GetManualContentID() const;
u32 GetDLPContentID() const;

View file

@ -262,7 +262,7 @@ static u8 NibbleToHex(u8 n) {
* @param src Pointer to array of output hex string characters.
* @param len Length of src array.
*/
static u32 HexToInt(const u8* src, size_t len) {
static u32 HexToInt(const u8* src, std::size_t len) {
u32 output = 0;
while (len-- > 0) {
output = (output << 4) | HexCharToValue(src[0]);
@ -278,7 +278,7 @@ static u32 HexToInt(const u8* src, size_t len) {
* @param src Pointer to array of u8 bytes.
* @param len Length of src array.
*/
static void MemToGdbHex(u8* dest, const u8* src, size_t len) {
static void MemToGdbHex(u8* dest, const u8* src, std::size_t len) {
while (len-- > 0) {
u8 tmp = *src++;
*dest++ = NibbleToHex(tmp >> 4);
@ -293,7 +293,7 @@ static void MemToGdbHex(u8* dest, const u8* src, size_t len) {
* @param src Pointer to array of output hex string characters.
* @param len Length of src array.
*/
static void GdbHexToMem(u8* dest, const u8* src, size_t len) {
static void GdbHexToMem(u8* dest, const u8* src, std::size_t len) {
while (len-- > 0) {
*dest++ = (HexCharToValue(src[0]) << 4) | HexCharToValue(src[1]);
src += 2;
@ -361,7 +361,7 @@ static u64 GdbHexToLong(const u8* src) {
/// Read a byte from the gdb client.
static u8 ReadByte() {
u8 c;
size_t received_size = recv(gdbserver_socket, reinterpret_cast<char*>(&c), 1, MSG_WAITALL);
std::size_t received_size = recv(gdbserver_socket, reinterpret_cast<char*>(&c), 1, MSG_WAITALL);
if (received_size != 1) {
LOG_ERROR(Debug_GDBStub, "recv failed : {}", received_size);
Shutdown();
@ -371,7 +371,7 @@ static u8 ReadByte() {
}
/// Calculate the checksum of the current command buffer.
static u8 CalculateChecksum(const u8* buffer, size_t length) {
static u8 CalculateChecksum(const u8* buffer, std::size_t length) {
return static_cast<u8>(std::accumulate(buffer, buffer + length, 0, std::plus<u8>()));
}
@ -473,7 +473,7 @@ bool CheckBreakpoint(VAddr addr, BreakpointType type) {
* @param packet Packet to be sent to client.
*/
static void SendPacket(const char packet) {
size_t sent_size = send(gdbserver_socket, &packet, 1, 0);
std::size_t sent_size = send(gdbserver_socket, &packet, 1, 0);
if (sent_size != 1) {
LOG_ERROR(Debug_GDBStub, "send failed");
}

View file

@ -149,7 +149,7 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(
frontend_config.max_text_length = config.max_text_length;
frontend_config.max_digits = config.max_digits;
size_t text_size = config.hint_text.size();
std::size_t text_size = config.hint_text.size();
const auto text_end = std::find(config.hint_text.begin(), config.hint_text.end(), u'\0');
if (text_end != config.hint_text.end())
text_size = std::distance(config.hint_text.begin(), text_end);

View file

@ -33,10 +33,10 @@ inline u32* GetCommandBuffer(const int offset = 0) {
namespace IPC {
/// Size of the command buffer area, in 32-bit words.
constexpr size_t COMMAND_BUFFER_LENGTH = 0x100 / sizeof(u32);
constexpr std::size_t COMMAND_BUFFER_LENGTH = 0x100 / sizeof(u32);
// Maximum number of static buffers per thread.
constexpr size_t MAX_STATIC_BUFFERS = 16;
constexpr std::size_t MAX_STATIC_BUFFERS = 16;
// These errors are commonly returned by invalid IPC translations, so alias them here for
// convenience.
@ -113,7 +113,7 @@ union StaticBufferDescInfo {
BitField<14, 18, u32> size;
};
inline u32 StaticBufferDesc(size_t size, u8 buffer_id) {
inline u32 StaticBufferDesc(std::size_t size, u8 buffer_id) {
StaticBufferDescInfo info{};
info.descriptor_type.Assign(StaticBuffer);
info.buffer_id.Assign(buffer_id);
@ -151,7 +151,7 @@ union MappedBufferDescInfo {
BitField<4, 28, u32> size;
};
inline u32 MappedBufferDesc(size_t size, MappedBufferPermissions perms) {
inline u32 MappedBufferDesc(std::size_t size, MappedBufferPermissions perms) {
MappedBufferDescInfo info{};
info.flags.Assign(MappedBuffer);
info.perms.Assign(perms);

View file

@ -27,7 +27,7 @@ public:
: context(&context), cmdbuf(context.CommandBuffer()), header(desired_header) {}
/// Returns the total size of the request in words
size_t TotalSize() const {
std::size_t TotalSize() const {
return 1 /* command header */ + header.normal_params_size + header.translate_params_size;
}
@ -398,7 +398,7 @@ inline std::array<Kernel::SharedPtr<Kernel::Object>, N> RequestParser::PopGeneri
}
namespace detail {
template <typename... T, size_t... I>
template <typename... T, std::size_t... I>
std::tuple<Kernel::SharedPtr<T>...> PopObjectsHelper(
std::array<Kernel::SharedPtr<Kernel::Object>, sizeof...(T)>&& pointers,
std::index_sequence<I...>) {

View file

@ -66,7 +66,7 @@ ResultCode HandleTable::Close(Handle handle) {
}
bool HandleTable::IsValid(Handle handle) const {
size_t slot = GetSlot(handle);
std::size_t slot = GetSlot(handle);
u16 generation = GetGeneration(handle);
return slot < MAX_COUNT && objects[slot] != nullptr && generations[slot] == generation;

View file

@ -93,7 +93,7 @@ private:
* This is the maximum limit of handles allowed per process in CTR-OS. It can be further
* reduced by ExHeader values, but this is not emulated here.
*/
static const size_t MAX_COUNT = 4096;
static const std::size_t MAX_COUNT = 4096;
static u16 GetSlot(Handle handle) {
return handle >> 15;

View file

@ -100,13 +100,13 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const u32_le* sr
HandleTable& src_table) {
IPC::Header header{src_cmdbuf[0]};
size_t untranslated_size = 1u + header.normal_params_size;
size_t command_size = untranslated_size + header.translate_params_size;
std::size_t untranslated_size = 1u + header.normal_params_size;
std::size_t command_size = untranslated_size + header.translate_params_size;
ASSERT(command_size <= IPC::COMMAND_BUFFER_LENGTH); // TODO(yuriks): Return error
std::copy_n(src_cmdbuf, untranslated_size, cmd_buf.begin());
size_t i = untranslated_size;
std::size_t i = untranslated_size;
while (i < command_size) {
u32 descriptor = cmd_buf[i] = src_cmdbuf[i];
i += 1;
@ -165,13 +165,13 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, P
HandleTable& dst_table) const {
IPC::Header header{cmd_buf[0]};
size_t untranslated_size = 1u + header.normal_params_size;
size_t command_size = untranslated_size + header.translate_params_size;
std::size_t untranslated_size = 1u + header.normal_params_size;
std::size_t command_size = untranslated_size + header.translate_params_size;
ASSERT(command_size <= IPC::COMMAND_BUFFER_LENGTH);
std::copy_n(cmd_buf.begin(), untranslated_size, dst_cmdbuf);
size_t i = untranslated_size;
std::size_t i = untranslated_size;
while (i < command_size) {
u32 descriptor = dst_cmdbuf[i] = cmd_buf[i];
i += 1;
@ -201,7 +201,8 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, P
// Grab the address that the target thread set up to receive the response static buffer
// and write our data there. The static buffers area is located right after the command
// buffer area.
size_t static_buffer_offset = IPC::COMMAND_BUFFER_LENGTH + 2 * buffer_info.buffer_id;
std::size_t static_buffer_offset =
IPC::COMMAND_BUFFER_LENGTH + 2 * buffer_info.buffer_id;
IPC::StaticBufferDescInfo target_descriptor{dst_cmdbuf[static_buffer_offset]};
VAddr target_address = dst_cmdbuf[static_buffer_offset + 1];
@ -237,13 +238,13 @@ MappedBuffer::MappedBuffer(const Process& process, u32 descriptor, VAddr address
perms = desc.perms;
}
void MappedBuffer::Read(void* dest_buffer, size_t offset, size_t size) {
void MappedBuffer::Read(void* dest_buffer, std::size_t offset, std::size_t size) {
ASSERT(perms & IPC::R);
ASSERT(offset + size <= this->size);
Memory::ReadBlock(*process, address + static_cast<VAddr>(offset), dest_buffer, size);
}
void MappedBuffer::Write(const void* src_buffer, size_t offset, size_t size) {
void MappedBuffer::Write(const void* src_buffer, std::size_t offset, std::size_t size) {
ASSERT(perms & IPC::W);
ASSERT(offset + size <= this->size);
Memory::WriteBlock(*process, address + static_cast<VAddr>(offset), src_buffer, size);

View file

@ -98,9 +98,9 @@ public:
MappedBuffer(const Process& process, u32 descriptor, VAddr address, u32 id);
// interface for service
void Read(void* dest_buffer, size_t offset, size_t size);
void Write(const void* src_buffer, size_t offset, size_t size);
size_t GetSize() const {
void Read(void* dest_buffer, std::size_t offset, std::size_t size);
void Write(const void* src_buffer, std::size_t offset, std::size_t size);
std::size_t GetSize() const {
return size;
}
@ -118,7 +118,7 @@ private:
u32 id;
VAddr address;
const Process* process;
size_t size;
std::size_t size;
IPC::MappedBufferPermissions perms;
};

View file

@ -24,8 +24,8 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
// TODO(Subv): Replace by Memory::Read32 when possible.
Memory::ReadBlock(*src_process, src_address, &header.raw, sizeof(header.raw));
size_t untranslated_size = 1u + header.normal_params_size;
size_t command_size = untranslated_size + header.translate_params_size;
std::size_t untranslated_size = 1u + header.normal_params_size;
std::size_t command_size = untranslated_size + header.translate_params_size;
// Note: The real kernel does not check that the command length fits into the IPC buffer area.
ASSERT(command_size <= IPC::COMMAND_BUFFER_LENGTH);
@ -33,7 +33,7 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
Memory::ReadBlock(*src_process, src_address, cmd_buf.data(), command_size * sizeof(u32));
size_t i = untranslated_size;
std::size_t i = untranslated_size;
while (i < command_size) {
u32 descriptor = cmd_buf[i];
i += 1;
@ -178,11 +178,12 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
auto buffer = std::make_shared<std::vector<u8>>(Memory::PAGE_SIZE);
// Number of bytes until the next page.
size_t difference_to_page =
std::size_t difference_to_page =
Common::AlignUp(source_address, Memory::PAGE_SIZE) - source_address;
// If the data fits in one page we can just copy the required size instead of the
// entire page.
size_t read_size = num_pages == 1 ? static_cast<size_t>(size) : difference_to_page;
std::size_t read_size =
num_pages == 1 ? static_cast<std::size_t>(size) : difference_to_page;
Memory::ReadBlock(*src_process, source_address, buffer->data() + page_offset,
read_size);

View file

@ -46,8 +46,8 @@ SharedPtr<Process> Process::Create(SharedPtr<CodeSet> code_set) {
return process;
}
void Process::ParseKernelCaps(const u32* kernel_caps, size_t len) {
for (size_t i = 0; i < len; ++i) {
void Process::ParseKernelCaps(const u32* kernel_caps, std::size_t len) {
for (std::size_t i = 0; i < len; ++i) {
u32 descriptor = kernel_caps[i];
u32 type = descriptor >> 20;
@ -253,7 +253,7 @@ ResultVal<VAddr> Process::LinearAllocate(VAddr target, u32 size, VMAPermission p
// TODO(yuriks): As is, this lets processes map memory allocated by other processes from the
// same region. It is unknown if or how the 3DS kernel checks against this.
size_t offset = target - GetLinearHeapBase();
std::size_t offset = target - GetLinearHeapBase();
CASCADE_RESULT(auto vma, vm_manager.MapMemoryBlock(target, linheap_memory, offset, size,
MemoryState::Continuous));
vm_manager.Reprotect(vma, perms);

View file

@ -57,7 +57,7 @@ struct MemoryRegionInfo;
struct CodeSet final : public Object {
struct Segment {
size_t offset = 0;
std::size_t offset = 0;
VAddr addr = 0;
u32 size = 0;
};
@ -159,7 +159,7 @@ public:
* Parses a list of kernel capability descriptors (as found in the ExHeader) and applies them
* to this process.
*/
void ParseKernelCaps(const u32* kernel_caps, size_t len);
void ParseKernelCaps(const u32* kernel_caps, std::size_t len);
/**
* Applies address space changes and launches the process main thread.

View file

@ -114,7 +114,7 @@ public:
/// Backing memory for this shared memory block.
std::shared_ptr<std::vector<u8>> backing_block;
/// Offset into the backing block for this shared memory.
size_t backing_block_offset;
std::size_t backing_block_offset;
/// Size of the memory block. Page-aligned.
u32 size;
/// Permission restrictions applied to the process which created the block.

View file

@ -424,7 +424,7 @@ static ResultCode WaitSynchronizationN(s32* out, VAddr handles_address, s32 hand
thread->status = THREADSTATUS_WAIT_SYNCH_ANY;
// Add the thread to each of the objects' waiting threads.
for (size_t i = 0; i < objects.size(); ++i) {
for (std::size_t i = 0; i < objects.size(); ++i) {
WaitObject* object = objects[i].get();
object->AddWaitingThread(thread);
}
@ -581,7 +581,7 @@ static ResultCode ReplyAndReceive(s32* index, VAddr handles_address, s32 handle_
thread->status = THREADSTATUS_WAIT_SYNCH_ANY;
// Add the thread to each of the objects' waiting threads.
for (size_t i = 0; i < objects.size(); ++i) {
for (std::size_t i = 0; i < objects.size(); ++i) {
WaitObject* object = objects[i].get();
object->AddWaitingThread(thread);
}

View file

@ -378,7 +378,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
return ERR_OUT_OF_MEMORY;
}
size_t offset = linheap_memory->size();
std::size_t offset = linheap_memory->size();
// Allocate some memory from the end of the linear heap for this region.
linheap_memory->insert(linheap_memory->end(), Memory::PAGE_SIZE, 0);

View file

@ -73,7 +73,7 @@ VMManager::VMAHandle VMManager::FindVMA(VAddr target) const {
ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
std::shared_ptr<std::vector<u8>> block,
size_t offset, u32 size,
std::size_t offset, u32 size,
MemoryState state) {
ASSERT(block != nullptr);
ASSERT(offset + size <= block->size());
@ -95,7 +95,7 @@ ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
ResultVal<VAddr> VMManager::MapMemoryBlockToBase(VAddr base, u32 region_size,
std::shared_ptr<std::vector<u8>> block,
size_t offset, u32 size, MemoryState state) {
std::size_t offset, u32 size, MemoryState state) {
// Find the first Free VMA.
VMAHandle vma_handle = std::find_if(vma_map.begin(), vma_map.end(), [&](const auto& vma) {

View file

@ -75,7 +75,7 @@ struct VirtualMemoryArea {
/// Memory block backing this VMA.
std::shared_ptr<std::vector<u8>> backing_block = nullptr;
/// Offset into the backing_memory the mapping starts from.
size_t offset = 0;
std::size_t offset = 0;
// Settings for type = BackingMemory
/// Pointer backing this VMA. It will not be destroyed or freed when the VMA is removed.
@ -142,7 +142,7 @@ public:
* @param state MemoryState tag to attach to the VMA.
*/
ResultVal<VMAHandle> MapMemoryBlock(VAddr target, std::shared_ptr<std::vector<u8>> block,
size_t offset, u32 size, MemoryState state);
std::size_t offset, u32 size, MemoryState state);
/**
* Maps part of a ref-counted block of memory at the first free address after the given base.
@ -156,8 +156,8 @@ public:
* @returns The address at which the memory was mapped.
*/
ResultVal<VAddr> MapMemoryBlockToBase(VAddr base, u32 region_size,
std::shared_ptr<std::vector<u8>> block, size_t offset,
u32 size, MemoryState state);
std::shared_ptr<std::vector<u8>> block,
std::size_t offset, u32 size, MemoryState state);
/**
* Maps an unmanaged host memory pointer at a given address.
*

View file

@ -74,12 +74,13 @@ struct TicketInfo {
static_assert(sizeof(TicketInfo) == 0x18, "Ticket info structure size is wrong");
ResultVal<size_t> CIAFile::Read(u64 offset, size_t length, u8* buffer) const {
ResultVal<std::size_t> CIAFile::Read(u64 offset, std::size_t length, u8* buffer) const {
UNIMPLEMENTED();
return MakeResult<size_t>(length);
return MakeResult<std::size_t>(length);
}
ResultVal<size_t> CIAFile::WriteTitleMetadata(u64 offset, size_t length, const u8* buffer) {
ResultVal<std::size_t> CIAFile::WriteTitleMetadata(u64 offset, std::size_t length,
const u8* buffer) {
container.LoadTitleMetadata(data, container.GetTitleMetadataOffset());
FileSys::TitleMetadata tmd = container.GetTitleMetadata();
tmd.Print();
@ -111,10 +112,10 @@ ResultVal<size_t> CIAFile::WriteTitleMetadata(u64 offset, size_t length, const u
content_written.resize(container.GetTitleMetadata().GetContentCount());
install_state = CIAInstallState::TMDLoaded;
return MakeResult<size_t>(length);
return MakeResult<std::size_t>(length);
}
ResultVal<size_t> CIAFile::WriteContentData(u64 offset, size_t length, const u8* buffer) {
ResultVal<std::size_t> CIAFile::WriteContentData(u64 offset, std::size_t length, const u8* buffer) {
// Data is not being buffered, so we have to keep track of how much of each <ID>.app
// has been written since we might get a written buffer which contains multiple .app
// contents or only part of a larger .app's contents.
@ -153,10 +154,11 @@ ResultVal<size_t> CIAFile::WriteContentData(u64 offset, size_t length, const u8*
}
}
return MakeResult<size_t>(length);
return MakeResult<std::size_t>(length);
}
ResultVal<size_t> CIAFile::Write(u64 offset, size_t length, bool flush, const u8* buffer) {
ResultVal<std::size_t> CIAFile::Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) {
written += length;
// TODO(shinyquagsire23): Can we assume that things will only be written in sequence?
@ -168,9 +170,9 @@ ResultVal<size_t> CIAFile::Write(u64 offset, size_t length, bool flush, const u8
// content sizes so it ends up becoming a problem of keeping track of how much has been
// written and what we have been able to pick up.
if (install_state == CIAInstallState::InstallStarted) {
size_t buf_copy_size = std::min(length, FileSys::CIA_HEADER_SIZE);
size_t buf_max_size =
std::min(static_cast<size_t>(offset + length), FileSys::CIA_HEADER_SIZE);
std::size_t buf_copy_size = std::min(length, FileSys::CIA_HEADER_SIZE);
std::size_t buf_max_size =
std::min(static_cast<std::size_t>(offset + length), FileSys::CIA_HEADER_SIZE);
data.resize(buf_max_size);
memcpy(data.data() + offset, buffer, buf_copy_size);
@ -184,18 +186,18 @@ ResultVal<size_t> CIAFile::Write(u64 offset, size_t length, bool flush, const u8
// If we don't have a header yet, we can't pull offsets of other sections
if (install_state == CIAInstallState::InstallStarted)
return MakeResult<size_t>(length);
return MakeResult<std::size_t>(length);
// If we have been given data before (or including) .app content, pull it into
// our buffer, but only pull *up to* the content offset, no further.
if (offset < container.GetContentOffset()) {
size_t buf_loaded = data.size();
size_t copy_offset = std::max(static_cast<size_t>(offset), buf_loaded);
size_t buf_offset = buf_loaded - offset;
size_t buf_copy_size =
std::min(length, static_cast<size_t>(container.GetContentOffset() - offset)) -
std::size_t buf_loaded = data.size();
std::size_t copy_offset = std::max(static_cast<std::size_t>(offset), buf_loaded);
std::size_t buf_offset = buf_loaded - offset;
std::size_t buf_copy_size =
std::min(length, static_cast<std::size_t>(container.GetContentOffset() - offset)) -
buf_loaded;
size_t buf_max_size = std::min(offset + length, container.GetContentOffset());
std::size_t buf_max_size = std::min(offset + length, container.GetContentOffset());
data.resize(buf_max_size);
memcpy(data.data() + copy_offset, buffer + buf_offset, buf_copy_size);
}
@ -212,14 +214,14 @@ ResultVal<size_t> CIAFile::Write(u64 offset, size_t length, bool flush, const u8
// Content data sizes can only be retrieved from TMD data
if (install_state != CIAInstallState::TMDLoaded)
return MakeResult<size_t>(length);
return MakeResult<std::size_t>(length);
// From this point forward, data will no longer be buffered in data
auto result = WriteContentData(offset, length, buffer);
if (result.Failed())
return result;
return MakeResult<size_t>(length);
return MakeResult<std::size_t>(length);
}
u64 CIAFile::GetSize() const {
@ -232,7 +234,7 @@ bool CIAFile::SetSize(u64 size) const {
bool CIAFile::Close() const {
bool complete = true;
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
for (std::size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
if (content_written[i] < container.GetContentSize(static_cast<u16>(i)))
complete = false;
}
@ -294,7 +296,7 @@ InstallStatus InstallCIA(const std::string& path,
Service::AM::CIAFile installFile(
Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID()));
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
for (std::size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
if (container.GetTitleMetadata().GetContentTypeByIndex(static_cast<u16>(i)) &
FileSys::TMDContentTypeFlag::Encrypted) {
LOG_ERROR(Service_AM, "File {} is encrypted! Aborting...", path);
@ -307,9 +309,9 @@ InstallStatus InstallCIA(const std::string& path,
return InstallStatus::ErrorFailedToOpenFile;
std::array<u8, 0x10000> buffer;
size_t total_bytes_read = 0;
std::size_t total_bytes_read = 0;
while (total_bytes_read != file.GetSize()) {
size_t bytes_read = file.ReadBytes(buffer.data(), buffer.size());
std::size_t bytes_read = file.ReadBytes(buffer.data(), buffer.size());
auto result = installFile.Write(static_cast<u64>(total_bytes_read), bytes_read, true,
static_cast<u8*>(buffer.data()));
@ -525,7 +527,7 @@ void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
if (tmd.Load(tmd_path) == Loader::ResultStatus::Success) {
std::size_t write_offset = 0;
// Get info for each content index requested
for (size_t i = 0; i < content_count; i++) {
for (std::size_t i = 0; i < content_count; i++) {
std::shared_ptr<FileUtil::IOFile> romfs_file;
u64 romfs_offset = 0;

View file

@ -53,10 +53,10 @@ enum class InstallStatus : u32 {
};
// Title ID valid length
constexpr size_t TITLE_ID_VALID_LENGTH = 16;
constexpr std::size_t TITLE_ID_VALID_LENGTH = 16;
// Progress callback for InstallCIA, receives bytes written and total bytes
using ProgressCallback = void(size_t, size_t);
using ProgressCallback = void(std::size_t, std::size_t);
// A file handled returned for CIAs to be written into and subsequently installed.
class CIAFile final : public FileSys::FileBackend {
@ -66,10 +66,11 @@ public:
Close();
}
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
ResultVal<size_t> WriteTitleMetadata(u64 offset, size_t length, const u8* buffer);
ResultVal<size_t> WriteContentData(u64 offset, size_t length, const u8* buffer);
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) override;
ResultVal<std::size_t> Read(u64 offset, std::size_t length, u8* buffer) const override;
ResultVal<std::size_t> WriteTitleMetadata(u64 offset, std::size_t length, const u8* buffer);
ResultVal<std::size_t> WriteContentData(u64 offset, std::size_t length, const u8* buffer);
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
const u8* buffer) override;
u64 GetSize() const override;
bool SetSize(u64 size) const override;
bool Close() const override;

View file

@ -19,11 +19,11 @@ struct AppletTitleData {
std::array<AppletId, 2> applet_ids;
// There's a specific TitleId per region for each applet.
static constexpr size_t NumRegions = 7;
static constexpr std::size_t NumRegions = 7;
std::array<u64, NumRegions> title_ids;
};
static constexpr size_t NumApplets = 29;
static constexpr std::size_t NumApplets = 29;
static constexpr std::array<AppletTitleData, NumApplets> applet_titleids = {{
{AppletId::HomeMenu, AppletId::None, 0x4003000008202, 0x4003000008F02, 0x4003000009802,
0x4003000008202, 0x400300000A102, 0x400300000A902, 0x400300000B102},
@ -84,7 +84,7 @@ static u64 GetTitleIdForApplet(AppletId id) {
AppletManager::AppletSlotData* AppletManager::GetAppletSlotData(AppletId id) {
auto GetSlot = [this](AppletSlot slot) -> AppletSlotData* {
return &applet_slots[static_cast<size_t>(slot)];
return &applet_slots[static_cast<std::size_t>(slot)];
};
if (id == AppletId::Application) {
@ -160,9 +160,9 @@ AppletManager::AppletSlotData* AppletManager::GetAppletSlotData(AppletAttributes
// The Home Menu is a system applet, however, it has its own applet slot so that it can run
// concurrently with other system applets.
if (slot == AppletSlot::SystemApplet && attributes.is_home_menu)
return &applet_slots[static_cast<size_t>(AppletSlot::HomeMenu)];
return &applet_slots[static_cast<std::size_t>(AppletSlot::HomeMenu)];
return &applet_slots[static_cast<size_t>(slot)];
return &applet_slots[static_cast<std::size_t>(slot)];
}
void AppletManager::CancelAndSendParameter(const MessageParameter& parameter) {
@ -314,7 +314,7 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
ErrorSummary::InvalidState, ErrorLevel::Status);
}
const auto& slot = applet_slots[static_cast<size_t>(AppletSlot::LibraryApplet)];
const auto& slot = applet_slots[static_cast<std::size_t>(AppletSlot::LibraryApplet)];
if (slot.registered) {
return ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
@ -341,7 +341,7 @@ ResultCode AppletManager::PrepareToStartLibraryApplet(AppletId applet_id) {
}
ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
const auto& slot = applet_slots[static_cast<size_t>(AppletSlot::LibraryApplet)];
const auto& slot = applet_slots[static_cast<std::size_t>(AppletSlot::LibraryApplet)];
if (slot.registered) {
return ResultCode(ErrorDescription::AlreadyExists, ErrorModule::Applet,
@ -369,7 +369,7 @@ ResultCode AppletManager::PreloadLibraryApplet(AppletId applet_id) {
ResultCode AppletManager::FinishPreloadingLibraryApplet(AppletId applet_id) {
// TODO(Subv): This function should fail depending on the applet preparation state.
auto& slot = applet_slots[static_cast<size_t>(AppletSlot::LibraryApplet)];
auto& slot = applet_slots[static_cast<std::size_t>(AppletSlot::LibraryApplet)];
slot.loaded = true;
return RESULT_SUCCESS;
}
@ -417,7 +417,7 @@ ResultCode AppletManager::PrepareToCloseLibraryApplet(bool not_pause, bool exiti
ResultCode AppletManager::CloseLibraryApplet(Kernel::SharedPtr<Kernel::Object> object,
std::vector<u8> buffer) {
auto& slot = applet_slots[static_cast<size_t>(AppletSlot::LibraryApplet)];
auto& slot = applet_slots[static_cast<std::size_t>(AppletSlot::LibraryApplet)];
MessageParameter param;
// TODO(Subv): The destination id should be the "current applet slot id", which changes
@ -467,7 +467,7 @@ ResultVal<AppletManager::AppletInfo> AppletManager::GetAppletInfo(AppletId app_i
}
AppletManager::AppletManager() {
for (size_t slot = 0; slot < applet_slots.size(); ++slot) {
for (std::size_t slot = 0; slot < applet_slots.size(); ++slot) {
auto& slot_data = applet_slots[slot];
slot_data.slot = static_cast<AppletSlot>(slot);
slot_data.applet_id = AppletId::None;

View file

@ -146,7 +146,7 @@ private:
/// TODO(Subv): Use std::optional once we migrate to C++17.
boost::optional<MessageParameter> next_parameter;
static constexpr size_t NumAppletSlot = 4;
static constexpr std::size_t NumAppletSlot = 4;
enum class AppletSlot : u8 {
Application,

View file

@ -533,7 +533,7 @@ void Module::Interface::StartLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x1E, 2, 4); // 0x1E0084
AppletId applet_id = rp.PopEnum<AppletId>();
size_t buffer_size = rp.Pop<u32>();
std::size_t buffer_size = rp.Pop<u32>();
Kernel::SharedPtr<Kernel::Object> object = rp.PopGenericObject();
std::vector<u8> buffer = rp.PopStaticBuffer();

View file

@ -128,7 +128,7 @@ void Module::CompletionEventCallBack(u64 port_id, s64) {
port.dest_size, buffer_size);
}
Memory::WriteBlock(*port.dest_process, port.dest, buffer.data(),
std::min<size_t>(port.dest_size, buffer_size));
std::min<std::size_t>(port.dest_size, buffer_size));
}
port.is_receiving = false;

View file

@ -477,7 +477,7 @@ ResultCode Module::FormatConfig() {
u16_le country_name_buffer[16][0x40] = {};
std::u16string region_name = Common::UTF8ToUTF16("Gensokyo");
for (size_t i = 0; i < 16; ++i) {
for (std::size_t i = 0; i < 16; ++i) {
std::copy(region_name.cbegin(), region_name.cend(), country_name_buffer[i]);
}
// 0x000B0001 - Localized names for the profile Country
@ -627,7 +627,7 @@ std::u16string Module::GetUsername() {
// the username string in the block isn't null-terminated,
// so we need to find the end manually.
std::u16string username(block.username, ARRAY_SIZE(block.username));
const size_t pos = username.find(u'\0');
const std::size_t pos = username.find(u'\0');
if (pos != std::u16string::npos)
username.erase(pos);
return username;

View file

@ -330,16 +330,16 @@ Kernel::SharedPtr<Kernel::Event>& DSP_DSP::GetInterruptEvent(InterruptType type,
case InterruptType::One:
return interrupt_one;
case InterruptType::Pipe: {
const size_t pipe_index = static_cast<size_t>(pipe);
const std::size_t pipe_index = static_cast<std::size_t>(pipe);
ASSERT(pipe_index < AudioCore::num_dsp_pipe);
return pipes[pipe_index];
}
}
UNREACHABLE_MSG("Invalid interrupt type = {}", static_cast<size_t>(type));
UNREACHABLE_MSG("Invalid interrupt type = {}", static_cast<std::size_t>(type));
}
bool DSP_DSP::HasTooManyEventsRegistered() const {
size_t number =
std::size_t number =
std::count_if(pipes.begin(), pipes.end(), [](const auto& evt) { return evt != nullptr; });
if (interrupt_zero != nullptr)

View file

@ -18,11 +18,11 @@ public:
~DSP_DSP();
/// There are three types of interrupts
static constexpr size_t NUM_INTERRUPT_TYPE = 3;
static constexpr std::size_t NUM_INTERRUPT_TYPE = 3;
enum class InterruptType : u32 { Zero = 0, One = 1, Pipe = 2 };
/// Actual service implementation only has 6 'slots' for interrupts.
static constexpr size_t max_number_of_interrupt_events = 6;
static constexpr std::size_t max_number_of_interrupt_events = 6;
/// Signal interrupt on pipe
void SignalInterrupt(InterruptType type, AudioCore::DspPipe pipe);

View file

@ -106,8 +106,8 @@ void Module::Interface::GetMyScreenName(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx) {
const size_t scrambled_friend_code_size = 12;
const size_t friend_code_size = 8;
const std::size_t scrambled_friend_code_size = 12;
const std::size_t friend_code_size = 8;
IPC::RequestParser rp(ctx, 0x1C, 1, 2);
const u32 friend_code_count = rp.Pop<u32>();

View file

@ -94,7 +94,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
std::vector<u8> data(length);
ResultVal<size_t> read = backend->Read(offset, data.size(), data.data());
ResultVal<std::size_t> read = backend->Read(offset, data.size(), data.data());
if (read.Failed()) {
rb.Push(read.Code());
rb.Push<u32>(0);
@ -136,7 +136,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
std::vector<u8> data(length);
buffer.Read(data.data(), 0, data.size());
ResultVal<size_t> written = backend->Write(offset, data.size(), flush != 0, data.data());
ResultVal<std::size_t> written = backend->Write(offset, data.size(), flush != 0, data.data());
if (written.Failed()) {
rb.Push(written.Code());
rb.Push<u32>(0);
@ -268,7 +268,7 @@ void File::OpenSubFile(Kernel::HLERequestContext& ctx) {
return;
}
size_t end = offset + size;
std::size_t end = offset + size;
// TODO(Subv): Check for overflow and return ERR_WRITE_BEYOND_END

View file

@ -128,7 +128,7 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, const std::ve
LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
return ERR_REGS_MISALIGNED;
} else {
size_t offset = 0;
std::size_t offset = 0;
while (size_in_bytes > 0) {
u32 value;
std::memcpy(&value, &data[offset], sizeof(u32));
@ -172,7 +172,7 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes,
LOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
return ERR_REGS_MISALIGNED;
} else {
size_t offset = 0;
std::size_t offset = 0;
while (size_in_bytes > 0) {
const u32 reg_address = base_address + REGS_BEGIN;

View file

@ -131,7 +131,7 @@ void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) {
return;
}
static constexpr size_t MaxConcurrentHTTPContexts = 8;
static constexpr std::size_t MaxConcurrentHTTPContexts = 8;
if (session_data->num_http_contexts >= MaxConcurrentHTTPContexts) {
// There can only be 8 HTTP contexts open at the same time for any particular session.
LOG_ERROR(Service_HTTP, "Tried to open too many HTTP contexts");

View file

@ -105,7 +105,7 @@ public:
SetPacketInfo(info.end_index, packet_info);
// writes packet data
for (size_t i = 0; i < packet.size(); ++i) {
for (std::size_t i = 0; i < packet.size(); ++i) {
*GetDataBufferPointer((write_offset + i) % max_data_size) = packet[i];
}
@ -184,7 +184,7 @@ private:
/// Wraps the payload into packet and puts it to the receive buffer
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
LOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(payload.data(), payload.size()));
size_t size = payload.size();
std::size_t size = payload.size();
std::vector<u8> packet;

View file

@ -100,7 +100,7 @@ static std::mutex beacon_mutex;
// Number of beacons to store before we start dropping the old ones.
// TODO(Subv): Find a more accurate value for this limit.
constexpr size_t MaxBeaconFrames = 15;
constexpr std::size_t MaxBeaconFrames = 15;
// List of the last <MaxBeaconFrames> beacons received from the network.
static std::list<Network::WifiPacket> received_beacons;
@ -160,11 +160,11 @@ static void BroadcastNodeMap() {
packet.channel = network_channel;
packet.type = Network::WifiPacket::PacketType::NodeMap;
packet.destination_address = Network::BroadcastMac;
size_t size = node_map.size();
std::size_t size = node_map.size();
using node_t = decltype(node_map)::value_type;
packet.data.resize(sizeof(size) + (sizeof(node_t::first) + sizeof(node_t::second)) * size);
std::memcpy(packet.data.data(), &size, sizeof(size));
size_t offset = sizeof(size);
std::size_t offset = sizeof(size);
for (const auto& node : node_map) {
std::memcpy(packet.data.data() + offset, node.first.data(), sizeof(node.first));
std::memcpy(packet.data.data() + offset + sizeof(node.first), &node.second,
@ -178,12 +178,12 @@ static void BroadcastNodeMap() {
static void HandleNodeMapPacket(const Network::WifiPacket& packet) {
std::lock_guard<std::mutex> lock(connection_status_mutex);
node_map.clear();
size_t num_entries;
std::size_t num_entries;
Network::MacAddress address;
u16 id;
std::memcpy(&num_entries, packet.data.data(), sizeof(num_entries));
size_t offset = sizeof(num_entries);
for (size_t i = 0; i < num_entries; ++i) {
std::size_t offset = sizeof(num_entries);
for (std::size_t i = 0; i < num_entries; ++i) {
std::memcpy(&address, packet.data.data() + offset, sizeof(address));
std::memcpy(&id, packet.data.data() + offset + sizeof(address), sizeof(id));
node_map[address] = id;
@ -306,7 +306,7 @@ static void HandleEAPoLPacket(const Network::WifiPacket& packet) {
node_info.clear();
node_info.reserve(network_info.max_nodes);
for (size_t index = 0; index < logoff.connected_nodes; ++index) {
for (std::size_t index = 0; index < logoff.connected_nodes; ++index) {
connection_status.node_bitmask |= 1 << index;
connection_status.changed_nodes |= 1 << index;
connection_status.nodes[index] = logoff.nodes[index].network_node_id;
@ -332,7 +332,7 @@ static void HandleEAPoLPacket(const Network::WifiPacket& packet) {
node_info.clear();
node_info.reserve(network_info.max_nodes);
for (size_t index = 0; index < logoff.connected_nodes; ++index) {
for (std::size_t index = 0; index < logoff.connected_nodes; ++index) {
if ((connection_status.node_bitmask & (1 << index)) == 0) {
connection_status.changed_nodes |= 1 << index;
}
@ -584,7 +584,7 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
Kernel::MappedBuffer out_buffer = rp.PopMappedBuffer();
ASSERT(out_buffer.GetSize() == out_buffer_size);
size_t cur_buffer_size = sizeof(BeaconDataReplyHeader);
std::size_t cur_buffer_size = sizeof(BeaconDataReplyHeader);
// Retrieve all beacon frames that were received from the desired mac address.
auto beacons = GetReceivedBeacons(mac_address);
@ -736,7 +736,7 @@ void NWM_UDS::Bind(Kernel::HLERequestContext& ctx) {
return;
}
constexpr size_t MaxBindNodes = 16;
constexpr std::size_t MaxBindNodes = 16;
if (channel_data.size() >= MaxBindNodes) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ResultCode(ErrorDescription::OutOfMemory, ErrorModule::UDS,
@ -1027,7 +1027,7 @@ void NWM_UDS::SendTo(Kernel::HLERequestContext& ctx) {
dest_address = network_info.host_mac_address;
}
constexpr size_t MaxSize = 0x5C6;
constexpr std::size_t MaxSize = 0x5C6;
if (data_size > MaxSize) {
rb.Push(ResultCode(ErrorDescription::TooLarge, ErrorModule::UDS,
ErrorSummary::WrongArgument, ErrorLevel::Usage));

View file

@ -16,7 +16,7 @@
namespace Service {
namespace NWM {
const size_t ApplicationDataSize = 0xC8;
const std::size_t ApplicationDataSize = 0xC8;
const u8 DefaultNetworkChannel = 11;
// Number of milliseconds in a TU.

View file

@ -241,8 +241,8 @@ void DecryptBeacon(const NetworkInfo& network_info, std::vector<u8>& buffer) {
*/
std::vector<u8> GenerateNintendoFirstEncryptedDataTag(const NetworkInfo& network_info,
const NodeList& nodes) {
const size_t payload_size =
std::min<size_t>(EncryptedDataSizeCutoff, nodes.size() * sizeof(NodeInfo));
const std::size_t payload_size =
std::min<std::size_t>(EncryptedDataSizeCutoff, nodes.size() * sizeof(NodeInfo));
EncryptedDataTag tag{};
tag.header.tag_id = static_cast<u8>(TagId::VendorSpecific);
@ -273,9 +273,9 @@ std::vector<u8> GenerateNintendoSecondEncryptedDataTag(const NetworkInfo& networ
if (nodes.size() * sizeof(NodeInfo) <= EncryptedDataSizeCutoff)
return {};
const size_t payload_size = nodes.size() * sizeof(NodeInfo) - EncryptedDataSizeCutoff;
const std::size_t payload_size = nodes.size() * sizeof(NodeInfo) - EncryptedDataSizeCutoff;
const size_t tag_length = sizeof(EncryptedDataTag) - sizeof(TagHeader) + payload_size;
const std::size_t tag_length = sizeof(EncryptedDataTag) - sizeof(TagHeader) + payload_size;
// TODO(Subv): What does the 3DS do when a game has too much data to fit into the tag?
ASSERT_MSG(tag_length <= 255, "Data is too big.");

View file

@ -203,7 +203,7 @@ static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload
df.ChannelMessageEnd(CryptoPP::DEFAULT_CHANNEL);
df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
size_t size = df.MaxRetrievable();
std::size_t size = df.MaxRetrievable();
std::vector<u8> pdata(size);
df.Get(pdata.data(), size);
@ -257,7 +257,7 @@ static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
df.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
size_t size = df.MaxRetrievable();
std::size_t size = df.MaxRetrievable();
std::vector<u8> cipher(size);
df.Get(cipher.data(), size);
@ -357,7 +357,7 @@ std::vector<u8> GenerateEAPoLLogoffFrame(const MacAddress& mac_address, u16 netw
eapol_logoff.connected_nodes = total_nodes;
eapol_logoff.max_nodes = max_nodes;
for (size_t index = 0; index < total_nodes; ++index) {
for (std::size_t index = 0; index < total_nodes; ++index) {
const auto& node_info = nodes[index];
auto& node = eapol_logoff.nodes[index];

View file

@ -152,9 +152,9 @@ void ServiceFrameworkBase::InstallAsNamedPort() {
AddNamedPort(service_name, std::move(client_port));
}
void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, size_t n) {
void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) {
handlers.reserve(handlers.size() + n);
for (size_t i = 0; i < n; ++i) {
for (std::size_t i = 0; i < n; ++i) {
// Usually this array is sorted by id already, so hint to insert at the end
handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]);
}

View file

@ -83,7 +83,7 @@ private:
ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker);
~ServiceFrameworkBase();
void RegisterHandlersBase(const FunctionInfoBase* functions, size_t n);
void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n);
void ReportUnimplementedFunction(u32* cmd_buf, const FunctionInfoBase* info);
/// Identifier string used to connect to the service.
@ -147,7 +147,7 @@ protected:
: ServiceFrameworkBase(service_name, max_sessions, Invoker) {}
/// Registers handlers in the service.
template <size_t N>
template <std::size_t N>
void RegisterHandlers(const FunctionInfo (&functions)[N]) {
RegisterHandlers(functions, N);
}
@ -156,7 +156,7 @@ protected:
* Registers handlers in the service. Usually prefer using the other RegisterHandlers
* overload in order to avoid needing to specify the array size.
*/
void RegisterHandlers(const FunctionInfo* functions, size_t n) {
void RegisterHandlers(const FunctionInfo* functions, std::size_t n) {
RegisterHandlersBase(functions, n);
}

View file

@ -85,7 +85,7 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) {
void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x5, 4, 0);
auto name_buf = rp.PopRaw<std::array<char, 8>>();
size_t name_len = rp.Pop<u32>();
std::size_t name_len = rp.Pop<u32>();
u32 flags = rp.Pop<u32>();
bool wait_until_available = (flags & 1) == 0;
@ -218,7 +218,7 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x3, 4, 0);
auto name_buf = rp.PopRaw<std::array<char, 8>>();
size_t name_len = rp.Pop<u32>();
std::size_t name_len = rp.Pop<u32>();
u32 max_sessions = rp.Pop<u32>();
std::string name(name_buf.data(), std::min(name_len, name_buf.size()));

View file

@ -51,7 +51,7 @@ ResultCode ConversionConfiguration::SetInputLines(u16 lines) {
ResultCode ConversionConfiguration::SetStandardCoefficient(
StandardCoefficient standard_coefficient) {
size_t index = static_cast<size_t>(standard_coefficient);
std::size_t index = static_cast<std::size_t>(standard_coefficient);
if (index >= ARRAY_SIZE(standard_coefficients)) {
return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053ED

View file

@ -44,7 +44,7 @@ public:
} // namespace
std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& nonce,
size_t slot_id) {
std::size_t slot_id) {
if (!IsNormalKeyAvailable(slot_id)) {
LOG_ERROR(HW_AES, "Key slot {} not available. Will use zero key.", slot_id);
}
@ -65,7 +65,7 @@ std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& non
}
std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce& nonce,
size_t slot_id) {
std::size_t slot_id) {
if (!IsNormalKeyAvailable(slot_id)) {
LOG_ERROR(HW_AES, "Key slot {} not available. Will use zero key.", slot_id);
}

View file

@ -12,8 +12,8 @@
namespace HW {
namespace AES {
constexpr size_t CCM_NONCE_SIZE = 12;
constexpr size_t CCM_MAC_SIZE = 16;
constexpr std::size_t CCM_NONCE_SIZE = 12;
constexpr std::size_t CCM_MAC_SIZE = 16;
using CCMNonce = std::array<u8, CCM_NONCE_SIZE>;
@ -24,7 +24,8 @@ using CCMNonce = std::array<u8, CCM_NONCE_SIZE>;
* @param slot_id The slot ID of the key to use for encryption
* @returns a vector of u8 containing the encrypted data with MAC at the end
*/
std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& nonce, size_t slot_id);
std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& nonce,
std::size_t slot_id);
/**
* Decrypts and verify the MAC of the given data using AES-CCM algorithm.
@ -34,7 +35,7 @@ std::vector<u8> EncryptSignCCM(const std::vector<u8>& pdata, const CCMNonce& non
* @returns a vector of u8 containing the decrypted data; an empty vector if the verification fails
*/
std::vector<u8> DecryptVerifyCCM(const std::vector<u8>& cipher, const CCMNonce& nonce,
size_t slot_id);
std::size_t slot_id);
} // namespace AES
} // namespace HW

View file

@ -62,7 +62,7 @@ AESKey HexToKey(const std::string& hex) {
}
AESKey key;
for (size_t i = 0; i < key.size(); ++i) {
for (std::size_t i = 0; i < key.size(); ++i) {
key[i] = static_cast<u8>(std::stoi(hex.substr(i * 2, 2), 0, 16));
}
@ -102,7 +102,7 @@ void LoadPresetKeys() {
continue;
}
size_t slot_id;
std::size_t slot_id;
char key_type;
if (std::sscanf(name.c_str(), "slot0x%zXKey%c", &slot_id, &key_type) != 2) {
LOG_ERROR(HW_AES, "Invalid key name {}", name);
@ -145,23 +145,23 @@ void SetGeneratorConstant(const AESKey& key) {
generator_constant = key;
}
void SetKeyX(size_t slot_id, const AESKey& key) {
void SetKeyX(std::size_t slot_id, const AESKey& key) {
key_slots.at(slot_id).SetKeyX(key);
}
void SetKeyY(size_t slot_id, const AESKey& key) {
void SetKeyY(std::size_t slot_id, const AESKey& key) {
key_slots.at(slot_id).SetKeyY(key);
}
void SetNormalKey(size_t slot_id, const AESKey& key) {
void SetNormalKey(std::size_t slot_id, const AESKey& key) {
key_slots.at(slot_id).SetNormalKey(key);
}
bool IsNormalKeyAvailable(size_t slot_id) {
bool IsNormalKeyAvailable(std::size_t slot_id) {
return key_slots.at(slot_id).normal.is_initialized();
}
AESKey GetNormalKey(size_t slot_id) {
AESKey GetNormalKey(std::size_t slot_id) {
return key_slots.at(slot_id).normal.value_or(AESKey{});
}

View file

@ -11,7 +11,7 @@
namespace HW {
namespace AES {
enum KeySlotID : size_t {
enum KeySlotID : std::size_t {
// Used to decrypt the SSL client cert/private-key stored in ClCertA.
SSLKey = 0x0D,
@ -31,19 +31,19 @@ enum KeySlotID : size_t {
MaxKeySlotID = 0x40,
};
constexpr size_t AES_BLOCK_SIZE = 16;
constexpr std::size_t AES_BLOCK_SIZE = 16;
using AESKey = std::array<u8, AES_BLOCK_SIZE>;
void InitKeys();
void SetGeneratorConstant(const AESKey& key);
void SetKeyX(size_t slot_id, const AESKey& key);
void SetKeyY(size_t slot_id, const AESKey& key);
void SetNormalKey(size_t slot_id, const AESKey& key);
void SetKeyX(std::size_t slot_id, const AESKey& key);
void SetKeyY(std::size_t slot_id, const AESKey& key);
void SetNormalKey(std::size_t slot_id, const AESKey& key);
bool IsNormalKeyAvailable(size_t slot_id);
AESKey GetNormalKey(size_t slot_id);
bool IsNormalKeyAvailable(std::size_t slot_id);
AESKey GetNormalKey(std::size_t slot_id);
} // namespace AES
} // namespace HW

View file

@ -114,8 +114,8 @@ static void MemoryFill(const Regs::MemoryFillConfig& config) {
// fill with 32-bit values
if (end > start) {
u32 value = config.value_32bit;
size_t len = (end - start) / sizeof(u32);
for (size_t i = 0; i < len; ++i)
std::size_t len = (end - start) / sizeof(u32);
for (std::size_t i = 0; i < len; ++i)
memcpy(&start[i * sizeof(u32)], &value, sizeof(u32));
}
} else {
@ -348,12 +348,12 @@ static void TextureCopy(const Regs::DisplayTransferConfig& config) {
return;
}
size_t contiguous_input_size =
std::size_t contiguous_input_size =
config.texture_copy.size / input_width * (input_width + input_gap);
Memory::RasterizerFlushRegion(config.GetPhysicalInputAddress(),
static_cast<u32>(contiguous_input_size));
size_t contiguous_output_size =
std::size_t contiguous_output_size =
config.texture_copy.size / output_width * (output_width + output_gap);
// Only need to flush output if it has a gap
const auto FlushInvalidate_fn = (output_gap != 0) ? Memory::RasterizerFlushAndInvalidateRegion

View file

@ -30,11 +30,11 @@ constexpr float SCREEN_REFRESH_RATE = 60;
#else
// NOTE: Yeah, hacking in a static_assert here just to workaround the lacking MSVC compiler
// really is this annoying. This macro just forwards its first argument to GPU_REG_INDEX
// and then performs a (no-op) cast to size_t iff the second argument matches the expected
// field offset. Otherwise, the compiler will fail to compile this code.
// and then performs a (no-op) cast to std::size_t iff the second argument matches the
// expected field offset. Otherwise, the compiler will fail to compile this code.
#define GPU_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) \
((typename std::enable_if<backup_workaround_index == GPU_REG_INDEX(field_name), size_t>::type) \
GPU_REG_INDEX(field_name))
((typename std::enable_if<backup_workaround_index == GPU_REG_INDEX(field_name), \
std::size_t>::type) GPU_REG_INDEX(field_name))
#endif
// MMIO region 0x1EFxxxxx
@ -268,7 +268,7 @@ struct Regs {
INSERT_PADDING_WORDS(0x9c3);
static constexpr size_t NumIds() {
static constexpr std::size_t NumIds() {
return sizeof(Regs) / sizeof(u32);
}

View file

@ -37,7 +37,7 @@ struct Regs {
u32 backlight_bottom;
INSERT_PADDING_WORDS(0x16F);
static constexpr size_t NumIds() {
static constexpr std::size_t NumIds() {
return sizeof(Regs) / sizeof(u32);
}

View file

@ -19,8 +19,8 @@ namespace Y2R {
using namespace Service::Y2R;
static const size_t MAX_TILES = 1024 / 8;
static const size_t TILE_SIZE = 8 * 8;
static const std::size_t MAX_TILES = 1024 / 8;
static const std::size_t TILE_SIZE = 8 * 8;
using ImageTile = std::array<u32, TILE_SIZE>;
/// Converts a image strip from the source YUV format into individual 8x8 RGB32 tiles.
@ -78,15 +78,15 @@ static void ConvertYUVToRGB(InputFormat input_format, const u8* input_Y, const u
/// Simulates an incoming CDMA transfer. The N parameter is used to automatically convert 16-bit
/// formats to 8-bit.
template <size_t N>
static void ReceiveData(u8* output, ConversionBuffer& buf, size_t amount_of_data) {
template <std::size_t N>
static void ReceiveData(u8* output, ConversionBuffer& buf, std::size_t amount_of_data) {
const u8* input = Memory::GetPointer(buf.address);
size_t output_unit = buf.transfer_unit / N;
std::size_t output_unit = buf.transfer_unit / N;
ASSERT(amount_of_data % output_unit == 0);
while (amount_of_data > 0) {
for (size_t i = 0; i < output_unit; ++i) {
for (std::size_t i = 0; i < output_unit; ++i) {
output[i] = input[i * N];
}
@ -263,7 +263,7 @@ void PerformConversion(ConversionConfiguration& cvt) {
ASSERT(cvt.input_line_width % 8 == 0);
ASSERT(cvt.block_alignment != BlockAlignment::Block8x8 || cvt.input_lines % 8 == 0);
// Tiles per row
size_t num_tiles = cvt.input_line_width / 8;
std::size_t num_tiles = cvt.input_line_width / 8;
ASSERT(num_tiles <= MAX_TILES);
// Buffer used as a CDMA source/target.
@ -288,7 +288,7 @@ void PerformConversion(ConversionConfiguration& cvt) {
unsigned int row_height = std::min(cvt.input_lines - y, 8u);
// Total size in pixels of incoming data required for this strip.
const size_t row_data_size = row_height * cvt.input_line_width;
const std::size_t row_data_size = row_height * cvt.input_line_width;
u8* input_Y = data_buffer.get();
u8* input_U = input_Y + 8 * cvt.input_line_width;
@ -329,7 +329,7 @@ void PerformConversion(ConversionConfiguration& cvt) {
u32* output_buffer = reinterpret_cast<u32*>(data_buffer.get());
for (size_t i = 0; i < num_tiles; ++i) {
for (std::size_t i = 0; i < num_tiles; ++i) {
int image_strip_width = 0;
int output_stride = 0;

View file

@ -129,7 +129,7 @@ static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr,
// Read the relocation headers
std::vector<u32> relocs(n_reloc_tables * NUM_SEGMENTS);
for (unsigned int current_segment = 0; current_segment < NUM_SEGMENTS; ++current_segment) {
size_t size = n_reloc_tables * sizeof(u32);
std::size_t size = n_reloc_tables * sizeof(u32);
if (file.ReadBytes(&relocs[current_segment * n_reloc_tables], size) != size)
return ERROR_READ;
}

View file

@ -297,7 +297,7 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
}
std::vector<u8> program_image(total_image_size);
size_t current_image_position = 0;
std::size_t current_image_position = 0;
SharedPtr<CodeSet> codeset = CodeSet::Create("", 0);
@ -386,7 +386,7 @@ ResultStatus AppLoader_ELF::Load(Kernel::SharedPtr<Kernel::Process>& process) {
// Reset read pointer in case this file has been read before.
file.Seek(0, SEEK_SET);
size_t size = file.GetSize();
std::size_t size = file.GetSize();
std::unique_ptr<u8[]> buffer(new u8[size]);
if (file.ReadBytes(&buffer[0], size) != size)
return ResultStatus::Error;

View file

@ -472,15 +472,15 @@ u64 Read64(const VAddr addr) {
}
void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer,
const size_t size) {
const std::size_t size) {
auto& page_table = process.vm_manager.page_table;
size_t remaining_size = size;
size_t page_index = src_addr >> PAGE_BITS;
size_t page_offset = src_addr & PAGE_MASK;
std::size_t remaining_size = size;
std::size_t page_index = src_addr >> PAGE_BITS;
std::size_t page_offset = src_addr & PAGE_MASK;
while (remaining_size > 0) {
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
const std::size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
switch (page_table.attributes[page_index]) {
@ -521,7 +521,7 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_
}
}
void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
void ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_t size) {
ReadBlock(*Kernel::g_current_process, src_addr, dest_buffer, size);
}
@ -542,14 +542,14 @@ void Write64(const VAddr addr, const u64 data) {
}
void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const void* src_buffer,
const size_t size) {
const std::size_t size) {
auto& page_table = process.vm_manager.page_table;
size_t remaining_size = size;
size_t page_index = dest_addr >> PAGE_BITS;
size_t page_offset = dest_addr & PAGE_MASK;
std::size_t remaining_size = size;
std::size_t page_index = dest_addr >> PAGE_BITS;
std::size_t page_offset = dest_addr & PAGE_MASK;
while (remaining_size > 0) {
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
const std::size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
switch (page_table.attributes[page_index]) {
@ -589,20 +589,20 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi
}
}
void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size) {
void WriteBlock(const VAddr dest_addr, const void* src_buffer, const std::size_t size) {
WriteBlock(*Kernel::g_current_process, dest_addr, src_buffer, size);
}
void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size_t size) {
void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const std::size_t size) {
auto& page_table = process.vm_manager.page_table;
size_t remaining_size = size;
size_t page_index = dest_addr >> PAGE_BITS;
size_t page_offset = dest_addr & PAGE_MASK;
std::size_t remaining_size = size;
std::size_t page_index = dest_addr >> PAGE_BITS;
std::size_t page_offset = dest_addr & PAGE_MASK;
static const std::array<u8, PAGE_SIZE> zeros = {};
while (remaining_size > 0) {
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
const std::size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
switch (page_table.attributes[page_index]) {
@ -641,18 +641,19 @@ void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size
}
}
void ZeroBlock(const VAddr dest_addr, const size_t size) {
void ZeroBlock(const VAddr dest_addr, const std::size_t size) {
ZeroBlock(*Kernel::g_current_process, dest_addr, size);
}
void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, const size_t size) {
void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
const std::size_t size) {
auto& page_table = process.vm_manager.page_table;
size_t remaining_size = size;
size_t page_index = src_addr >> PAGE_BITS;
size_t page_offset = src_addr & PAGE_MASK;
std::size_t remaining_size = size;
std::size_t page_index = src_addr >> PAGE_BITS;
std::size_t page_offset = src_addr & PAGE_MASK;
while (remaining_size > 0) {
const size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
const std::size_t copy_amount = std::min(PAGE_SIZE - page_offset, remaining_size);
const VAddr current_vaddr = static_cast<VAddr>((page_index << PAGE_BITS) + page_offset);
switch (page_table.attributes[page_index]) {
@ -695,7 +696,7 @@ void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
}
}
void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
void CopyBlock(VAddr dest_addr, VAddr src_addr, const std::size_t size) {
CopyBlock(*Kernel::g_current_process, dest_addr, src_addr, size);
}

View file

@ -25,7 +25,7 @@ namespace Memory {
const u32 PAGE_SIZE = 0x1000;
const u32 PAGE_MASK = PAGE_SIZE - 1;
const int PAGE_BITS = 12;
const size_t PAGE_TABLE_NUM_ENTRIES = 1 << (32 - PAGE_BITS);
const std::size_t PAGE_TABLE_NUM_ENTRIES = 1 << (32 - PAGE_BITS);
enum class PageType {
/// Page is unmapped and should cause an access error.
@ -196,15 +196,15 @@ void Write16(VAddr addr, u16 data);
void Write32(VAddr addr, u32 data);
void Write64(VAddr addr, u64 data);
void ReadBlock(const Kernel::Process& process, VAddr src_addr, void* dest_buffer, size_t size);
void ReadBlock(VAddr src_addr, void* dest_buffer, size_t size);
void ReadBlock(const Kernel::Process& process, VAddr src_addr, void* dest_buffer, std::size_t size);
void ReadBlock(VAddr src_addr, void* dest_buffer, std::size_t size);
void WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer,
size_t size);
void WriteBlock(VAddr dest_addr, const void* src_buffer, size_t size);
void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, const size_t size);
void ZeroBlock(VAddr dest_addr, const size_t size);
void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, size_t size);
void CopyBlock(VAddr dest_addr, VAddr src_addr, size_t size);
std::size_t size);
void WriteBlock(VAddr dest_addr, const void* src_buffer, std::size_t size);
void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, const std::size_t size);
void ZeroBlock(VAddr dest_addr, const std::size_t size);
void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, std::size_t size);
void CopyBlock(VAddr dest_addr, VAddr src_addr, std::size_t size);
u8* GetPointer(VAddr vaddr);

View file

@ -24,14 +24,14 @@ public:
virtual u32 Read32(VAddr addr) = 0;
virtual u64 Read64(VAddr addr) = 0;
virtual bool ReadBlock(VAddr src_addr, void* dest_buffer, size_t size) = 0;
virtual bool ReadBlock(VAddr src_addr, void* dest_buffer, std::size_t size) = 0;
virtual void Write8(VAddr addr, u8 data) = 0;
virtual void Write16(VAddr addr, u16 data) = 0;
virtual void Write32(VAddr addr, u32 data) = 0;
virtual void Write64(VAddr addr, u64 data) = 0;
virtual bool WriteBlock(VAddr dest_addr, const void* src_buffer, size_t size) = 0;
virtual bool WriteBlock(VAddr dest_addr, const void* src_buffer, std::size_t size) = 0;
};
using MMIORegionPointer = std::shared_ptr<MMIORegion>;

View file

@ -120,6 +120,6 @@ private:
std::string record_movie_file;
std::vector<u8> recorded_input;
std::function<void()> playback_completion_callback;
size_t current_byte = 0;
std::size_t current_byte = 0;
};
} // namespace Core

View file

@ -76,7 +76,7 @@ void Recorder::Finish(const std::string& filename) {
try {
// Open file and write header
FileUtil::IOFile file(filename, "wb");
size_t written = file.WriteObject(header);
std::size_t written = file.WriteObject(header);
if (written != 1 || file.Tell() != initial.gpu_registers)
throw "Failed to write header";