summaryrefslogtreecommitdiff
path: root/view/sharedcache/core
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-04-14 01:43:28 -0400
committerMason Reed <mason@vector35.com>2025-04-14 03:20:51 -0400
commitbf64859f5aa261fa8db7bfdd9af4f67826ff4e5b (patch)
treecc549d191d3b95fc48d9aa2d6316b70722a46759 /view/sharedcache/core
parentea47d4c85e78533ea7e88adc442159414feb3f7f (diff)
[SharedCache] Expose cache entry name in the API
Allows us to display the user friendly name of the cache entry in the triage view
Diffstat (limited to 'view/sharedcache/core')
-rw-r--r--view/sharedcache/core/ffi.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/view/sharedcache/core/ffi.cpp b/view/sharedcache/core/ffi.cpp
index e4e92acd..1ae561ae 100644
--- a/view/sharedcache/core/ffi.cpp
+++ b/view/sharedcache/core/ffi.cpp
@@ -134,6 +134,7 @@ BNSharedCacheEntry EntryToApi(const CacheEntry& entry)
{
BNSharedCacheEntry apiEntry;
apiEntry.path = BNAllocString(entry.GetFilePath().c_str());
+ apiEntry.name = BNAllocString(entry.GetFileName().c_str());
apiEntry.entryType = EntryTypeToApi(entry.GetType());
const auto& mappings = entry.GetMappings();
apiEntry.mappingCount = mappings.size();
@@ -408,15 +409,15 @@ extern "C"
const auto& entries = controller->object->GetCache().GetEntries();
*count = entries.size();
BNSharedCacheEntry* apiEntries = new BNSharedCacheEntry[*count];
- size_t idx = 0;
- for (const auto& [_, entry] : entries)
- apiEntries[idx++] = EntryToApi(entry);
+ for (size_t i = 0; i < *count; i++)
+ apiEntries[i] = EntryToApi(entries[i]);
return apiEntries;
}
void BNSharedCacheFreeEntry(BNSharedCacheEntry entry)
{
BNFreeString(entry.path);
+ BNFreeString(entry.name);
delete[] entry.mappings;
}