mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-02 16:49:04 +00:00
Fix some LGTM alerts
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
path_classifiers:
|
path_classifiers:
|
||||||
library: "externals"
|
library: "externals"
|
||||||
queries:
|
queries:
|
||||||
include: "*"
|
- include: "*"
|
||||||
|
- exclude: cpp/array-in-interface
|
||||||
|
- exclude: cpp/world-writable-file-creation
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ bool DataContainer::GetPartitionData(std::vector<u8>& out, u8 index) const {
|
|||||||
partitions[index].size),
|
partitions[index].size),
|
||||||
LOG_ERROR(Core, "File size is too small"));
|
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::move(partition_data));
|
||||||
|
|
||||||
std::vector<u8> ivfc_data;
|
std::vector<u8> ivfc_data;
|
||||||
|
|||||||
+18
-15
@@ -114,7 +114,8 @@ bool SDSavegame::Init() {
|
|||||||
|
|
||||||
// Read data region
|
// Read data region
|
||||||
if (duplicate_data) {
|
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<std::size_t>(fs_info.data_region_block_size));
|
||||||
TRY(CheckedMemcpy(data_region.data(), data, fs_info.data_region_offset, data_region.size()),
|
TRY(CheckedMemcpy(data_region.data(), data, fs_info.data_region_offset, data_region.size()),
|
||||||
LOG_ERROR(Core, "File size is too small"));
|
LOG_ERROR(Core, "File size is too small"));
|
||||||
} else {
|
} else {
|
||||||
@@ -129,10 +130,10 @@ bool SDSavegame::Init() {
|
|||||||
directory_entry_table.resize(fs_info.maximum_directory_count + 2); // including head and root
|
directory_entry_table.resize(fs_info.maximum_directory_count + 2); // including head and root
|
||||||
|
|
||||||
auto directory_entry_table_pos =
|
auto directory_entry_table_pos =
|
||||||
duplicate_data
|
duplicate_data ? fs_info.data_region_offset +
|
||||||
? fs_info.data_region_offset + fs_info.directory_entry_table.duplicate.block_index *
|
fs_info.directory_entry_table.duplicate.block_index *
|
||||||
fs_info.data_region_block_size
|
static_cast<std::size_t>(fs_info.data_region_block_size)
|
||||||
: fs_info.directory_entry_table.non_duplicate;
|
: fs_info.directory_entry_table.non_duplicate;
|
||||||
|
|
||||||
TRY(CheckedMemcpy(directory_entry_table.data(), header_vector, directory_entry_table_pos,
|
TRY(CheckedMemcpy(directory_entry_table.data(), header_vector, directory_entry_table_pos,
|
||||||
directory_entry_table.size() * sizeof(DirectoryEntryTableEntry)),
|
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
|
file_entry_table.resize(fs_info.maximum_file_count + 1); // including head
|
||||||
|
|
||||||
auto file_entry_table_pos =
|
auto file_entry_table_pos =
|
||||||
duplicate_data
|
duplicate_data ? fs_info.data_region_offset +
|
||||||
? fs_info.data_region_offset +
|
fs_info.file_entry_table.duplicate.block_index *
|
||||||
fs_info.file_entry_table.duplicate.block_index * fs_info.data_region_block_size
|
static_cast<std::size_t>(fs_info.data_region_block_size)
|
||||||
: fs_info.file_entry_table.non_duplicate;
|
: fs_info.file_entry_table.non_duplicate;
|
||||||
|
|
||||||
TRY(CheckedMemcpy(file_entry_table.data(), header_vector, file_entry_table_pos,
|
TRY(CheckedMemcpy(file_entry_table.data(), header_vector, file_entry_table_pos,
|
||||||
file_entry_table.size() * sizeof(FileEntryTableEntry)),
|
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;
|
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<std::size_t>(fs_info.data_region_block_size) * (last_block - block + 1);
|
||||||
const std::size_t to_write = std::min<std::size_t>(file_size, size);
|
const std::size_t to_write = std::min<std::size_t>(file_size, size);
|
||||||
|
|
||||||
if (data_region.size() < fs_info.data_region_block_size * block + to_write) {
|
if (data_region.size() <
|
||||||
|
static_cast<std::size_t>(fs_info.data_region_block_size) * block + to_write) {
|
||||||
LOG_ERROR(Core, "Out of bound block: {} to_write: {}", block, to_write);
|
LOG_ERROR(Core, "Out of bound block: {} to_write: {}", block, to_write);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -299,8 +302,8 @@ bool SDExtdata::Init() {
|
|||||||
directory_entry_table.resize(fs_info.maximum_directory_count + 2); // including head and root
|
directory_entry_table.resize(fs_info.maximum_directory_count + 2); // including head and root
|
||||||
|
|
||||||
const auto directory_entry_table_pos =
|
const auto directory_entry_table_pos =
|
||||||
fs_info.data_region_offset +
|
fs_info.data_region_offset + fs_info.directory_entry_table.duplicate.block_index *
|
||||||
fs_info.directory_entry_table.duplicate.block_index * fs_info.data_region_block_size;
|
static_cast<std::size_t>(fs_info.data_region_block_size);
|
||||||
|
|
||||||
TRY(CheckedMemcpy(directory_entry_table.data(), vsxe, directory_entry_table_pos,
|
TRY(CheckedMemcpy(directory_entry_table.data(), vsxe, directory_entry_table_pos,
|
||||||
directory_entry_table.size() * sizeof(DirectoryEntryTableEntry)),
|
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
|
file_entry_table.resize(fs_info.maximum_file_count + 1); // including head
|
||||||
|
|
||||||
const auto file_entry_table_pos =
|
const auto file_entry_table_pos =
|
||||||
fs_info.data_region_offset +
|
fs_info.data_region_offset + fs_info.file_entry_table.duplicate.block_index *
|
||||||
fs_info.file_entry_table.duplicate.block_index * fs_info.data_region_block_size;
|
static_cast<std::size_t>(fs_info.data_region_block_size);
|
||||||
|
|
||||||
TRY(CheckedMemcpy(file_entry_table.data(), vsxe, file_entry_table_pos,
|
TRY(CheckedMemcpy(file_entry_table.data(), vsxe, file_entry_table_pos,
|
||||||
file_entry_table.size() * sizeof(FileEntryTableEntry)),
|
file_entry_table.size() * sizeof(FileEntryTableEntry)),
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
// Modified from Citra's implementation to allow multiple instances
|
// Modified from Citra's implementation to allow multiple instances
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ void TitleMetadata::Print() const {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "Content chunks for content info index {}:", i);
|
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<u16>(index + count); j++) {
|
||||||
// Don't attempt to print content we don't have
|
// Don't attempt to print content we don't have
|
||||||
if (j > tmd_body.content_count)
|
if (j > tmd_body.content_count)
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user