1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-23 04:12:02 +00:00

ncm: hot take, uninitialized data bad

This commit is contained in:
Michael Scire 2022-03-22 14:02:14 -07:00 committed by SciresM
parent dfcb5005d2
commit a89c5dd5d7
18 changed files with 36 additions and 36 deletions

View file

@ -25,7 +25,7 @@ namespace ams::lr {
private: private:
sf::SharedPointer<IAddOnContentLocationResolver> m_interface; sf::SharedPointer<IAddOnContentLocationResolver> m_interface;
public: public:
AddOnContentLocationResolver() { /* ... */ } AddOnContentLocationResolver() : m_interface(nullptr) { /* ... */ }
explicit AddOnContentLocationResolver(sf::SharedPointer<IAddOnContentLocationResolver> intf) : m_interface(intf) { /* ... */ } explicit AddOnContentLocationResolver(sf::SharedPointer<IAddOnContentLocationResolver> intf) : m_interface(intf) { /* ... */ }
AddOnContentLocationResolver(AddOnContentLocationResolver &&rhs) { AddOnContentLocationResolver(AddOnContentLocationResolver &&rhs) {

View file

@ -25,7 +25,7 @@ namespace ams::lr {
private: private:
sf::SharedPointer<ILocationResolver> m_interface; sf::SharedPointer<ILocationResolver> m_interface;
public: public:
LocationResolver() { /* ... */ } LocationResolver() : m_interface(nullptr) { /* ... */ }
explicit LocationResolver(sf::SharedPointer<ILocationResolver> intf) : m_interface(intf) { /* ... */ } explicit LocationResolver(sf::SharedPointer<ILocationResolver> intf) : m_interface(intf) { /* ... */ }
LocationResolver(LocationResolver &&rhs) { LocationResolver(LocationResolver &&rhs) {

View file

@ -25,7 +25,7 @@ namespace ams::lr {
private: private:
sf::SharedPointer<IRegisteredLocationResolver> m_interface; sf::SharedPointer<IRegisteredLocationResolver> m_interface;
public: public:
RegisteredLocationResolver() { /* ... */ } RegisteredLocationResolver() : m_interface(nullptr) { /* ... */ }
explicit RegisteredLocationResolver(sf::SharedPointer<IRegisteredLocationResolver> intf) : m_interface(intf) { /* ... */ } explicit RegisteredLocationResolver(sf::SharedPointer<IRegisteredLocationResolver> intf) : m_interface(intf) { /* ... */ }
RegisteredLocationResolver(RegisteredLocationResolver &&rhs) { RegisteredLocationResolver(RegisteredLocationResolver &&rhs) {

View file

@ -84,7 +84,7 @@ namespace ams::ncm {
fs::ContentStorageId content_storage_id; fs::ContentStorageId content_storage_id;
sf::SharedPointer<IContentStorage> content_storage; sf::SharedPointer<IContentStorage> content_storage;
ContentStorageRoot() { /* ... */ } ContentStorageRoot() : mount_name(), path(), storage_id(), content_storage_id(), content_storage() { /* ... */ }
}; };
struct ContentMetaDatabaseRoot { struct ContentMetaDatabaseRoot {
@ -100,7 +100,7 @@ namespace ams::ncm {
ContentMetaMemoryResource *memory_resource; ContentMetaMemoryResource *memory_resource;
u32 max_content_metas; u32 max_content_metas;
ContentMetaDatabaseRoot() { /* ... */ } ContentMetaDatabaseRoot() : mount_name(), path(), storage_id(), info(), content_meta_database(), kvs(util::nullopt), memory_resource(), max_content_metas() { /* ... */ }
}; };
private: private:
os::SdkRecursiveMutex m_mutex; os::SdkRecursiveMutex m_mutex;

View file

@ -28,7 +28,7 @@ namespace ams::ncm {
private: private:
sf::SharedPointer<IContentMetaDatabase> m_interface; sf::SharedPointer<IContentMetaDatabase> m_interface;
public: public:
ContentMetaDatabase() { /* ... */ } ContentMetaDatabase() : m_interface(nullptr) { /* ... */ }
explicit ContentMetaDatabase(sf::SharedPointer<IContentMetaDatabase> intf) : m_interface(intf) { /* ... */ } explicit ContentMetaDatabase(sf::SharedPointer<IContentMetaDatabase> intf) : m_interface(intf) { /* ... */ }
ContentMetaDatabase(ContentMetaDatabase &&rhs) { ContentMetaDatabase(ContentMetaDatabase &&rhs) {

View file

@ -23,7 +23,7 @@ namespace ams::ncm {
private: private:
sf::SharedPointer<IContentStorage> m_interface; sf::SharedPointer<IContentStorage> m_interface;
public: public:
ContentStorage() { /* ... */ } ContentStorage() : m_interface(nullptr) { /* ... */ }
explicit ContentStorage(sf::SharedPointer<IContentStorage> intf) : m_interface(intf) { /* ... */ } explicit ContentStorage(sf::SharedPointer<IContentStorage> intf) : m_interface(intf) { /* ... */ }
ContentStorage(ContentStorage &&rhs) { ContentStorage(ContentStorage &&rhs) {

View file

@ -82,18 +82,18 @@ namespace ams::ncm {
NON_COPYABLE(InstallTaskBase); NON_COPYABLE(InstallTaskBase);
NON_MOVEABLE(InstallTaskBase); NON_MOVEABLE(InstallTaskBase);
private: private:
crypto::Sha256Generator m_sha256_generator; crypto::Sha256Generator m_sha256_generator{};
StorageId m_install_storage; StorageId m_install_storage{};
InstallTaskDataBase *m_data; InstallTaskDataBase *m_data{};
InstallProgress m_progress; InstallProgress m_progress{};
os::SdkMutex m_progress_mutex; os::SdkMutex m_progress_mutex{};
u32 m_config; u32 m_config{};
os::SdkMutex m_cancel_mutex; os::SdkMutex m_cancel_mutex{};
bool m_cancel_requested; bool m_cancel_requested{};
InstallThroughput m_throughput; InstallThroughput m_throughput{};
TimeSpan m_throughput_start_time; TimeSpan m_throughput_start_time{};
os::SdkMutex m_throughput_mutex; os::SdkMutex m_throughput_mutex{};
FirmwareVariationId m_firmware_variation_id; FirmwareVariationId m_firmware_variation_id{};
private: private:
ALWAYS_INLINE Result SetLastResultOnFailure(Result result) { ALWAYS_INLINE Result SetLastResultOnFailure(Result result) {
if (R_FAILED(result)) { if (R_FAILED(result)) {

View file

@ -64,7 +64,7 @@ namespace ams::ncm {
Result m_last_result; Result m_last_result;
SystemUpdateTaskApplyInfo m_system_update_task_apply_info; SystemUpdateTaskApplyInfo m_system_update_task_apply_info;
public: public:
MemoryInstallTaskData() : m_state(InstallProgressState::NotPrepared), m_last_result(ResultSuccess()) { /* ... */ }; MemoryInstallTaskData() : m_data_list(), m_state(InstallProgressState::NotPrepared), m_last_result(ResultSuccess()), m_system_update_task_apply_info() { /* ... */ };
~MemoryInstallTaskData() { ~MemoryInstallTaskData() {
this->Cleanup(); this->Cleanup();
} }
@ -104,8 +104,8 @@ namespace ams::ncm {
static_assert(sizeof(EntryInfo) == 0x10); static_assert(sizeof(EntryInfo) == 0x10);
private: private:
Header m_header; Header m_header{};
char m_path[64]; char m_path[64]{};
private: private:
static constexpr Header MakeInitialHeader(s32 max_entries) { static constexpr Header MakeInitialHeader(s32 max_entries) {
return { return {

View file

@ -20,7 +20,7 @@ namespace ams::ncm {
class PackageInstallTask : public PackageInstallTaskBase { class PackageInstallTask : public PackageInstallTaskBase {
private: private:
MemoryInstallTaskData m_data; MemoryInstallTaskData m_data{};
public: public:
Result Initialize(const char *package_root, StorageId storage_id, void *buffer, size_t buffer_size, bool ignore_ticket); Result Initialize(const char *package_root, StorageId storage_id, void *buffer, size_t buffer_size, bool ignore_ticket);
protected: protected:

View file

@ -24,8 +24,8 @@ namespace ams::ncm {
using PackagePath = kvdb::BoundedString<256>; using PackagePath = kvdb::BoundedString<256>;
private: private:
PackagePath m_package_root; PackagePath m_package_root;
void *m_buffer; void *m_buffer{};
size_t m_buffer_size; size_t m_buffer_size{};
public: public:
PackageInstallTaskBase() : m_package_root() { /* ... */ } PackageInstallTaskBase() : m_package_root() { /* ... */ }

View file

@ -22,10 +22,10 @@ namespace ams::ncm {
private: private:
using PackagePath = kvdb::BoundedString<0x100>; using PackagePath = kvdb::BoundedString<0x100>;
private: private:
PackagePath m_context_path; PackagePath m_context_path{};
FileInstallTaskData m_data; FileInstallTaskData m_data{};
ContentMetaDatabase m_package_db; ContentMetaDatabase m_package_db{};
bool m_gamecard_content_meta_database_active; bool m_gamecard_content_meta_database_active{};
public: public:
~PackageSystemUpdateTask(); ~PackageSystemUpdateTask();

View file

@ -37,7 +37,7 @@ namespace ams::ncm {
u64 m_counter; u64 m_counter;
os::SdkMutex m_mutex; os::SdkMutex m_mutex;
public: public:
RightsIdCache() : m_mutex() { RightsIdCache() : m_entries(), m_counter(2), m_mutex() {
this->Invalidate(); this->Invalidate();
} }

View file

@ -27,7 +27,7 @@ namespace ams::lr {
ncm::ContentMetaDatabase m_content_meta_database; ncm::ContentMetaDatabase m_content_meta_database;
ncm::ContentStorage m_content_storage; ncm::ContentStorage m_content_storage;
public: public:
ContentLocationResolverImpl(ncm::StorageId storage_id) : m_storage_id(storage_id) { /* ... */ } ContentLocationResolverImpl(ncm::StorageId storage_id) : m_storage_id(storage_id), m_content_meta_database(), m_content_storage() { /* ... */ }
~ContentLocationResolverImpl(); ~ContentLocationResolverImpl();
private: private:

View file

@ -45,7 +45,7 @@ namespace ams::lr {
void ClearRedirections(u32 flags = RedirectionFlags_None); void ClearRedirections(u32 flags = RedirectionFlags_None);
Result RefreshImpl(const ncm::ProgramId *excluding_ids, size_t num_ids); Result RefreshImpl(const ncm::ProgramId *excluding_ids, size_t num_ids);
public: public:
RegisteredLocationResolverImpl() : m_registered_program_locations(GetMaxRegisteredLocations()), m_registered_html_docs_locations(GetMaxRegisteredLocations()) { /* ... */ } RegisteredLocationResolverImpl() : m_program_redirector(), m_registered_program_locations(GetMaxRegisteredLocations()), m_html_docs_redirector(), m_registered_html_docs_locations(GetMaxRegisteredLocations()) { /* ... */ }
~RegisteredLocationResolverImpl(); ~RegisteredLocationResolverImpl();
public: public:
/* Actual commands. */ /* Actual commands. */

View file

@ -28,7 +28,7 @@ namespace ams::ncm {
char m_mount_name[fs::MountNameLengthMax + 1]; char m_mount_name[fs::MountNameLengthMax + 1];
bool m_disabled; bool m_disabled;
protected: protected:
ContentMetaDatabaseImplBase(ContentMetaKeyValueStore *kvs) : m_kvs(kvs), m_disabled(false) { /* ... */ } ContentMetaDatabaseImplBase(ContentMetaKeyValueStore *kvs) : m_kvs(kvs), m_mount_name(), m_disabled(false) { /* ... */ }
ContentMetaDatabaseImplBase(ContentMetaKeyValueStore *kvs, const char *mount_name) : ContentMetaDatabaseImplBase(kvs) { ContentMetaDatabaseImplBase(ContentMetaKeyValueStore *kvs, const char *mount_name) : ContentMetaDatabaseImplBase(kvs) {
std::strcpy(m_mount_name, mount_name); std::strcpy(m_mount_name, mount_name);

View file

@ -26,7 +26,7 @@ namespace ams::ncm {
MakeContentPathFunction m_make_content_path_func; MakeContentPathFunction m_make_content_path_func;
bool m_disabled; bool m_disabled;
protected: protected:
ContentStorageImplBase() : m_make_content_path_func(), m_disabled(false) { /* ... */ } ContentStorageImplBase() : m_root_path(), m_make_content_path_func(), m_disabled(false) { /* ... */ }
protected: protected:
/* Helpers. */ /* Helpers. */
Result EnsureEnabled() const { Result EnsureEnabled() const {

View file

@ -42,7 +42,7 @@ namespace ams::ncm {
CacheEntry *FindInCache(PlaceHolderId placeholder_id); CacheEntry *FindInCache(PlaceHolderId placeholder_id);
CacheEntry *GetFreeEntry();; CacheEntry *GetFreeEntry();;
public: public:
PlaceHolderAccessor() : m_cur_counter(0), m_cache_mutex(), m_delay_flush(false) { PlaceHolderAccessor() : m_root_path(nullptr), m_cur_counter(0), m_cache_mutex(), m_make_placeholder_path_func(nullptr), m_delay_flush(false) {
for (size_t i = 0; i < MaxCacheEntries; i++) { for (size_t i = 0; i < MaxCacheEntries; i++) {
m_caches[i].id = InvalidPlaceHolderId; m_caches[i].id = InvalidPlaceHolderId;
} }

View file

@ -55,7 +55,7 @@ namespace ams::ncm {
} }
}; };
SubmissionPackageInstallTask::SubmissionPackageInstallTask() { /* ... */ } SubmissionPackageInstallTask::SubmissionPackageInstallTask() : m_impl(nullptr) { /* ... */ }
SubmissionPackageInstallTask::~SubmissionPackageInstallTask() { /* ... */ } SubmissionPackageInstallTask::~SubmissionPackageInstallTask() { /* ... */ }
Result SubmissionPackageInstallTask::Initialize(fs::FileHandle file, StorageId storage_id, void *buffer, size_t buffer_size, bool ignore_ticket) { Result SubmissionPackageInstallTask::Initialize(fs::FileHandle file, StorageId storage_id, void *buffer, size_t buffer_size, bool ignore_ticket) {