diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-04-30 09:15:49 +0000 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-04-30 09:15:49 +0000 |
| commit | 88d9199c65191647641bf06fbaa708d40e53c752 (patch) | |
| tree | 7696344260c61374e331f0b24de84c9089e15ae2 /Private/Source/FileManager.cxx | |
| parent | 094218bcd2befe8c57d042db7a2945791f29c7a6 (diff) | |
| parent | 62eef2c13fb95ab3cee86b0c066d26ceade417dd (diff) | |
Merged in MHR-18 (pull request #11)
MHR-18: NewFS: Fix fork allocation.
Diffstat (limited to 'Private/Source/FileManager.cxx')
| -rw-r--r-- | Private/Source/FileManager.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Private/Source/FileManager.cxx b/Private/Source/FileManager.cxx index aab3cff0..a8c8ad47 100644 --- a/Private/Source/FileManager.cxx +++ b/Private/Source/FileManager.cxx @@ -70,10 +70,13 @@ NodePtr NewFilesystemManager::Open(const char* path, const char* r) { /// @param data /// @param flags /// @return -Void NewFilesystemManager::Write(NodePtr node, VoidPtr data, - Int32 flags, SizeT size) { +Void NewFilesystemManager::Write(NodePtr node, VoidPtr data, Int32 flags, + SizeT size) { + constexpr const char* cReadAllFork = kNewFSDataFork; + if ((reinterpret_cast<NewCatalog*>(node))->Kind == kNewFSCatalogKindFile) - fImpl->WriteCatalog(reinterpret_cast<NewCatalog*>(node), data, size); + fImpl->WriteCatalog(reinterpret_cast<NewCatalog*>(node), data, size, + cReadAllFork); } /** @@ -87,8 +90,11 @@ Void NewFilesystemManager::Write(NodePtr node, VoidPtr data, /// @param sz /// @return VoidPtr NewFilesystemManager::Read(NodePtr node, Int32 flags, SizeT sz) { + constexpr const char* cReadAllFork = kNewFSDataFork; + if ((reinterpret_cast<NewCatalog*>(node))->Kind == kNewFSCatalogKindFile) - return fImpl->ReadCatalog(reinterpret_cast<NewCatalog*>(node), sz); + return fImpl->ReadCatalog(reinterpret_cast<NewCatalog*>(node), sz, + cReadAllFork); return nullptr; } @@ -124,5 +130,5 @@ bool NewFilesystemManager::Rewind(NodePtr node) { /// @brief The filesystem implementation. /// @return NewFSParser* NewFilesystemManager::GetImpl() noexcept { return fImpl; } -#endif // __FSKIT_NEWFS__ +#endif // __FSKIT_NEWFS__ } // namespace NewOS |
