From bf64859f5aa261fa8db7bfdd9af4f67826ff4e5b Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 14 Apr 2025 01:43:28 -0400 Subject: [SharedCache] Expose cache entry name in the API Allows us to display the user friendly name of the cache entry in the triage view --- view/sharedcache/core/ffi.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'view/sharedcache/core/ffi.cpp') 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; } -- cgit v1.3.1