ncm_types: Address review

This commit is contained in:
Adubbz 2020-02-25 22:05:51 +11:00
parent 46b0d45aad
commit 3b731c9bf2

View File

@ -58,7 +58,7 @@ namespace ams::ncm {
char name[0x10]; char name[0x10];
}; };
struct PlaceHolderId { alignas(8) struct PlaceHolderId {
util::Uuid uuid; util::Uuid uuid;
bool operator==(const PlaceHolderId& other) const { bool operator==(const PlaceHolderId& other) const {
@ -76,11 +76,11 @@ namespace ams::ncm {
bool operator!=(const util::Uuid& other) const { bool operator!=(const util::Uuid& other) const {
return this->uuid != other; return this->uuid != other;
} }
} __attribute__((aligned(8))); };
static_assert(__alignof__(PlaceHolderId) == 8, "PlaceHolderId definition!"); static_assert(alignof(PlaceHolderId) == 8, "PlaceHolderId definition!");
struct ContentId { alignas(4) struct ContentId {
util::Uuid uuid; util::Uuid uuid;
bool operator==(const ContentId& other) const { bool operator==(const ContentId& other) const {
@ -98,12 +98,12 @@ namespace ams::ncm {
bool operator!=(const util::Uuid& other) const { bool operator!=(const util::Uuid& other) const {
return this->uuid != other; return this->uuid != other;
} }
} __attribute__((aligned(4))); };
static_assert(__alignof__(ContentId) == 4, "ContentId definition!"); static_assert(alignof(ContentId) == 4, "ContentId definition!");
static constexpr PlaceHolderId InvalidPlaceHolderId = { util::InvalidUuid }; constexpr inline PlaceHolderId InvalidPlaceHolderId = { util::InvalidUuid };
static constexpr ContentId InvalidContentId = { util::InvalidUuid }; constexpr inline ContentId InvalidContentId = { util::InvalidUuid };
struct ContentInfo { struct ContentInfo {
ContentId content_id; ContentId content_id;
@ -114,8 +114,8 @@ namespace ams::ncm {
static_assert(sizeof(ContentInfo) == 0x18, "ContentInfo definition!"); static_assert(sizeof(ContentInfo) == 0x18, "ContentInfo definition!");
typedef void (*MakeContentPathFunc)(char* out, ContentId content_id, const char* root); using MakeContentPathFunc = void (*)(char* out, ContentId content_id, const char* root);
typedef void (*MakePlaceHolderPathFunc)(char* out, PlaceHolderId placeholder_id, const char* root); using MakePlaceHolderPathFunc = void (*)(char* out, PlaceHolderId placeholder_id, const char* root);
/* Storage IDs. */ /* Storage IDs. */
enum class StorageId : u8 { enum class StorageId : u8 {
@ -594,7 +594,7 @@ namespace ams::ncm {
static_assert(sizeof(ContentMetaKey) == 0x10, "ContentMetaKey definition!"); static_assert(sizeof(ContentMetaKey) == 0x10, "ContentMetaKey definition!");
/* Used by system updates. They share the exact same struct as ContentMetaKey */ /* Used by system updates. They share the exact same struct as ContentMetaKey */
typedef ContentMetaKey ContentMetaInfo; using ContentMetaInfo = ContentMetaKey;
struct ApplicationContentMetaKey { struct ApplicationContentMetaKey {
ContentMetaKey key; ContentMetaKey key;