diff --git a/.lgtm.yml b/.lgtm.yml index 87c99fe..1424523 100644 --- a/.lgtm.yml +++ b/.lgtm.yml @@ -1,4 +1,6 @@ path_classifiers: library: "externals" queries: - include: "*" + - include: "*" + - exclude: cpp/array-in-interface + - exclude: cpp/world-writable-file-creation diff --git a/src/core/data_container.cpp b/src/core/data_container.cpp index 793afaf..ea93a32 100644 --- a/src/core/data_container.cpp +++ b/src/core/data_container.cpp @@ -190,7 +190,7 @@ bool DataContainer::GetPartitionData(std::vector& out, u8 index) const { partitions[index].size), LOG_ERROR(Core, "File size is too small")); - DPFSContainer dpfs_container(dpfs_descriptor, difi.dpfs_level1_selector, + DPFSContainer dpfs_container(std::move(dpfs_descriptor), difi.dpfs_level1_selector, std::move(partition_data)); std::vector ivfc_data; diff --git a/src/core/inner_fat.cpp b/src/core/inner_fat.cpp index 72d0b9e..edb06a9 100644 --- a/src/core/inner_fat.cpp +++ b/src/core/inner_fat.cpp @@ -114,7 +114,8 @@ bool SDSavegame::Init() { // Read data region if (duplicate_data) { - data_region.resize(fs_info.data_region_block_count * fs_info.data_region_block_size); + data_region.resize(fs_info.data_region_block_count * + static_cast(fs_info.data_region_block_size)); TRY(CheckedMemcpy(data_region.data(), data, fs_info.data_region_offset, data_region.size()), LOG_ERROR(Core, "File size is too small")); } else { @@ -129,10 +130,10 @@ bool SDSavegame::Init() { directory_entry_table.resize(fs_info.maximum_directory_count + 2); // including head and root auto directory_entry_table_pos = - duplicate_data - ? fs_info.data_region_offset + fs_info.directory_entry_table.duplicate.block_index * - fs_info.data_region_block_size - : fs_info.directory_entry_table.non_duplicate; + duplicate_data ? fs_info.data_region_offset + + fs_info.directory_entry_table.duplicate.block_index * + static_cast(fs_info.data_region_block_size) + : fs_info.directory_entry_table.non_duplicate; TRY(CheckedMemcpy(directory_entry_table.data(), header_vector, directory_entry_table_pos, directory_entry_table.size() * sizeof(DirectoryEntryTableEntry)), @@ -142,10 +143,10 @@ bool SDSavegame::Init() { file_entry_table.resize(fs_info.maximum_file_count + 1); // including head auto file_entry_table_pos = - duplicate_data - ? fs_info.data_region_offset + - fs_info.file_entry_table.duplicate.block_index * fs_info.data_region_block_size - : fs_info.file_entry_table.non_duplicate; + duplicate_data ? fs_info.data_region_offset + + fs_info.file_entry_table.duplicate.block_index * + static_cast(fs_info.data_region_block_size) + : fs_info.file_entry_table.non_duplicate; TRY(CheckedMemcpy(file_entry_table.data(), header_vector, file_entry_table_pos, file_entry_table.size() * sizeof(FileEntryTableEntry)), @@ -197,10 +198,12 @@ bool SDSavegame::ExtractFile(const std::string& path, std::size_t index) const { last_block = fat[block + 2].v.index - 1; } - const std::size_t size = fs_info.data_region_block_size * (last_block - block + 1); + const std::size_t size = + static_cast(fs_info.data_region_block_size) * (last_block - block + 1); const std::size_t to_write = std::min(file_size, size); - if (data_region.size() < fs_info.data_region_block_size * block + to_write) { + if (data_region.size() < + static_cast(fs_info.data_region_block_size) * block + to_write) { LOG_ERROR(Core, "Out of bound block: {} to_write: {}", block, to_write); return false; } @@ -299,8 +302,8 @@ bool SDExtdata::Init() { directory_entry_table.resize(fs_info.maximum_directory_count + 2); // including head and root const auto directory_entry_table_pos = - fs_info.data_region_offset + - fs_info.directory_entry_table.duplicate.block_index * fs_info.data_region_block_size; + fs_info.data_region_offset + fs_info.directory_entry_table.duplicate.block_index * + static_cast(fs_info.data_region_block_size); TRY(CheckedMemcpy(directory_entry_table.data(), vsxe, directory_entry_table_pos, directory_entry_table.size() * sizeof(DirectoryEntryTableEntry)), @@ -310,8 +313,8 @@ bool SDExtdata::Init() { file_entry_table.resize(fs_info.maximum_file_count + 1); // including head const auto file_entry_table_pos = - fs_info.data_region_offset + - fs_info.file_entry_table.duplicate.block_index * fs_info.data_region_block_size; + fs_info.data_region_offset + fs_info.file_entry_table.duplicate.block_index * + static_cast(fs_info.data_region_block_size); TRY(CheckedMemcpy(file_entry_table.data(), vsxe, file_entry_table_pos, file_entry_table.size() * sizeof(FileEntryTableEntry)), diff --git a/src/core/ncch/cia_builder.h b/src/core/ncch/cia_builder.h index 42c253a..cab742f 100644 --- a/src/core/ncch/cia_builder.h +++ b/src/core/ncch/cia_builder.h @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#pragma once + #include #include #include diff --git a/src/core/ncch/seed_db.h b/src/core/ncch/seed_db.h index ea20480..ac79f88 100644 --- a/src/core/ncch/seed_db.h +++ b/src/core/ncch/seed_db.h @@ -4,6 +4,8 @@ // Modified from Citra's implementation to allow multiple instances +#pragma once + #include #include #include diff --git a/src/core/ncch/title_metadata.cpp b/src/core/ncch/title_metadata.cpp index 55b7c63..b528bc3 100644 --- a/src/core/ncch/title_metadata.cpp +++ b/src/core/ncch/title_metadata.cpp @@ -234,7 +234,7 @@ void TitleMetadata::Print() const { continue; LOG_DEBUG(Service_FS, "Content chunks for content info index {}:", i); - for (u16 j = index; j < index + count; j++) { + for (u16 j = index; j < static_cast(index + count); j++) { // Don't attempt to print content we don't have if (j > tmd_body.content_count) break;