mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-05 08:39:04 +00:00
Fix LGTM alerts
This commit is contained in:
@@ -11,7 +11,8 @@ namespace Core {
|
|||||||
|
|
||||||
DPFSContainer::DPFSContainer(DPFSDescriptor descriptor_, u8 level1_selector_,
|
DPFSContainer::DPFSContainer(DPFSDescriptor descriptor_, u8 level1_selector_,
|
||||||
std::vector<u32_le> data_)
|
std::vector<u32_le> data_)
|
||||||
: descriptor(descriptor_), level1_selector(level1_selector_), data(std::move(data_)) {
|
: descriptor(std::move(descriptor_)), level1_selector(level1_selector_),
|
||||||
|
data(std::move(data_)) {
|
||||||
|
|
||||||
ASSERT_MSG(descriptor.magic == MakeMagic('D', 'P', 'F', 'S'), "DPFS Magic is not correct");
|
ASSERT_MSG(descriptor.magic == MakeMagic('D', 'P', 'F', 'S'), "DPFS Magic is not correct");
|
||||||
ASSERT_MSG(descriptor.version == 0x10000, "DPFS Version is not correct");
|
ASSERT_MSG(descriptor.version == 0x10000, "DPFS Version is not correct");
|
||||||
|
|||||||
@@ -245,12 +245,13 @@ protected:
|
|||||||
last_block = fat[block + 2].v.index - 1;
|
last_block = fat[block + 2].v.index - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::size_t size =
|
// offset & size of the data chunk represented by the FAT node
|
||||||
|
const auto offset = static_cast<std::ptrdiff_t>(fs_info.data_region_block_size) * block;
|
||||||
|
const auto size =
|
||||||
static_cast<std::size_t>(fs_info.data_region_block_size) * (last_block - block + 1);
|
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);
|
|
||||||
|
|
||||||
TRY(CheckedMemcpy(out.data() + written, data_region,
|
const auto to_write = std::min<std::size_t>(file_size, size);
|
||||||
fs_info.data_region_block_size * block, to_write),
|
TRY(CheckedMemcpy(out.data() + written, data_region, offset, to_write),
|
||||||
LOG_ERROR(Core, "File data out of bound"));
|
LOG_ERROR(Core, "File data out of bound"));
|
||||||
file_size -= to_write;
|
file_size -= to_write;
|
||||||
written += to_write;
|
written += to_write;
|
||||||
@@ -301,7 +302,7 @@ public:
|
|||||||
std::array<char, 17> name_data = {}; // Append a null terminator
|
std::array<char, 17> name_data = {}; // Append a null terminator
|
||||||
std::memcpy(name_data.data(), entry.name.data(), entry.name.size());
|
std::memcpy(name_data.data(), entry.name.data(), entry.name.size());
|
||||||
|
|
||||||
std::string name = name_data.data();
|
const std::string name = name_data.data();
|
||||||
std::string new_path = name.empty() ? path : path + name + "/"; // Name is empty for root
|
std::string new_path = name.empty() ? path : path + name + "/"; // Name is empty for root
|
||||||
|
|
||||||
if (!FileUtil::CreateFullPath(new_path)) {
|
if (!FileUtil::CreateFullPath(new_path)) {
|
||||||
@@ -317,13 +318,12 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto& file_entry = this->file_entry_table[cur];
|
const auto& file_entry = this->file_entry_table[cur];
|
||||||
|
|
||||||
std::array<char, 17> name_data = {}; // Append a null terminator
|
|
||||||
std::memcpy(name_data.data(), file_entry.name.data(), file_entry.name.size());
|
std::memcpy(name_data.data(), file_entry.name.data(), file_entry.name.size());
|
||||||
|
|
||||||
if (!static_cast<const T*>(this)->ExtractFile(new_path + std::string{name_data.data()},
|
if (!static_cast<const T*>(this)->ExtractFile(new_path + std::string{name_data.data()},
|
||||||
cur))
|
cur)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
cur = this->file_entry_table[cur].next_sibling_index;
|
cur = this->file_entry_table[cur].next_sibling_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ signals:
|
|||||||
void ProgressUpdated(u64 total_size_imported, u64 current_size_imported, int eta);
|
void ProgressUpdated(u64 total_size_imported, u64 current_size_imported, int eta);
|
||||||
|
|
||||||
/// Dumping of a content has been finished, go on to the next. Called at start as well.
|
/// Dumping of a content has been finished, go on to the next. Called at start as well.
|
||||||
void NextContent(u64 size_imported, u64 count, Core::ContentSpecifier next_content, int eta);
|
void NextContent(u64 size_imported, u64 count, const Core::ContentSpecifier& next_content,
|
||||||
|
int eta);
|
||||||
|
|
||||||
void Completed();
|
void Completed();
|
||||||
|
|
||||||
|
|||||||
@@ -601,20 +601,20 @@ void ImportDialog::RunMultiJob(MultiJob* job, std::size_t total_count, u64 total
|
|||||||
dialog->setWindowModality(Qt::WindowModal);
|
dialog->setWindowModality(Qt::WindowModal);
|
||||||
dialog->setMinimumDuration(0);
|
dialog->setMinimumDuration(0);
|
||||||
|
|
||||||
connect(
|
connect(job, &MultiJob::NextContent, this,
|
||||||
job, &MultiJob::NextContent, this,
|
[this, bar, dialog, multiplier, total_count](
|
||||||
[this, bar, dialog, multiplier, total_count](u64 size_imported, u64 count,
|
u64 size_imported, u64 count, const Core::ContentSpecifier& next_content, int eta) {
|
||||||
Core::ContentSpecifier next_content, int eta) {
|
bar->setValue(static_cast<int>(size_imported / multiplier));
|
||||||
bar->setValue(static_cast<int>(size_imported / multiplier));
|
dialog->setLabelText(
|
||||||
dialog->setLabelText(tr("<p>(%1/%2) %3 (%4)</p><p> </p><p align=\"right\">%5</p>")
|
tr("<p>(%1/%2) %3 (%4)</p><p> </p><p align=\"right\">%5</p>")
|
||||||
.arg(count)
|
.arg(count)
|
||||||
.arg(total_count)
|
.arg(total_count)
|
||||||
.arg(GetContentName(next_content))
|
.arg(GetContentName(next_content))
|
||||||
.arg(GetContentTypeName(next_content.type))
|
.arg(GetContentTypeName(next_content.type))
|
||||||
.arg(FormatETA(eta)));
|
.arg(FormatETA(eta)));
|
||||||
current_content = next_content;
|
current_content = next_content;
|
||||||
current_count = count;
|
current_count = count;
|
||||||
});
|
});
|
||||||
connect(job, &MultiJob::ProgressUpdated, this,
|
connect(job, &MultiJob::ProgressUpdated, this,
|
||||||
[this, bar, dialog, multiplier, total_count](u64 total_size_imported,
|
[this, bar, dialog, multiplier, total_count](u64 total_size_imported,
|
||||||
u64 current_size_imported, int eta) {
|
u64 current_size_imported, int eta) {
|
||||||
|
|||||||
Reference in New Issue
Block a user