MCPcopy Create free account
hub / github.com/defold/defold / VerifyResourcesBundled

Function VerifyResourcesBundled

engine/resource/src/resource_verify.cpp:29–50  ·  view source on GitHub ↗

Should be private, but is used in unit tests as well

Source from the content-addressed store, hash-verified

27{
28 // Should be private, but is used in unit tests as well
29 dmResource::Result VerifyResourcesBundled(dmLiveUpdateDDF::ResourceEntry* entries, uint32_t num_entries, uint32_t hash_len, dmResourceArchive::HArchiveIndexContainer archive)
30 {
31 for(uint32_t i = 0; i < num_entries; ++i)
32 {
33 if (entries[i].m_Flags == dmLiveUpdateDDF::BUNDLED)
34 {
35 uint8_t* hash = entries[i].m_Hash.m_Data.m_Data;
36 dmResourceArchive::Result res = dmResourceArchive::FindEntry(archive, hash, hash_len, 0x0);
37 if (res == dmResourceArchive::RESULT_NOT_FOUND)
38 {
39 char hash_buffer[64*2+1]; // String repr. of project id SHA1 hash
40 dmResource::BytesToHexString(hash, hash_len, hash_buffer, sizeof(hash_buffer));
41
42 // Manifest expect the resource to be bundled, but it is not in the archive index.
43 dmLogError("Resource '%s' (%s) is expected to be in the bundle was not found.\nResource was modified between publishing the bundle and publishing the manifest?", entries[i].m_Url, hash_buffer);
44 return dmResource::RESULT_INVALID_DATA;
45 }
46 }
47 }
48
49 return dmResource::RESULT_OK;
50 }
51
52 dmResource::Result VerifyResourcesBundled(dmResourceArchive::HArchiveIndexContainer archive, const dmResource::HManifest manifest)
53 {

Callers 1

TEST_FFunction · 0.85

Calls 3

BytesToHexStringFunction · 0.85
HashLengthFunction · 0.85
FindEntryFunction · 0.70

Tested by 1

TEST_FFunction · 0.68