From 67a00763b04ca5ed04b66437b25b67c3a3c525ae Mon Sep 17 00:00:00 2001 From: jakcron Date: Tue, 10 Jul 2018 23:23:05 +0800 Subject: [PATCH] [nx] Silence warnings. --- lib/libnx/source/AccessControlInfoBinary.cpp | 6 +++--- lib/libnx/source/AccessControlInfoDescBinary.cpp | 8 ++++---- lib/libnx/source/FileSystemAccessControlBinary.cpp | 8 ++++---- lib/libnx/source/NpdmBinary.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/libnx/source/AccessControlInfoBinary.cpp b/lib/libnx/source/AccessControlInfoBinary.cpp index 0abad1a..6c31f74 100644 --- a/lib/libnx/source/AccessControlInfoBinary.cpp +++ b/lib/libnx/source/AccessControlInfoBinary.cpp @@ -48,11 +48,11 @@ void nx::AccessControlInfoBinary::toBytes() uint32_t offset, size; } 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(); - 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(); - 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(); // get total size diff --git a/lib/libnx/source/AccessControlInfoDescBinary.cpp b/lib/libnx/source/AccessControlInfoDescBinary.cpp index 122d89c..a351f0b 100644 --- a/lib/libnx/source/AccessControlInfoDescBinary.cpp +++ b/lib/libnx/source/AccessControlInfoDescBinary.cpp @@ -52,11 +52,11 @@ void nx::AccessControlInfoDescBinary::toBytes() uint32_t offset, size; } 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(); - 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(); - 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(); // get total size @@ -72,7 +72,7 @@ void nx::AccessControlInfoDescBinary::toBytes() hdr->st_magic = aci::kAciDescStructMagic; // set "acid size" - hdr->signed_size = total_size - crypto::rsa::kRsa2048Size; + hdr->signed_size = (uint32_t)(total_size - crypto::rsa::kRsa2048Size); // set flags uint32_t flags = 0; diff --git a/lib/libnx/source/FileSystemAccessControlBinary.cpp b/lib/libnx/source/FileSystemAccessControlBinary.cpp index eb3a2ed..c2c4c94 100644 --- a/lib/libnx/source/FileSystemAccessControlBinary.cpp +++ b/lib/libnx/source/FileSystemAccessControlBinary.cpp @@ -41,9 +41,9 @@ void nx::FileSystemAccessControlBinary::toBytes() uint32_t offset, size; } 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)); - 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)); // get total size @@ -74,7 +74,7 @@ void nx::FileSystemAccessControlBinary::toBytes() // set ids 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)); - 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++) { 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); 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))); - 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++) { save_data_owner_id_accessibility_array[i] = mSaveDataOwnerIdList[i].access_type; diff --git a/lib/libnx/source/NpdmBinary.cpp b/lib/libnx/source/NpdmBinary.cpp index 0a2fbee..0d88e53 100644 --- a/lib/libnx/source/NpdmBinary.cpp +++ b/lib/libnx/source/NpdmBinary.cpp @@ -63,7 +63,7 @@ void nx::NpdmBinary::toBytes() acid.offset = (uint32_t)align(sizeof(sNpdmHeader), npdm::kSectionAlignSize); 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();