Merge pull request #33 from jakcron/npdm-development

[nx] Silence warnings.
This commit is contained in:
Jack 2018-07-10 23:23:55 +08:00 committed by GitHub
commit ca13bbd24b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View file

@ -48,11 +48,11 @@ void nx::AccessControlInfoBinary::toBytes()
uint32_t offset, size; uint32_t offset, size;
} fac, sac, kc; } fac, sac, kc;
fac.offset = align(sizeof(sAciHeader), aci::kSectionAlignSize); fac.offset = (uint32_t)align(sizeof(sAciHeader), aci::kSectionAlignSize);
fac.size = (uint32_t)mFileSystemAccessControl.getBytes().size(); fac.size = (uint32_t)mFileSystemAccessControl.getBytes().size();
sac.offset = align(fac.offset + fac.size, aci::kSectionAlignSize); sac.offset = (uint32_t)align(fac.offset + fac.size, aci::kSectionAlignSize);
sac.size = (uint32_t)mServiceAccessControl.getBytes().size(); sac.size = (uint32_t)mServiceAccessControl.getBytes().size();
kc.offset = align(sac.offset + sac.size, aci::kSectionAlignSize); kc.offset = (uint32_t)align(sac.offset + sac.size, aci::kSectionAlignSize);
kc.size = (uint32_t)mKernelCapabilities.getBytes().size(); kc.size = (uint32_t)mKernelCapabilities.getBytes().size();
// get total size // get total size

View file

@ -52,11 +52,11 @@ void nx::AccessControlInfoDescBinary::toBytes()
uint32_t offset, size; uint32_t offset, size;
} fac, sac, kc; } fac, sac, kc;
fac.offset = align(sizeof(sAciDescHeader), aci::kSectionAlignSize); fac.offset = (uint32_t)align(sizeof(sAciDescHeader), aci::kSectionAlignSize);
fac.size = (uint32_t)mFileSystemAccessControl.getBytes().size(); fac.size = (uint32_t)mFileSystemAccessControl.getBytes().size();
sac.offset = align(fac.offset + fac.size, aci::kSectionAlignSize); sac.offset = (uint32_t)align(fac.offset + fac.size, aci::kSectionAlignSize);
sac.size = (uint32_t)mServiceAccessControl.getBytes().size(); sac.size = (uint32_t)mServiceAccessControl.getBytes().size();
kc.offset = align(sac.offset + sac.size, aci::kSectionAlignSize); kc.offset = (uint32_t)align(sac.offset + sac.size, aci::kSectionAlignSize);
kc.size = (uint32_t)mKernelCapabilities.getBytes().size(); kc.size = (uint32_t)mKernelCapabilities.getBytes().size();
// get total size // get total size
@ -72,7 +72,7 @@ void nx::AccessControlInfoDescBinary::toBytes()
hdr->st_magic = aci::kAciDescStructMagic; hdr->st_magic = aci::kAciDescStructMagic;
// set "acid size" // set "acid size"
hdr->signed_size = total_size - crypto::rsa::kRsa2048Size; hdr->signed_size = (uint32_t)(total_size - crypto::rsa::kRsa2048Size);
// set flags // set flags
uint32_t flags = 0; uint32_t flags = 0;

View file

@ -41,9 +41,9 @@ void nx::FileSystemAccessControlBinary::toBytes()
uint32_t offset, size; uint32_t offset, size;
} content, savedata; } content, savedata;
content.offset = align(sizeof(sFacHeader), fac::kSectionAlignSize); content.offset = (uint32_t)align(sizeof(sFacHeader), fac::kSectionAlignSize);
content.size = (uint32_t)(sizeof(uint32_t) + mContentOwnerIdList.size() * sizeof(uint64_t)); content.size = (uint32_t)(sizeof(uint32_t) + mContentOwnerIdList.size() * sizeof(uint64_t));
savedata.offset = content.offset + (content.size > 0 ? align(content.size, fac::kSectionAlignSize) : 0); savedata.offset = (uint32_t)(content.offset + (content.size > 0 ? align(content.size, fac::kSectionAlignSize) : 0));
savedata.size = (uint32_t)(sizeof(uint32_t) + align(mSaveDataOwnerIdList.size(), fac::kSectionAlignSize) + mSaveDataOwnerIdList.size() * sizeof(uint64_t)); savedata.size = (uint32_t)(sizeof(uint32_t) + align(mSaveDataOwnerIdList.size(), fac::kSectionAlignSize) + mSaveDataOwnerIdList.size() * sizeof(uint64_t));
// get total size // get total size
@ -74,7 +74,7 @@ void nx::FileSystemAccessControlBinary::toBytes()
// set ids // set ids
le_uint32_t* content_owner_id_num = (le_uint32_t*)(mRawBinary.data() + content.offset); le_uint32_t* content_owner_id_num = (le_uint32_t*)(mRawBinary.data() + content.offset);
le_uint64_t* content_owner_ids = (le_uint64_t*)(mRawBinary.data() + content.offset + sizeof(uint32_t)); le_uint64_t* content_owner_ids = (le_uint64_t*)(mRawBinary.data() + content.offset + sizeof(uint32_t));
content_owner_id_num->set(mContentOwnerIdList.size()); content_owner_id_num->set((uint32_t)mContentOwnerIdList.size());
for (size_t i = 0; i < mContentOwnerIdList.size(); i++) for (size_t i = 0; i < mContentOwnerIdList.size(); i++)
{ {
content_owner_ids[i] = mContentOwnerIdList[i]; content_owner_ids[i] = mContentOwnerIdList[i];
@ -83,7 +83,7 @@ void nx::FileSystemAccessControlBinary::toBytes()
le_uint32_t* save_data_owner_id_num = (le_uint32_t*)(mRawBinary.data() + savedata.offset); le_uint32_t* save_data_owner_id_num = (le_uint32_t*)(mRawBinary.data() + savedata.offset);
byte_t* save_data_owner_id_accessibility_array = (mRawBinary.data() + savedata.offset + sizeof(uint32_t)); byte_t* save_data_owner_id_accessibility_array = (mRawBinary.data() + savedata.offset + sizeof(uint32_t));
le_uint64_t* save_data_owner_ids = (le_uint64_t*)(mRawBinary.data() + savedata.offset + sizeof(uint32_t) + align(mSaveDataOwnerIdList.size(), sizeof(uint32_t))); le_uint64_t* save_data_owner_ids = (le_uint64_t*)(mRawBinary.data() + savedata.offset + sizeof(uint32_t) + align(mSaveDataOwnerIdList.size(), sizeof(uint32_t)));
save_data_owner_id_num->set(mSaveDataOwnerIdList.size()); save_data_owner_id_num->set((uint32_t)mSaveDataOwnerIdList.size());
for (size_t i = 0; i < mSaveDataOwnerIdList.size(); i++) for (size_t i = 0; i < mSaveDataOwnerIdList.size(); i++)
{ {
save_data_owner_id_accessibility_array[i] = mSaveDataOwnerIdList[i].access_type; save_data_owner_id_accessibility_array[i] = mSaveDataOwnerIdList[i].access_type;

View file

@ -63,7 +63,7 @@ void nx::NpdmBinary::toBytes()
acid.offset = (uint32_t)align(sizeof(sNpdmHeader), npdm::kSectionAlignSize); acid.offset = (uint32_t)align(sizeof(sNpdmHeader), npdm::kSectionAlignSize);
acid.size = (uint32_t)mAcid.getBytes().size(); acid.size = (uint32_t)mAcid.getBytes().size();
aci.offset = (uint32_t)acid.offset + align(acid.size, npdm::kSectionAlignSize); aci.offset = (uint32_t)(acid.offset + align(acid.size, npdm::kSectionAlignSize));
aci.size = (uint32_t)mAci.getBytes().size(); aci.size = (uint32_t)mAci.getBytes().size();