From 76d8da3db213e06a19a5ed95f9c8c533f226098c Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 6 Jun 2022 00:21:13 +0200 Subject: [PATCH] Fix return bug CPackedStore::GetManifest() did not return a value in all control paths. Use proper size types for entry block constructor. --- r5dev/vpklib/packedstore.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/r5dev/vpklib/packedstore.cpp b/r5dev/vpklib/packedstore.cpp index 47f3611d..310d09f7 100644 --- a/r5dev/vpklib/packedstore.cpp +++ b/r5dev/vpklib/packedstore.cpp @@ -220,10 +220,10 @@ nlohmann::json CPackedStore::GetManifest(const string& svWorkSpace, const string ostringstream ostream; ostream << svWorkSpace << "manifest/" << svManifestName << ".json"; fs::path fsPath = fs::current_path() /= ostream.str(); + nlohmann::json jsOut; if (fs::exists(fsPath)) { - nlohmann::json jsOut; try { ifstream iManifest(fsPath.string().c_str(), std::ios::binary); @@ -237,6 +237,7 @@ nlohmann::json CPackedStore::GetManifest(const string& svWorkSpace, const string return jsOut; } } + return jsOut; } //----------------------------------------------------------------------------- @@ -621,13 +622,13 @@ VPKEntryBlock_t::VPKEntryBlock_t(const vector &vData, int64_t nOffset, m_iArchiveIndex = nArchiveIndex; m_svBlockPath = svBlockPath; - int nEntryCount = (vData.size() + ENTRY_MAX_LEN - 1) / ENTRY_MAX_LEN; - uint64_t nDataSize = vData.size(); + size_t nEntryCount = (vData.size() + ENTRY_MAX_LEN - 1) / ENTRY_MAX_LEN; + size_t nDataSize = vData.size(); int64_t nCurrentOffset = nOffset; for (int i = 0; i < nEntryCount; i++) { - uint64_t nSize = std::min(ENTRY_MAX_LEN, nDataSize); + size_t nSize = std::min(ENTRY_MAX_LEN, nDataSize); nDataSize -= nSize; m_vvEntries.push_back(VPKEntryDescriptor_t(nEntryFlags, nTextureFlags, nCurrentOffset, nSize, nSize)); nCurrentOffset += nSize;