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:
parent
eca98eeb3e
commit
7d8f115185
158 changed files with 669 additions and 634 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue