am: Resolve truncation and sign conversion warnings in WriteContentData() (#5397)

We can adjust the API to allow std::size_t indices, which simplifies
operating with standard container types. It also prevents truncation
warnings from occurring in these cases as well.
This commit is contained in:
LC
2020-06-20 14:09:56 -04:00
committed by GitHub
parent 353780e1c9
commit 902cc1eb49
6 changed files with 32 additions and 31 deletions

View File

@ -165,19 +165,19 @@ u32 TitleMetadata::GetDLPContentID() const {
return tmd_chunks[TMDContentIndex::DLP].id;
}
u32 TitleMetadata::GetContentIDByIndex(u16 index) const {
u32 TitleMetadata::GetContentIDByIndex(std::size_t index) const {
return tmd_chunks[index].id;
}
u16 TitleMetadata::GetContentTypeByIndex(u16 index) const {
u16 TitleMetadata::GetContentTypeByIndex(std::size_t index) const {
return tmd_chunks[index].type;
}
u64 TitleMetadata::GetContentSizeByIndex(u16 index) const {
u64 TitleMetadata::GetContentSizeByIndex(std::size_t index) const {
return tmd_chunks[index].size;
}
std::array<u8, 16> TitleMetadata::GetContentCTRByIndex(u16 index) const {
std::array<u8, 16> TitleMetadata::GetContentCTRByIndex(std::size_t index) const {
std::array<u8, 16> ctr{};
std::memcpy(ctr.data(), &tmd_chunks[index].index, sizeof(u16));
return ctr;