From cc0b81350f6b681c794b4ac7c0f3b5fe73cb19eb Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 1 Sep 2022 16:39:08 -0400 Subject: Make ISlangFileSystem derive from ICastable (#2386) * #include an absolute path didn't work - because paths were taken to always be relative. * Make ISlangFileSystem derive from ICastable. * Make ArchiveFileSystem into an interface Make file systems atomically reference counted. * Small fix. * Some small fixes to work around issues of ICastable on ISlangFileSystem * Use ISlangFileSystem derived type instead of IArchiveFileSystem. Can always get other interface with castAs. * Some small fixes around change of interface returned from archive type functions. * Remove CacheFileSystem member from linkage. Can access easily from m_fileSystemExt if necessary with as cast. * Fix RiffFileSystem casting issue. * Add a check around CacheFileSystem. --- tools/slang-unit-test/unit-test-compression.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tools/slang-unit-test/unit-test-compression.cpp') diff --git a/tools/slang-unit-test/unit-test-compression.cpp b/tools/slang-unit-test/unit-test-compression.cpp index 89716b443..e3bcbcf00 100644 --- a/tools/slang-unit-test/unit-test-compression.cpp +++ b/tools/slang-unit-test/unit-test-compression.cpp @@ -8,6 +8,8 @@ #include "../../source/core/slang-lz4-compression-system.h" #include "../../source/core/slang-deflate-compression-system.h" +#include "../../source/core/slang-destroyable.h" + using namespace Slang; static bool _equals(const void* data, size_t size, ISlangBlob* blob) @@ -46,16 +48,14 @@ SLANG_UNIT_TEST(compression) for (auto archiveType : archiveTypes) { // Test out archive file systems - RefPtr archiveFileSystem; - SLANG_CHECK(SLANG_SUCCEEDED(createArchiveFileSystem(archiveType, archiveFileSystem))); + ComPtr fileSystem; + SLANG_CHECK(SLANG_SUCCEEDED(createArchiveFileSystem(archiveType, fileSystem))); const char contents[] = "I'm compressed"; const char contents2[] = "Some more stuff"; const char contents3[] = "Replace it"; { - ISlangMutableFileSystem* fileSystem = archiveFileSystem; - SLANG_CHECK(SLANG_SUCCEEDED(fileSystem->createDirectory("hello"))); SLANG_CHECK(SLANG_SUCCEEDED(fileSystem->createDirectory("hello2"))); SLANG_CHECK(SLANG_SUCCEEDED(fileSystem->remove("hello"))); @@ -131,11 +131,13 @@ SLANG_UNIT_TEST(compression) // Load and check its okay { + IArchiveFileSystem* archiveFileSystem = as(fileSystem); + ComPtr archiveBlob; SLANG_CHECK(SLANG_SUCCEEDED(archiveFileSystem->storeArchive(false, archiveBlob.writeRef()))); - RefPtr fileSystem; + ComPtr fileSystem; #if 0 SLANG_CHECK(SLANG_SUCCEEDED(createArchiveFileSystem(archiveType, fileSystem))); -- cgit v1.2.3