mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
nca-pr: update for c++20
This commit is contained in:
parent
311d2678c7
commit
53a47e07fd
14 changed files with 36 additions and 36 deletions
|
@ -50,7 +50,7 @@ namespace ams::fs {
|
||||||
std::unique_ptr<ArrayT, Deleter> MakeUnique(size_t size) {
|
std::unique_ptr<ArrayT, Deleter> MakeUnique(size_t size) {
|
||||||
using T = typename std::remove_extent<ArrayT>::type;
|
using T = typename std::remove_extent<ArrayT>::type;
|
||||||
|
|
||||||
static_assert(std::is_pod<ArrayT>::value);
|
static_assert(util::is_pod<ArrayT>::value);
|
||||||
static_assert(std::is_array<ArrayT>::value);
|
static_assert(std::is_array<ArrayT>::value);
|
||||||
|
|
||||||
const size_t alloc_size = sizeof(T) * size;
|
const size_t alloc_size = sizeof(T) * size;
|
||||||
|
|
|
@ -161,7 +161,7 @@ namespace ams::fs {
|
||||||
|
|
||||||
u8 value[Size];
|
u8 value[Size];
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<HashSalt>::value);
|
static_assert(util::is_pod<HashSalt>::value);
|
||||||
static_assert(sizeof(HashSalt) == HashSalt::Size);
|
static_assert(sizeof(HashSalt) == HashSalt::Size);
|
||||||
|
|
||||||
using SaveDataHashSalt = std::optional<HashSalt>;
|
using SaveDataHashSalt = std::optional<HashSalt>;
|
||||||
|
|
|
@ -73,6 +73,6 @@ namespace ams::fssrv::fscreator {
|
||||||
IStorageOnNcaCreator *storage_on_nca_creator;
|
IStorageOnNcaCreator *storage_on_nca_creator;
|
||||||
/* TODO: More creators. */
|
/* TODO: More creators. */
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<FileSystemCreatorInterfaces>::value);
|
static_assert(util::is_pod<FileSystemCreatorInterfaces>::value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace ams::fssystem {
|
||||||
};
|
};
|
||||||
static_assert(sizeof(Entry) == 0x10);
|
static_assert(sizeof(Entry) == 0x10);
|
||||||
static_assert(alignof(Entry) == 4);
|
static_assert(alignof(Entry) == 4);
|
||||||
static_assert(std::is_pod<Entry>::value);
|
static_assert(util::is_pod<Entry>::value);
|
||||||
public:
|
public:
|
||||||
static constexpr s64 QueryHeaderStorageSize() {
|
static constexpr s64 QueryHeaderStorageSize() {
|
||||||
return BucketTree::QueryHeaderStorageSize();
|
return BucketTree::QueryHeaderStorageSize();
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace ams::fssystem {
|
||||||
void Format(s32 entry_count);
|
void Format(s32 entry_count);
|
||||||
Result Verify() const;
|
Result Verify() const;
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<Header>::value);
|
static_assert(util::is_pod<Header>::value);
|
||||||
static_assert(sizeof(Header) == 0x10);
|
static_assert(sizeof(Header) == 0x10);
|
||||||
|
|
||||||
struct NodeHeader {
|
struct NodeHeader {
|
||||||
|
@ -50,7 +50,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
Result Verify(s32 node_index, size_t node_size, size_t entry_size) const;
|
Result Verify(s32 node_index, size_t node_size, size_t entry_size) const;
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<NodeHeader>::value);
|
static_assert(util::is_pod<NodeHeader>::value);
|
||||||
static_assert(sizeof(NodeHeader) == 0x10);
|
static_assert(sizeof(NodeHeader) == 0x10);
|
||||||
|
|
||||||
class ContinuousReadingInfo {
|
class ContinuousReadingInfo {
|
||||||
|
@ -140,7 +140,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T *Get() const {
|
T *Get() const {
|
||||||
static_assert(std::is_pod<T>::value);
|
static_assert(util::is_pod<T>::value);
|
||||||
static_assert(sizeof(T) == sizeof(NodeHeader));
|
static_assert(sizeof(T) == sizeof(NodeHeader));
|
||||||
return reinterpret_cast<T *>(this->header);
|
return reinterpret_cast<T *>(this->header);
|
||||||
}
|
}
|
||||||
|
@ -278,9 +278,9 @@ namespace ams::fssystem {
|
||||||
s64 end;
|
s64 end;
|
||||||
s64 start;
|
s64 start;
|
||||||
} info;
|
} info;
|
||||||
static_assert(std::is_pod<Info>::value);
|
static_assert(util::is_pod<Info>::value);
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<EntrySetHeader>::value);
|
static_assert(util::is_pod<EntrySetHeader>::value);
|
||||||
private:
|
private:
|
||||||
const BucketTree *tree;
|
const BucketTree *tree;
|
||||||
void *entry;
|
void *entry;
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
template<typename EntryType>
|
template<typename EntryType>
|
||||||
Result BucketTree::ScanContinuousReading(ContinuousReadingInfo *out_info, const ContinuousReadingParam<EntryType> ¶m) const {
|
Result BucketTree::ScanContinuousReading(ContinuousReadingInfo *out_info, const ContinuousReadingParam<EntryType> ¶m) const {
|
||||||
static_assert(std::is_pod<ContinuousReadingParam<EntryType>>::value);
|
static_assert(util::is_pod<ContinuousReadingParam<EntryType>>::value);
|
||||||
|
|
||||||
/* Validate our preconditions. */
|
/* Validate our preconditions. */
|
||||||
AMS_ASSERT(this->IsInitialized());
|
AMS_ASSERT(this->IsInitialized());
|
||||||
|
@ -149,7 +149,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
template<typename EntryType>
|
template<typename EntryType>
|
||||||
Result BucketTree::Visitor::ScanContinuousReading(ContinuousReadingInfo *out_info, s64 offset, size_t size) const {
|
Result BucketTree::Visitor::ScanContinuousReading(ContinuousReadingInfo *out_info, s64 offset, size_t size) const {
|
||||||
static_assert(std::is_pod<EntryType>::value);
|
static_assert(util::is_pod<EntryType>::value);
|
||||||
AMS_ASSERT(this->IsValid());
|
AMS_ASSERT(this->IsValid());
|
||||||
|
|
||||||
/* Create our parameters. */
|
/* Create our parameters. */
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace ams::fssystem {
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<Entry>::value);
|
static_assert(util::is_pod<Entry>::value);
|
||||||
static_assert(sizeof(Entry) == 0x14);
|
static_assert(sizeof(Entry) == 0x14);
|
||||||
|
|
||||||
struct EntryData {
|
struct EntryData {
|
||||||
|
@ -67,7 +67,7 @@ namespace ams::fssystem {
|
||||||
this->storage_index = entry.storage_index;
|
this->storage_index = entry.storage_index;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<EntryData>::value);
|
static_assert(util::is_pod<EntryData>::value);
|
||||||
private:
|
private:
|
||||||
struct ContinuousReadingEntry {
|
struct ContinuousReadingEntry {
|
||||||
static constexpr size_t FragmentSizeMax = 4_KB;
|
static constexpr size_t FragmentSizeMax = 4_KB;
|
||||||
|
@ -86,7 +86,7 @@ namespace ams::fssystem {
|
||||||
return this->entry.storage_index != 0;
|
return this->entry.storage_index != 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<ContinuousReadingEntry>::value);
|
static_assert(util::is_pod<ContinuousReadingEntry>::value);
|
||||||
public:
|
public:
|
||||||
static constexpr s64 QueryHeaderStorageSize() {
|
static constexpr s64 QueryHeaderStorageSize() {
|
||||||
return BucketTree::QueryHeaderStorageSize();
|
return BucketTree::QueryHeaderStorageSize();
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace ams::fssystem {
|
||||||
DecryptAesCtrFunction decrypt_aes_ctr_external;
|
DecryptAesCtrFunction decrypt_aes_ctr_external;
|
||||||
bool is_plaintext_header_available;
|
bool is_plaintext_header_available;
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<NcaCryptoConfiguration>::value);
|
static_assert(util::is_pod<NcaCryptoConfiguration>::value);
|
||||||
|
|
||||||
constexpr inline bool IsInvalidKeyTypeValue(s32 key_type) {
|
constexpr inline bool IsInvalidKeyTypeValue(s32 key_type) {
|
||||||
return key_type < 0;
|
return key_type < 0;
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace ams::fssystem {
|
||||||
u8 value[Size];
|
u8 value[Size];
|
||||||
};
|
};
|
||||||
static_assert(sizeof(Hash) == Hash::Size);
|
static_assert(sizeof(Hash) == Hash::Size);
|
||||||
static_assert(std::is_pod<Hash>::value);
|
static_assert(util::is_pod<Hash>::value);
|
||||||
|
|
||||||
using NcaDigest = Hash;
|
using NcaDigest = Hash;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ namespace ams::fssystem {
|
||||||
u32 reserved;
|
u32 reserved;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(FsInfo) == 0x10);
|
static_assert(sizeof(FsInfo) == 0x10);
|
||||||
static_assert(std::is_pod<FsInfo>::value);
|
static_assert(util::is_pod<FsInfo>::value);
|
||||||
|
|
||||||
static constexpr u32 Magic0 = util::FourCC<'N','C','A','0'>::Code;
|
static constexpr u32 Magic0 = util::FourCC<'N','C','A','0'>::Code;
|
||||||
static constexpr u32 Magic1 = util::FourCC<'N','C','A','1'>::Code;
|
static constexpr u32 Magic1 = util::FourCC<'N','C','A','1'>::Code;
|
||||||
|
@ -124,7 +124,7 @@ namespace ams::fssystem {
|
||||||
u8 GetProperKeyGeneration() const;
|
u8 GetProperKeyGeneration() const;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(NcaHeader) == NcaHeader::Size);
|
static_assert(sizeof(NcaHeader) == NcaHeader::Size);
|
||||||
static_assert(std::is_pod<NcaHeader>::value);
|
static_assert(util::is_pod<NcaHeader>::value);
|
||||||
|
|
||||||
struct NcaBucketInfo {
|
struct NcaBucketInfo {
|
||||||
static constexpr size_t HeaderSize = 0x10;
|
static constexpr size_t HeaderSize = 0x10;
|
||||||
|
@ -132,7 +132,7 @@ namespace ams::fssystem {
|
||||||
s64 size;
|
s64 size;
|
||||||
u8 header[HeaderSize];
|
u8 header[HeaderSize];
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<NcaBucketInfo>::value);
|
static_assert(util::is_pod<NcaBucketInfo>::value);
|
||||||
|
|
||||||
struct NcaPatchInfo {
|
struct NcaPatchInfo {
|
||||||
static constexpr size_t Size = 0x40;
|
static constexpr size_t Size = 0x40;
|
||||||
|
@ -148,7 +148,7 @@ namespace ams::fssystem {
|
||||||
bool HasIndirectTable() const;
|
bool HasIndirectTable() const;
|
||||||
bool HasAesCtrExTable() const;
|
bool HasAesCtrExTable() const;
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<NcaPatchInfo>::value);
|
static_assert(util::is_pod<NcaPatchInfo>::value);
|
||||||
|
|
||||||
union NcaAesCtrUpperIv {
|
union NcaAesCtrUpperIv {
|
||||||
u64 value;
|
u64 value;
|
||||||
|
@ -157,7 +157,7 @@ namespace ams::fssystem {
|
||||||
u32 secure_value;
|
u32 secure_value;
|
||||||
} part;
|
} part;
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<NcaAesCtrUpperIv>::value);
|
static_assert(util::is_pod<NcaAesCtrUpperIv>::value);
|
||||||
|
|
||||||
struct NcaSparseInfo {
|
struct NcaSparseInfo {
|
||||||
NcaBucketInfo bucket;
|
NcaBucketInfo bucket;
|
||||||
|
@ -179,7 +179,7 @@ namespace ams::fssystem {
|
||||||
return sparse_upper_iv;
|
return sparse_upper_iv;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<NcaSparseInfo>::value);
|
static_assert(util::is_pod<NcaSparseInfo>::value);
|
||||||
|
|
||||||
struct NcaFsHeader {
|
struct NcaFsHeader {
|
||||||
static constexpr size_t Size = 0x200;
|
static constexpr size_t Size = 0x200;
|
||||||
|
@ -189,7 +189,7 @@ namespace ams::fssystem {
|
||||||
s64 offset;
|
s64 offset;
|
||||||
s64 size;
|
s64 size;
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<Region>::value);
|
static_assert(util::is_pod<Region>::value);
|
||||||
|
|
||||||
enum class FsType : u8 {
|
enum class FsType : u8 {
|
||||||
RomFs = 0,
|
RomFs = 0,
|
||||||
|
@ -221,7 +221,7 @@ namespace ams::fssystem {
|
||||||
s32 hash_layer_count;
|
s32 hash_layer_count;
|
||||||
Region hash_layer_region[HashLayerCountMax];
|
Region hash_layer_region[HashLayerCountMax];
|
||||||
} hierarchical_sha256_data;
|
} hierarchical_sha256_data;
|
||||||
static_assert(std::is_pod<HierarchicalSha256Data>::value);
|
static_assert(util::is_pod<HierarchicalSha256Data>::value);
|
||||||
|
|
||||||
struct IntegrityMetaInfo {
|
struct IntegrityMetaInfo {
|
||||||
static const size_t MasterHashOffset;
|
static const size_t MasterHashOffset;
|
||||||
|
@ -249,7 +249,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
Hash master_hash;
|
Hash master_hash;
|
||||||
} integrity_meta_info;
|
} integrity_meta_info;
|
||||||
static_assert(std::is_pod<IntegrityMetaInfo>::value);
|
static_assert(util::is_pod<IntegrityMetaInfo>::value);
|
||||||
|
|
||||||
u8 padding[NcaPatchInfo::Offset - HashDataOffset];
|
u8 padding[NcaPatchInfo::Offset - HashDataOffset];
|
||||||
};
|
};
|
||||||
|
@ -266,7 +266,7 @@ namespace ams::fssystem {
|
||||||
u8 pad[0x88];
|
u8 pad[0x88];
|
||||||
};
|
};
|
||||||
static_assert(sizeof(NcaFsHeader) == NcaFsHeader::Size);
|
static_assert(sizeof(NcaFsHeader) == NcaFsHeader::Size);
|
||||||
static_assert(std::is_pod<NcaFsHeader>::value);
|
static_assert(util::is_pod<NcaFsHeader>::value);
|
||||||
static_assert(offsetof(NcaFsHeader, patch_info) == NcaPatchInfo::Offset);
|
static_assert(offsetof(NcaFsHeader, patch_info) == NcaPatchInfo::Offset);
|
||||||
|
|
||||||
inline constexpr const size_t NcaFsHeader::HashData::HierarchicalSha256Data::MasterHashOffset = offsetof(NcaFsHeader, hash_data.hierarchical_sha256_data.fs_data_master_hash);
|
inline constexpr const size_t NcaFsHeader::HashData::HierarchicalSha256Data::MasterHashOffset = offsetof(NcaFsHeader, hash_data.hierarchical_sha256_data.fs_data_master_hash);
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ams::fssystem::save {
|
||||||
struct FileSystemBufferManagerSet {
|
struct FileSystemBufferManagerSet {
|
||||||
IBufferManager *buffers[IntegrityMaxLayerCount];
|
IBufferManager *buffers[IntegrityMaxLayerCount];
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<FileSystemBufferManagerSet>::value);
|
static_assert(util::is_pod<FileSystemBufferManagerSet>::value);
|
||||||
|
|
||||||
class BlockCacheBufferedStorage : public ::ams::fs::IStorage {
|
class BlockCacheBufferedStorage : public ::ams::fs::IStorage {
|
||||||
NON_COPYABLE(BlockCacheBufferedStorage);
|
NON_COPYABLE(BlockCacheBufferedStorage);
|
||||||
|
@ -54,7 +54,7 @@ namespace ams::fssystem::save {
|
||||||
uintptr_t memory_address;
|
uintptr_t memory_address;
|
||||||
size_t memory_size;
|
size_t memory_size;
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<CacheEntry>::value);
|
static_assert(util::is_pod<CacheEntry>::value);
|
||||||
|
|
||||||
enum Flag : s32 {
|
enum Flag : s32 {
|
||||||
Flag_KeepBurstMode = (1 << 8),
|
Flag_KeepBurstMode = (1 << 8),
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace ams::fssystem::save {
|
||||||
s32 block_order;
|
s32 block_order;
|
||||||
u8 reserved[4];
|
u8 reserved[4];
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<HierarchicalIntegrityVerificationLevelInformation>::value);
|
static_assert(util::is_pod<HierarchicalIntegrityVerificationLevelInformation>::value);
|
||||||
static_assert(sizeof(HierarchicalIntegrityVerificationLevelInformation) == 0x18);
|
static_assert(sizeof(HierarchicalIntegrityVerificationLevelInformation) == 0x18);
|
||||||
static_assert(alignof(HierarchicalIntegrityVerificationLevelInformation) == 0x4);
|
static_assert(alignof(HierarchicalIntegrityVerificationLevelInformation) == 0x4);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace ams::fssystem::save {
|
||||||
return this->info[this->max_layers - 2].size;
|
return this->info[this->max_layers - 2].size;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<HierarchicalIntegrityVerificationInformation>::value);
|
static_assert(util::is_pod<HierarchicalIntegrityVerificationInformation>::value);
|
||||||
|
|
||||||
struct HierarchicalIntegrityVerificationMetaInformation {
|
struct HierarchicalIntegrityVerificationMetaInformation {
|
||||||
u32 magic;
|
u32 magic;
|
||||||
|
@ -62,14 +62,14 @@ namespace ams::fssystem::save {
|
||||||
|
|
||||||
/* TODO: Format */
|
/* TODO: Format */
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<HierarchicalIntegrityVerificationMetaInformation>::value);
|
static_assert(util::is_pod<HierarchicalIntegrityVerificationMetaInformation>::value);
|
||||||
|
|
||||||
struct HierarchicalIntegrityVerificationSizeSet {
|
struct HierarchicalIntegrityVerificationSizeSet {
|
||||||
s64 control_size;
|
s64 control_size;
|
||||||
s64 master_hash_size;
|
s64 master_hash_size;
|
||||||
s64 layered_hash_sizes[IntegrityMaxLayerCount - 1];
|
s64 layered_hash_sizes[IntegrityMaxLayerCount - 1];
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<HierarchicalIntegrityVerificationSizeSet>::value);
|
static_assert(util::is_pod<HierarchicalIntegrityVerificationSizeSet>::value);
|
||||||
|
|
||||||
class HierarchicalIntegrityVerificationStorageControlArea {
|
class HierarchicalIntegrityVerificationStorageControlArea {
|
||||||
NON_COPYABLE(HierarchicalIntegrityVerificationStorageControlArea);
|
NON_COPYABLE(HierarchicalIntegrityVerificationStorageControlArea);
|
||||||
|
@ -80,7 +80,7 @@ namespace ams::fssystem::save {
|
||||||
struct InputParam {
|
struct InputParam {
|
||||||
size_t level_block_size[IntegrityMaxLayerCount - 1];
|
size_t level_block_size[IntegrityMaxLayerCount - 1];
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<InputParam>::value);
|
static_assert(util::is_pod<InputParam>::value);
|
||||||
private:
|
private:
|
||||||
fs::SubStorage storage;
|
fs::SubStorage storage;
|
||||||
HierarchicalIntegrityVerificationMetaInformation meta;
|
HierarchicalIntegrityVerificationMetaInformation meta;
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace ams::fssystem::save {
|
||||||
struct BlockHash {
|
struct BlockHash {
|
||||||
u8 hash[HashSize];
|
u8 hash[HashSize];
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<BlockHash>::value);
|
static_assert(util::is_pod<BlockHash>::value);
|
||||||
private:
|
private:
|
||||||
fs::SubStorage hash_storage;
|
fs::SubStorage hash_storage;
|
||||||
fs::SubStorage data_storage;
|
fs::SubStorage data_storage;
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace ams::fssystem {
|
||||||
|
|
||||||
using Node = impl::BucketTreeNode<const s64 *>;
|
using Node = impl::BucketTreeNode<const s64 *>;
|
||||||
static_assert(sizeof(Node) == sizeof(BucketTree::NodeHeader));
|
static_assert(sizeof(Node) == sizeof(BucketTree::NodeHeader));
|
||||||
static_assert(std::is_pod<Node>::value);
|
static_assert(util::is_pod<Node>::value);
|
||||||
|
|
||||||
constexpr inline s32 NodeHeaderSize = sizeof(BucketTree::NodeHeader);
|
constexpr inline s32 NodeHeaderSize = sizeof(BucketTree::NodeHeader);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace ams::fssystem::save {
|
||||||
void *buffer;
|
void *buffer;
|
||||||
size_t size;
|
size_t size;
|
||||||
};
|
};
|
||||||
static_assert(std::is_pod<FetchParameter>::value);
|
static_assert(util::is_pod<FetchParameter>::value);
|
||||||
private:
|
private:
|
||||||
BufferedStorage *buffered_storage;
|
BufferedStorage *buffered_storage;
|
||||||
std::pair<uintptr_t, size_t> memory_range;
|
std::pair<uintptr_t, size_t> memory_range;
|
||||||
|
|
Loading…
Reference in a new issue