Skip to content

Commit 38084b2

Browse files
committed
Changed type name to new entry type
1 parent 7709a8c commit 38084b2

File tree

9 files changed

+15
-18
lines changed

9 files changed

+15
-18
lines changed

include/nbl/system/CFileArchive.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ class CFileArchive : public IFileArchive
7676
public:
7777
inline core::smart_refctd_ptr<IFile> getFile(const path& pathRelativeToArchive, const std::string_view& password) override
7878
{
79-
std::unique_lock lock(itemMutex);
80-
8179
const auto* item = getItemFromPath(pathRelativeToArchive);
8280
if (!item)
8381
return nullptr;
@@ -127,7 +125,7 @@ class CFileArchive : public IFileArchive
127125
}
128126

129127
template<class Allocator>
130-
inline core::smart_refctd_ptr<CInnerArchiveFile<Allocator>> getFile_impl(const IFileArchive::SListEntry* item)
128+
inline core::smart_refctd_ptr<CInnerArchiveFile<Allocator>> getFile_impl(const IFileArchive::SFileList::SEntry* item)
131129
{
132130
auto* file = reinterpret_cast<CInnerArchiveFile<Allocator>*>(m_filesBuffer+item->ID*SIZEOF_INNER_ARCHIVE_FILE);
133131
// NOTE: Intentionally calling grab() on maybe-not-existing object!
@@ -160,7 +158,7 @@ class CFileArchive : public IFileArchive
160158
size_t size;
161159
void* allocatorState;
162160
};
163-
virtual file_buffer_t getFileBuffer(const IFileArchive::SListEntry* item) = 0;
161+
virtual file_buffer_t getFileBuffer(const IFileArchive::SFileList::SEntry* item) = 0;
164162

165163
std::atomic_flag* m_fileFlags = nullptr;
166164
std::byte* m_filesBuffer = nullptr;

include/nbl/system/IFileArchive.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ class IFileArchive : public core::IReferenceCounted
112112
return &(*found);
113113
}
114114

115-
mutable std::mutex itemMutex; // TODO: update to readers writer lock
116115
path m_defaultAbsolutePath;
117116
// files and directories
118117
mutable std::atomic<SFileList::refctd_storage_t> m_items;

src/nbl/system/CAPKResourcesArchive.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CAPKResourcesArchive::CAPKResourcesArchive(const path& _path, system::logger_opt
1212
{
1313
}
1414

15-
core::vector<IFileArchive::SListEntry> CAPKResourcesArchive::computeItems(const std::string& asset_path, ANativeActivity* activity, JNIEnv* jniEnv)
15+
core::vector<IFileArchive::SFileList::SEntry> CAPKResourcesArchive::computeItems(const std::string& asset_path, ANativeActivity* activity, JNIEnv* jniEnv)
1616
{
1717
auto context_object = activity->clazz;
1818
auto getAssets_method = jniEnv->GetMethodID(jniEnv->GetObjectClass(context_object), "getAssets", "()Landroid/content/res/AssetManager;");
@@ -27,7 +27,7 @@ core::vector<IFileArchive::SListEntry> CAPKResourcesArchive::computeItems(const
2727

2828
auto length = jniEnv->GetArrayLength(files_object);
2929

30-
core::vector<IFileArchive::SListEntry> result;
30+
core::vector<IFileArchive::SFileList::SEntry> result;
3131
for (decltype(length) i=0; i<length; i++)
3232
{
3333
jstring jstr = (jstring)jniEnv->GetObjectArrayElement(files_object,i);
@@ -54,7 +54,7 @@ core::vector<IFileArchive::SListEntry> CAPKResourcesArchive::computeItems(const
5454
return result;
5555
}
5656

57-
CFileArchive::file_buffer_t CAPKResourcesArchive::getFileBuffer(const IFileArchive::SListEntry* item)
57+
CFileArchive::file_buffer_t CAPKResourcesArchive::getFileBuffer(const IFileArchive::SFileList::SEntry* item)
5858
{
5959
AAsset* asset = AAssetManager_open(m_mgr,item->pathRelativeToArchive.string().c_str(),AASSET_MODE_BUFFER);
6060
return {const_cast<void*>(AAsset_getBuffer(asset)),static_cast<size_t>(AAsset_getLength(asset)),asset};

src/nbl/system/CAPKResourcesArchive.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CAPKResourcesArchive final : public CFileArchive
2222
protected:
2323
static core::vector<SListEntry> computeItems(const std::string& asset_path, ANativeActivity* activity, JNIEnv* jniEnv);
2424

25-
file_buffer_t getFileBuffer(const IFileArchive::SListEntry* item) override;
25+
file_buffer_t getFileBuffer(const IFileArchive::SFileList::SEntry* item) override;
2626

2727

2828
AAssetManager* m_mgr;

src/nbl/system/CArchiveLoaderTar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct STarHeader
4141
using namespace nbl;
4242
using namespace nbl::system;
4343

44-
CFileArchive::file_buffer_t CArchiveLoaderTar::CArchive::getFileBuffer(const IFileArchive::SListEntry* item)
44+
CFileArchive::file_buffer_t CArchiveLoaderTar::CArchive::getFileBuffer(const IFileArchive::SFileList::SEntry* item)
4545
{
4646
assert(item->allocatorType==EAT_NULL);
4747
return {reinterpret_cast<uint8_t*>(m_file->getMappedPointer())+item->offset,item->size,nullptr};
@@ -98,7 +98,7 @@ core::smart_refctd_ptr<IFileArchive> CArchiveLoaderTar::createArchive_impl(core:
9898
if (!file || !(file->getFlags()&IFileBase::ECF_MAPPABLE))
9999
return nullptr;
100100

101-
core::vector<IFileArchive::SListEntry> items;
101+
core::vector<IFileArchive::SFileList::SEntry> items;
102102
for (size_t pos=0ull; true; )
103103
{
104104
STarHeader fHead;

src/nbl/system/CArchiveLoaderTar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class CArchiveLoaderTar final : public IArchiveLoader
1818
CFileArchive(path(_file->getFileName()),std::move(logger),std::move(_items)), m_file(std::move(_file)) {}
1919

2020
protected:
21-
file_buffer_t getFileBuffer(const IFileArchive::SListEntry* item) override;
21+
file_buffer_t getFileBuffer(const IFileArchive::SFileList::SEntry* item) override;
2222

2323
core::smart_refctd_ptr<IFile> m_file;
2424
};

src/nbl/system/CArchiveLoaderZip.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ core::smart_refctd_ptr<IFileArchive> CArchiveLoaderZip::createArchive_impl(core:
106106
return nullptr;
107107
}
108108

109-
core::vector<IFileArchive::SListEntry> items;
109+
core::vector<IFileArchive::SFileList::SEntry> items;
110110
core::vector<SZIPFileHeader> itemsMetadata;
111111
// load file entries
112112
{
@@ -367,7 +367,7 @@ bool CFileArchiveZip::scanCentralDirectoryHeader(size_t& offset)
367367
}
368368
#endif
369369

370-
CFileArchive::file_buffer_t CArchiveLoaderZip::CArchive::getFileBuffer(const IFileArchive::SListEntry* item)
370+
CFileArchive::file_buffer_t CArchiveLoaderZip::CArchive::getFileBuffer(const IFileArchive::SFileList::SEntry* item)
371371
{
372372
const auto& header = m_itemsMetadata[item->ID];
373373
// Nabla supports 0, 8, 12, 14, 99

src/nbl/system/CArchiveLoaderZip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CArchiveLoaderZip final : public IArchiveLoader
4646
{}
4747

4848
private:
49-
file_buffer_t getFileBuffer(const IFileArchive::SListEntry* item) override;
49+
file_buffer_t getFileBuffer(const IFileArchive::SFileList::SEntry* item) override;
5050

5151
core::smart_refctd_ptr<IFile> m_file;
5252
core::vector<SZIPFileHeader> m_itemsMetadata;

src/nbl/system/ISystem.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ core::vector<system::path> ISystem::listItemsInDirectory(const system::path& p)
6363
const auto archives = m_cachedArchiveFiles.findRange(archPath);
6464
for (auto& arch : archives)
6565
{
66-
const auto assets = arch.second->listAssets(std::filesystem::relative(dirPath,archPath));
66+
const auto assets = static_cast<IFileArchive::SFileList::range_t>(arch.second->listAssets(std::filesystem::relative(dirPath,archPath)));
6767
for (auto& item : assets)
6868
res.push_back(archPath/item.pathRelativeToArchive);
6969
}
@@ -244,9 +244,9 @@ ISystem::FoundArchiveFile ISystem::findFileInArchive(const system::path& absolut
244244
for (auto& archive : archives)
245245
{
246246
const auto relative = std::filesystem::relative(absolutePath,path);
247-
const auto items = archive.second->listAssets();
247+
const auto items = static_cast<IFileArchive::SFileList::range_t>(archive.second->listAssets());
248248

249-
const IFileArchive::SListEntry itemToFind = { relative };
249+
const IFileArchive::SFileList::SEntry itemToFind = { relative };
250250
auto found = std::lower_bound(items.begin(), items.end(), itemToFind);
251251
if (found!=items.end() && found->pathRelativeToArchive==relative)
252252
return {archive.second.get(),relative};

0 commit comments

Comments
 (0)