strat: build sysmodules with -Wextra/-Werror

This commit is contained in:
Michael Scire
2021-10-06 23:22:54 -07:00
parent e8f1efd01b
commit 6a53726833
61 changed files with 433 additions and 217 deletions

View File

@@ -99,7 +99,7 @@ namespace ams::mitm::fs {
return sf::CreateSharedObjectEmplaced<ams::fssrv::sf::IStorage, ams::fssrv::impl::StorageInterfaceAdapter>(std::forward<Arguments>(args)...);
}
Result OpenHblWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId client_program_id, ncm::ProgramId program_id, FsFileSystemType filesystem_type) {
Result OpenHblWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId program_id) {
/* Verify eligibility. */
bool is_hbl;
R_UNLESS(R_SUCCEEDED(pm::info::IsHblProgramId(&is_hbl, program_id)), sm::mitm::ResultShouldForwardToSession());
@@ -122,7 +122,7 @@ namespace ams::mitm::fs {
return ResultSuccess();
}
Result OpenProgramSpecificWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId client_program_id, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id) {
Result OpenProgramSpecificWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id) {
/* Directory must exist. */
{
FsDir d;
@@ -174,13 +174,13 @@ namespace ams::mitm::fs {
R_UNLESS(filesystem_type == FsFileSystemType_ContentManual, sm::mitm::ResultShouldForwardToSession());
/* Try to mount the HBL web filesystem. If this succeeds then we're done. */
R_UNLESS(R_FAILED(OpenHblWebContentFileSystem(out, client_program_id, program_id, filesystem_type)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(OpenHblWebContentFileSystem(out, program_id)));
/* If program specific override shouldn't be attempted, fall back. */
R_UNLESS(try_program_specific, sm::mitm::ResultShouldForwardToSession());
/* If we're not opening a HBL filesystem, just try to open a generic one. */
return OpenProgramSpecificWebContentFileSystem(out, client_program_id, program_id, filesystem_type, fwd, path, with_id);
return OpenProgramSpecificWebContentFileSystem(out, program_id, filesystem_type, fwd, path, with_id);
}
}

View File

@@ -28,7 +28,7 @@ namespace ams::mitm::fs {
os::MessageQueue g_req_mq(g_mq_storage + 0, 1);
os::MessageQueue g_ack_mq(g_mq_storage + 1, 1);
void RomfsInitializerThreadFunction(void *arg) {
void RomfsInitializerThreadFunction(void *) {
while (true) {
uintptr_t storage_uptr = 0;
g_req_mq.Receive(&storage_uptr);
@@ -100,7 +100,6 @@ namespace ams::mitm::fs {
Result LayeredRomfsStorage::Read(s64 offset, void *buffer, size_t size) {
/* Check if we can succeed immediately. */
R_UNLESS(size >= 0, fs::ResultInvalidSize());
R_SUCCEED_IF(size == 0);
/* Ensure we're initialized. */
@@ -112,8 +111,8 @@ namespace ams::mitm::fs {
const s64 virt_size = this->GetSize();
R_UNLESS(offset >= 0, fs::ResultInvalidOffset());
R_UNLESS(offset < virt_size, fs::ResultInvalidOffset());
if (size_t(virt_size - offset) < size) {
size = size_t(virt_size - offset);
if (static_cast<size_t>(virt_size - offset) < size) {
size = static_cast<size_t>(virt_size - offset);
}
/* Find first source info via binary search. */
@@ -130,7 +129,7 @@ namespace ams::mitm::fs {
if (offset < cur_source.virtual_offset + cur_source.size) {
const s64 offset_within_source = offset - cur_source.virtual_offset;
const size_t cur_read_size = std::min(size - read_so_far, size_t(cur_source.size - offset_within_source));
const size_t cur_read_size = std::min(size - read_so_far, static_cast<size_t>(cur_source.size - offset_within_source));
switch (cur_source.source_type) {
case romfs::DataSourceType::Storage:
R_ABORT_UNLESS(this->storage_romfs->Read(cur_source.storage_source_info.offset + offset_within_source, cur_dst, cur_read_size));
@@ -167,7 +166,7 @@ namespace ams::mitm::fs {
} else {
/* Explicitly handle padding. */
const auto &next_source = *(++it);
const size_t padding_size = size_t(next_source.virtual_offset - offset);
const size_t padding_size = static_cast<size_t>(next_source.virtual_offset - offset);
std::memset(cur_dst, 0, padding_size);
read_so_far += padding_size;
@@ -194,6 +193,8 @@ namespace ams::mitm::fs {
}
Result LayeredRomfsStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
AMS_UNUSED(offset, src, src_size);
switch (op_id) {
case OperationId::Invalidate:
case OperationId::QueryRange:

View File

@@ -52,11 +52,13 @@ namespace ams::mitm::fs {
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
/* TODO: Better result code? */
AMS_UNUSED(offset, buffer, size);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result SetSize(s64 size) override {
/* TODO: Better result code? */
AMS_UNUSED(size);
return ams::fs::ResultUnsupportedOperation();
}
};

View File

@@ -64,7 +64,7 @@ namespace ams::mitm::fs {
os::ThreadType g_extra_threads[NumExtraThreads];
void LoopServerThread(void *arg) {
void LoopServerThread(void *) {
/* Loop forever, servicing our services. */
g_server_manager.LoopProcess();
}
@@ -98,7 +98,7 @@ namespace ams::mitm::fs {
}
void MitmModule::ThreadFunction(void *arg) {
void MitmModule::ThreadFunction(void *) {
/* Create fs mitm. */
R_ABORT_UNLESS((g_server_manager.RegisterMitmServer<FsMitmService>(PortIndex_Mitm, MitmServiceName)));

View File

@@ -28,45 +28,52 @@ namespace ams::mitm::fs {
virtual ~ReadOnlyLayeredFileSystem() { /* ... */ }
private:
virtual Result DoCreateFile(const char *path, s64 size, int flags) override final {
AMS_UNUSED(path, size, flags);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoDeleteFile(const char *path) override final {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoCreateDirectory(const char *path) override final {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoDeleteDirectory(const char *path) override final {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoDeleteDirectoryRecursively(const char *path) override final {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoRenameFile(const char *old_path, const char *new_path) override final {
AMS_UNUSED(old_path, new_path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override final {
AMS_UNUSED(old_path, new_path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoGetEntryType(ams::fs::DirectoryEntryType *out, const char *path) override final {
R_UNLESS(R_FAILED(this->fs_1.GetEntryType(out, path)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(this->fs_1.GetEntryType(out, path)));
return this->fs_2.GetEntryType(out, path);
}
virtual Result DoOpenFile(std::unique_ptr<ams::fs::fsa::IFile> *out_file, const char *path, ams::fs::OpenMode mode) override final {
R_UNLESS(R_FAILED(this->fs_1.OpenFile(out_file, path, mode)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(this->fs_1.OpenFile(out_file, path, mode)));
return this->fs_2.OpenFile(out_file, path, mode);
}
virtual Result DoOpenDirectory(std::unique_ptr<ams::fs::fsa::IDirectory> *out_dir, const char *path, ams::fs::OpenDirectoryMode mode) override final {
R_UNLESS(R_FAILED(this->fs_1.OpenDirectory(out_dir, path, mode)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(this->fs_1.OpenDirectory(out_dir, path, mode)));
return this->fs_2.OpenDirectory(out_dir, path, mode);
}
@@ -75,19 +82,22 @@ namespace ams::mitm::fs {
}
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) {
AMS_UNUSED(out, path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) {
AMS_UNUSED(out, path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoCleanDirectoryRecursively(const char *path) {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoGetFileTimeStampRaw(ams::fs::FileTimeStampRaw *out, const char *path) {
R_UNLESS(R_FAILED(this->fs_1.GetFileTimeStampRaw(out, path)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(this->fs_1.GetFileTimeStampRaw(out, path)));
return this->fs_2.GetFileTimeStampRaw(out, path);
}
};