diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-08-10 10:04:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-10 10:04:06 -0400 |
| commit | 1378fffd9da094beb41b2db89b96f556c23ab6cb (patch) | |
| tree | e0558c031bd4b1a013dc56b75c4caa3ff5442021 /source/core | |
| parent | 89083c4b50af8e48e70b25b63cc62aca21ab706c (diff) | |
Artifact and ICastable (#2351)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP with hierarchical enums.
* Some small fixes and improvements around artifact desc related types.
* Improvements around hierarchical enum.
* Fixes to get Artifact types refactor to be able to execute tests.
* Attempt to better categorize PTX.
* Work around for potentially unused function warning.
* Typo fix.
* Simplify Artifact header.
* Small improvements around Artifact kind/payload/style.
* Added IDestroyable/ICastable
* Add IArtifactList.
* First impl of IArtifactUtil.
* Use the ICastable interface for IArtifactRepresentation.
* Added IArtifactRepresentation & IArtifactAssociated.
* Add SLANG_OVERRIDE to avoid gcc/clang warning.
* Fix calling convention issue on win32.
* Fix missing SLANG_OVERRIDE.
* First attempt at file abstraction around Artifact.
* Added creation of lock file.
* Move functionality for determining file paths to the IArtifactUtil.
Add casting to ICastable.
* Added some casting/finding mechanisms.
* Simplify IArtifact interface, and use Items for file reps.
* Fix problem with libraries on DXIL.
* Split out ArtifactRepresentation.
* Move ArtifactDesc functionality to ArtifactDescUtil. ArtifactInfoUtil becomes ArtifactDescUtil.
* Split implementations from the interfaces for Artifact.
* Use TypeTextUtil for target name outputting.
* Add artifact impls.
* Add ICastableList
* Added UnknownCastableAdapter
* Make ISlangSharedLibrary derive from ICastable, and remain backwards compatible with slang-llvm.
* Refactor Representation on Artifact.
* Make our ISlangBlobs also derive from ICastable.
Make ISlangBlob atomic ref counted.
* Fix typo.
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-blob.cpp | 65 | ||||
| -rw-r--r-- | source/core/slang-blob.h | 98 | ||||
| -rw-r--r-- | source/core/slang-destroyable.h | 13 | ||||
| -rw-r--r-- | source/core/slang-file-system.cpp | 24 | ||||
| -rw-r--r-- | source/core/slang-file-system.h | 11 | ||||
| -rw-r--r-- | source/core/slang-riff-file-system.cpp | 10 | ||||
| -rw-r--r-- | source/core/slang-shared-library.cpp | 46 | ||||
| -rw-r--r-- | source/core/slang-shared-library.h | 10 | ||||
| -rw-r--r-- | source/core/slang-string-util.cpp | 2 | ||||
| -rw-r--r-- | source/core/slang-zip-file-system.cpp | 4 |
10 files changed, 189 insertions, 94 deletions
diff --git a/source/core/slang-blob.cpp b/source/core/slang-blob.cpp index 569991508..0da8f6292 100644 --- a/source/core/slang-blob.cpp +++ b/source/core/slang-blob.cpp @@ -2,19 +2,76 @@ namespace Slang { +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BlobBase !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + ISlangUnknown* BlobBase::getInterface(const Guid& guid) { - return (guid == ISlangUnknown::getTypeGuid() || guid == ISlangBlob::getTypeGuid()) ? static_cast<ISlangBlob*>(this) : nullptr; + if (guid == ISlangUnknown::getTypeGuid() || + guid == ISlangBlob::getTypeGuid()) + { + return static_cast<ISlangBlob*>(this); + } + if (guid == ICastable::getTypeGuid()) + { + return static_cast<ICastable*>(this); + } + return nullptr; +} + +void* BlobBase::getObject(const Guid& guid) +{ + SLANG_UNUSED(guid); + return nullptr; } +void* BlobBase::castAs(const SlangUUID& guid) +{ + if (auto intf = getInterface(guid)) + { + return intf; + } + return getObject(guid); +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! StaticBlob !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + SlangResult StaticBlob::queryInterface(SlangUUID const& guid, void** outObject) { - if (guid == ISlangUnknown::getTypeGuid() || guid == ISlangBlob::getTypeGuid()) + if (auto intf = getInterface(guid)) { - *outObject = static_cast<ISlangBlob*>(this); + *outObject = intf; return SLANG_OK; } return SLANG_E_NO_INTERFACE; } - + +void* StaticBlob::castAs(const SlangUUID& guid) +{ + if (auto intf = getInterface(guid)) + { + return intf; + } + return getObject(guid); +} + +ISlangUnknown* StaticBlob::getInterface(const Guid& guid) +{ + if (guid == ISlangUnknown::getTypeGuid() || + guid == ISlangBlob::getTypeGuid()) + { + return static_cast<ISlangBlob*>(this); + } + if (guid == ICastable::getTypeGuid()) + { + return static_cast<ICastable*>(this); + } + return nullptr; +} + +void* StaticBlob::getObject(const Guid& guid) +{ + SLANG_UNUSED(guid); + return nullptr; +} + } // namespace Slang diff --git a/source/core/slang-blob.h b/source/core/slang-blob.h index 58984471f..b1384bb2c 100644 --- a/source/core/slang-blob.h +++ b/source/core/slang-blob.h @@ -11,22 +11,31 @@ #include "../../slang-com-helper.h" #include "../../slang-com-ptr.h" +#include "../core/slang-com-object.h" + namespace Slang { /** Base class for simple blobs. */ -class BlobBase : public ISlangBlob, public RefObject +class BlobBase : public ISlangBlob, public ICastable, public ComBaseObject { public: // ISlangUnknown - SLANG_REF_OBJECT_IUNKNOWN_ALL + SLANG_COM_BASE_IUNKNOWN_ALL + + // ICastable + virtual SLANG_NO_THROW void* SLANG_MCALL castAs(const SlangUUID& guid) SLANG_OVERRIDE; protected: ISlangUnknown* getInterface(const Guid& guid); + void* getObject(const Guid& guid); }; /** A blob that uses a `String` for its storage. NOTE! Returns length *WITHOUT* terminating 0, even though there is one. + +NOTE! Whilst BobBase is atomic ref counted, the contained string *is not*. +There is a reasonable argument that StringBlob should contain it's own copy of the string contents. */ class StringBlob : public BlobBase { @@ -35,14 +44,16 @@ public: SLANG_NO_THROW void const* SLANG_MCALL getBufferPointer() SLANG_OVERRIDE { return m_string.getBuffer(); } SLANG_NO_THROW size_t SLANG_MCALL getBufferSize() SLANG_OVERRIDE { return m_string.getLength(); } - /// Get the contained string - SLANG_FORCE_INLINE const String& getString() const { return m_string; } + static ComPtr<ISlangBlob> create(const String& in) { return ComPtr<ISlangBlob>(new StringBlob(in)); } +protected: explicit StringBlob(String const& string) : m_string(string) {} -protected: + /// Get the contained string + SLANG_FORCE_INLINE const String& getString() const { return m_string; } + String m_string; }; @@ -56,21 +67,20 @@ public: SLANG_NO_THROW void const* SLANG_MCALL getBufferPointer() SLANG_OVERRIDE { return m_data.getBuffer(); } SLANG_NO_THROW size_t SLANG_MCALL getBufferSize() SLANG_OVERRIDE { return m_data.getCount(); } - ListBlob() {} + static ComPtr<ISlangBlob> create(const List<uint8_t>& data) { return ComPtr<ISlangBlob>(new ListBlob(data)); } + + static ComPtr<ISlangBlob> moveCreate(List<uint8_t>& data) { return ComPtr<ISlangBlob>(new ListBlob(_Move(data))); } - ListBlob(const List<uint8_t>& data): m_data(data) {} +protected: + explicit ListBlob(const List<uint8_t>& data) : m_data(data) {} // Move ctor - ListBlob(List<uint8_t>&& data): m_data(data) {} + explicit ListBlob(List<uint8_t>&& data) : m_data(data) {} - static RefPtr<ListBlob> moveCreate(List<uint8_t>& data) { return new ListBlob(_Move(data)); } + void operator=(const ThisType& rhs) = delete; List<uint8_t> m_data; - -protected: - void operator=(const ThisType& rhs) = delete; }; - class ScopedAllocation { public: @@ -172,29 +182,35 @@ public: SLANG_NO_THROW void const* SLANG_MCALL getBufferPointer() SLANG_OVERRIDE { return m_data.getData(); } SLANG_NO_THROW size_t SLANG_MCALL getBufferSize() SLANG_OVERRIDE { return m_data.getSizeInBytes(); } - // Ctor - // NOTE! Takes a copy of the input data - RawBlob(const void* data, size_t size) - { - memcpy(m_data.allocate(size), data, size); - } - /// Moves ownership of data and dataCount to the blob /// data must be a pointer returned by ::malloc. - static RefPtr<RawBlob> moveCreate(uint8_t* data, size_t dataCount) + static ComPtr<ISlangBlob> moveCreate(uint8_t* data, size_t dataCount) { RawBlob* blob = new RawBlob; blob->m_data.attach(data, dataCount); - return blob; + return ComPtr<ISlangBlob>(blob); } - static RefPtr<RawBlob> moveCreate(ScopedAllocation& alloc) + static ComPtr<ISlangBlob> moveCreate(ScopedAllocation& alloc) { RawBlob* blob = new RawBlob; blob->m_data.swap(alloc); - return blob; + return ComPtr<ISlangBlob>(blob); + } + + /// Create a blob that will retain (a copy of) raw data. + static inline ComPtr<ISlangBlob> create(void const* inData, size_t size) + { + return ComPtr<ISlangBlob>(new RawBlob(inData, size)); } protected: + // Ctor + // NOTE! Takes a copy of the input data + RawBlob(const void* data, size_t size) + { + memcpy(m_data.allocate(size), data, size); + } + RawBlob() = default; ScopedAllocation m_data; @@ -208,14 +224,19 @@ public: SLANG_NO_THROW void const* SLANG_MCALL getBufferPointer() SLANG_OVERRIDE { return m_data; } SLANG_NO_THROW size_t SLANG_MCALL getBufferSize() SLANG_OVERRIDE { return m_dataSizeInBytes; } + static inline ComPtr<ISlangBlob> create(void const* inData, size_t size) + { + return ComPtr<ISlangBlob>(new UnownedRawBlob(inData, size)); + } + +protected: // Ctor - UnownedRawBlob(const void* data, size_t size): + UnownedRawBlob(const void* data, size_t size) : m_data(data), m_dataSizeInBytes(size) { } -protected: UnownedRawBlob() = default; const void* m_data; @@ -226,7 +247,7 @@ protected: The memory it references is *not* owned by the blob. This is useful when a Blob is useful to represent some global immutable chunk of memory. */ -class StaticBlob : public ISlangBlob +class StaticBlob : public ISlangBlob, public ICastable { public: @@ -235,6 +256,9 @@ public: SLANG_NO_THROW uint32_t SLANG_MCALL addRef() SLANG_OVERRIDE { return 1; } SLANG_NO_THROW uint32_t SLANG_MCALL release() SLANG_OVERRIDE { return 1; } + // ICastable + virtual SLANG_NO_THROW void* SLANG_MCALL castAs(const SlangUUID& guid) SLANG_OVERRIDE; + // ISlangBlob SLANG_NO_THROW void const* SLANG_MCALL getBufferPointer() SLANG_OVERRIDE { return m_data; } SLANG_NO_THROW size_t SLANG_MCALL getBufferSize() SLANG_OVERRIDE { return m_dataCount; } @@ -246,17 +270,13 @@ public: } protected: + ISlangUnknown* getInterface(const Guid& guid); + void* getObject(const Guid& guid); + const void* m_data; size_t m_dataCount; }; -/// Create a blob that will retain (a copy of) raw data. -/// -inline ComPtr<ISlangBlob> createRawBlob(void const* inData, size_t size) -{ - return ComPtr<ISlangBlob>(new RawBlob(inData, size)); -} - class ScopeRefObjectBlob : public BlobBase { public: @@ -264,14 +284,22 @@ public: SLANG_NO_THROW void const* SLANG_MCALL getBufferPointer() SLANG_OVERRIDE { return m_blob->getBufferPointer(); } SLANG_NO_THROW size_t SLANG_MCALL getBufferSize() SLANG_OVERRIDE { return m_blob->getBufferSize(); } + static inline ComPtr<ISlangBlob> create(ISlangBlob* blob, RefObject* scope) + { + return ComPtr<ISlangBlob>(new ScopeRefObjectBlob(blob, scope)); + } + +protected: + // Ctor + ScopeRefObjectBlob(ISlangBlob* blob, RefObject* scope) : m_blob(blob), m_scope(scope) { } -protected: + RefPtr<RefObject> m_scope; ComPtr<ISlangBlob> m_blob; }; diff --git a/source/core/slang-destroyable.h b/source/core/slang-destroyable.h index 343cc2484..bf373ba33 100644 --- a/source/core/slang-destroyable.h +++ b/source/core/slang-destroyable.h @@ -9,16 +9,13 @@ namespace Slang { -/* An interface to provide a mechanism to cast, that doesn't require ref counting -and doesn't have to return a pointer to a ISlangUnknown derived class */ -class ICastable : public ISlangUnknown +/* Adapter interface to make a non castable type work as ICastable */ +class IUnknownCastableAdapter : public ICastable { - SLANG_COM_INTERFACE(0x87ede0e1, 0x4852, 0x44b0, { 0x8b, 0xf2, 0xcb, 0x31, 0x87, 0x4d, 0xe2, 0x39 } ); + SLANG_COM_INTERFACE(0x8b4aad81, 0x4934, 0x4a67, { 0xb2, 0xe2, 0xe9, 0x17, 0xfc, 0x29, 0x12, 0x54 } ); - /// Can be used to cast to interfaces without reference counting. - /// Also provides access to internal implementations, when they provide a guid - /// Can simulate a 'generated' interface as long as kept in scope by cast from. - virtual SLANG_NO_THROW void* SLANG_MCALL castAs(const Guid& guid) = 0; + /// When using the adapter, this provides a way to directly get the internal no ICastable type + virtual SLANG_NO_THROW ISlangUnknown* SLANG_MCALL getContained() = 0; }; /* An interface that allows for an object to implement 'destruction'. A destroyed diff --git a/source/core/slang-file-system.cpp b/source/core/slang-file-system.cpp index 52ec40c07..6d9ad4324 100644 --- a/source/core/slang-file-system.cpp +++ b/source/core/slang-file-system.cpp @@ -608,13 +608,14 @@ SlangResult CacheFileSystem::loadFile(char const* pathIn, ISlangBlob** blobOut) SlangResult CacheFileSystem::getFileUniqueIdentity(const char* path, ISlangBlob** outUniqueIdentity) { + *outUniqueIdentity = nullptr; PathInfo* info = _resolvePathCacheInfo(path); - if (!info) + if (!info || info->m_uniqueIdentity.getLength() <= 0) { return SLANG_E_NOT_FOUND; } - info->m_uniqueIdentity->addRef(); - *outUniqueIdentity = info->m_uniqueIdentity; + + *outUniqueIdentity = StringBlob::create(info->m_uniqueIdentity).detach(); return SLANG_OK; } @@ -694,6 +695,8 @@ SlangResult CacheFileSystem::getSimplifiedPath(const char* path, ISlangBlob** ou SlangResult CacheFileSystem::getCanonicalPath(const char* path, ISlangBlob** outCanonicalPath) { + *outCanonicalPath = nullptr; + // A file must exist to get a canonical path... PathInfo* info = _resolvePathCacheInfo(path); if (!info) @@ -716,12 +719,8 @@ SlangResult CacheFileSystem::getCanonicalPath(const char* path, ISlangBlob** out if (SLANG_SUCCEEDED(res)) { // Get the path as a string - String canonicalPath = StringUtil::getString(canonicalPathBlob); - if (canonicalPath.getLength() > 0) - { - info->m_canonicalPath = new StringBlob(canonicalPath); - } - else + info->m_canonicalPath = StringUtil::getString(canonicalPathBlob); + if (info->m_canonicalPath.getLength() <= 0) { res = SLANG_FAIL; } @@ -731,11 +730,12 @@ SlangResult CacheFileSystem::getCanonicalPath(const char* path, ISlangBlob** out info->m_getCanonicalPathResult = toCompressedResult(res); } - if (info->m_canonicalPath) + // Create the blob + if (info->m_canonicalPath.getLength()) { - info->m_canonicalPath->addRef(); + *outCanonicalPath = StringBlob::create(info->m_canonicalPath).detach(); } - *outCanonicalPath = info->m_canonicalPath; + return SLANG_OK; } diff --git a/source/core/slang-file-system.h b/source/core/slang-file-system.h index 8a9cfb811..3df05b6e1 100644 --- a/source/core/slang-file-system.h +++ b/source/core/slang-file-system.h @@ -113,10 +113,9 @@ class CacheFileSystem: public ISlangFileSystemExt, public RefObject struct PathInfo { - PathInfo(const String& uniqueIdentity) + PathInfo(const String& uniqueIdentity): + m_uniqueIdentity(uniqueIdentity) { - m_uniqueIdentity = new StringBlob(uniqueIdentity); - m_loadFileResult = CompressedResult::Uninitialized; m_getPathTypeResult = CompressedResult::Uninitialized; m_getCanonicalPathResult = CompressedResult::Uninitialized; @@ -125,16 +124,16 @@ class CacheFileSystem: public ISlangFileSystemExt, public RefObject } /// Get the unique identity path as a string - const String& getUniqueIdentity() const { SLANG_ASSERT(m_uniqueIdentity); return m_uniqueIdentity->getString(); } + const String& getUniqueIdentity() const { return m_uniqueIdentity; } - RefPtr<StringBlob> m_uniqueIdentity; + String m_uniqueIdentity; CompressedResult m_loadFileResult; CompressedResult m_getPathTypeResult; CompressedResult m_getCanonicalPathResult; SlangPathType m_pathType; ComPtr<ISlangBlob> m_fileBlob; - RefPtr<StringBlob> m_canonicalPath; + String m_canonicalPath; }; Dictionary<String, PathInfo*>& getPathMap() { return m_pathMap; } diff --git a/source/core/slang-riff-file-system.cpp b/source/core/slang-riff-file-system.cpp index d52015fb3..186650ed3 100644 --- a/source/core/slang-riff-file-system.cpp +++ b/source/core/slang-riff-file-system.cpp @@ -215,7 +215,7 @@ SlangResult RiffFileSystem::saveFile(const char* path, const void* data, size_t else { // Just store the data directly. - contents = new RawBlob(data, size); + contents = RawBlob::create(data, size); } Entry* entry = _getEntryFromCanonicalPath(canonicalPath); @@ -376,7 +376,7 @@ SlangResult RiffFileSystem::loadArchive(const void* archive, size_t archiveSizeI } // Get the compressed data - dstEntry->m_contents = new RawBlob(srcData, srcEntry->compressedSize); + dstEntry->m_contents = RawBlob::create(srcData, srcEntry->compressedSize); break; } case SLANG_PATH_TYPE_DIRECTORY: break; @@ -444,10 +444,10 @@ SlangResult RiffFileSystem::storeArchive(bool blobOwnsContent, ISlangBlob** outB // We now write the RiffContainer to the stream SLANG_RETURN_ON_FAIL(RiffUtil::write(container.getRoot(), true, &stream)); - RefPtr<ListBlob> blob = new ListBlob; - stream.swapContents(blob->m_data); + List<uint8_t> data; + stream.swapContents(data); - *outBlob = blob.detach(); + *outBlob = ListBlob::moveCreate(data).detach(); return SLANG_OK; } diff --git a/source/core/slang-shared-library.cpp b/source/core/slang-shared-library.cpp index 6ce10ad9e..0e4f0ee73 100644 --- a/source/core/slang-shared-library.cpp +++ b/source/core/slang-shared-library.cpp @@ -62,7 +62,7 @@ SlangResult DefaultSharedLibraryLoader::loadPlatformSharedLibrary(const char* pa } } -/* !!!!!!!!!!!!!!!!!!!!!!!!!! DefaultSharedLibrary !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ +/* !!!!!!!!!!!!!!!!!!!!!!!!!! TemporarySharedLibrary !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ TemporarySharedLibrary::~TemporarySharedLibrary() { @@ -76,38 +76,50 @@ TemporarySharedLibrary::~TemporarySharedLibrary() /* !!!!!!!!!!!!!!!!!!!!!!!!!! DefaultSharedLibrary !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ -SLANG_NO_THROW SlangResult SLANG_MCALL DefaultSharedLibrary::queryInterface(SlangUUID const& uuid, void** outObject) +DefaultSharedLibrary::~DefaultSharedLibrary() { - // Mechanism to cast to underlying type. - // NOTE! Purposefully does not ref count - if (uuid == DefaultSharedLibrary::getTypeGuid()) + if (m_sharedLibraryHandle) { - *outObject = this; - return SLANG_OK; + SharedLibrary::unload(m_sharedLibraryHandle); } +} + +void* DefaultSharedLibrary::findSymbolAddressByName(char const* name) +{ + return SharedLibrary::findSymbolAddressByName(m_sharedLibraryHandle, name); +} - if (uuid == ISlangUnknown::getTypeGuid() || uuid == ISlangSharedLibrary::getTypeGuid()) +void* DefaultSharedLibrary::castAs(const SlangUUID& guid) +{ + if (auto intf = getInterface(guid)) { - ++m_refCount; - *outObject = static_cast<ISlangSharedLibrary*>(this); - return SLANG_OK; + return intf; } - return SLANG_E_NO_INTERFACE; + return getObject(guid); } -DefaultSharedLibrary::~DefaultSharedLibrary() +void* DefaultSharedLibrary::getInterface(const Guid& guid) { - if (m_sharedLibraryHandle) + if (guid == ISlangUnknown::getTypeGuid() || + guid == ICastable::getTypeGuid() || + guid == ISlangSharedLibrary::getTypeGuid()) { - SharedLibrary::unload(m_sharedLibraryHandle); + return static_cast<ISlangSharedLibrary*>(this); } + return nullptr; } -void* DefaultSharedLibrary::findSymbolAddressByName(char const* name) +void* DefaultSharedLibrary::getObject(const Guid& guid) { - return SharedLibrary::findSymbolAddressByName(m_sharedLibraryHandle, name); + if (guid == DefaultSharedLibrary::getTypeGuid()) + { + return this; + } + return nullptr; } +/* !!!!!!!!!!!!!!!!!!!!!!!!!! SharedLibraryUtils !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ + String SharedLibraryUtils::getSharedLibraryFileName(void* symbolInLib) { #if defined(_WIN32) diff --git a/source/core/slang-shared-library.h b/source/core/slang-shared-library.h index 44adb1ac6..c0074bad3 100644 --- a/source/core/slang-shared-library.h +++ b/source/core/slang-shared-library.h @@ -52,10 +52,9 @@ class DefaultSharedLibrary : public ISlangSharedLibrary, public ComBaseObject SLANG_CLASS_GUID(0xe7f2597b, 0xf803, 0x4b6e, { 0xaf, 0x8b, 0xcb, 0xe3, 0xa2, 0x21, 0xfd, 0x5a }) // ISlangUnknown - SLANG_NO_THROW SlangResult SLANG_MCALL queryInterface(SlangUUID const& uuid, void** outObject) SLANG_OVERRIDE; - SLANG_COM_BASE_IUNKNOWN_ADD_REF - SLANG_COM_BASE_IUNKNOWN_RELEASE - + SLANG_COM_BASE_IUNKNOWN_ALL + // ICastable + virtual SLANG_NO_THROW void* SLANG_MCALL castAs(const SlangUUID& guid) SLANG_OVERRIDE; // ISlangSharedLibrary virtual SLANG_NO_THROW void* SLANG_MCALL findSymbolAddressByName(char const* name) SLANG_OVERRIDE; @@ -71,6 +70,9 @@ class DefaultSharedLibrary : public ISlangSharedLibrary, public ComBaseObject protected: + void* getInterface(const Guid& guid); + void* getObject(const Guid& guid); + SharedLibrary::Handle m_sharedLibraryHandle = nullptr; }; diff --git a/source/core/slang-string-util.cpp b/source/core/slang-string-util.cpp index c4b654072..a1f310401 100644 --- a/source/core/slang-string-util.cpp +++ b/source/core/slang-string-util.cpp @@ -319,7 +319,7 @@ UnownedStringSlice StringUtil::getAtInSplit(const UnownedStringSlice& in, char s ComPtr<ISlangBlob> StringUtil::createStringBlob(const String& string) { - return ComPtr<ISlangBlob>(new StringBlob(string)); + return StringBlob::create(string); } /* static */String StringUtil::calcCharReplaced(const UnownedStringSlice& slice, char fromChar, char toChar) diff --git a/source/core/slang-zip-file-system.cpp b/source/core/slang-zip-file-system.cpp index 1ed003d55..ce25066df 100644 --- a/source/core/slang-zip-file-system.cpp +++ b/source/core/slang-zip-file-system.cpp @@ -709,12 +709,12 @@ SlangResult ZipFileSystemImpl::storeArchive(bool blobOwnsContent, ISlangBlob** o if (blobOwnsContent) { // Takes a copy - blob = new RawBlob(m_data.getData(), Index(m_data.getSizeInBytes())); + blob = RawBlob::create(m_data.getData(), Index(m_data.getSizeInBytes())); } else { // Doesn't take a copy... Must use with care(!) - blob = new UnownedRawBlob(m_data.getData(), Index(m_data.getSizeInBytes())); + blob = UnownedRawBlob::create(m_data.getData(), Index(m_data.getSizeInBytes())); } *outBlob = blob.detach(); return SLANG_OK; |
