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/AppMain.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/AppMain.cxx')
| -rw-r--r-- | Private/Source/AppMain.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Private/Source/AppMain.cxx b/Private/Source/AppMain.cxx index 966172df..d9c02843 100644 --- a/Private/Source/AppMain.cxx +++ b/Private/Source/AppMain.cxx @@ -41,19 +41,33 @@ EXTERN_C NewOS::Void AppMain(NewOS::Void) { NewOS::rt_string_len("EditableText")); theFork.Kind = NewOS::kNewFSDataForkKind; - theFork.DataSize = cDataSz; + theFork.DataSize = kNewFSForkSize; textCatalog = newFS->GetImpl()->CreateCatalog("/EditableText"); newFS->GetImpl()->CreateFork(textCatalog, theFork); - newFS->GetImpl()->WriteCatalog(textCatalog, theData, cDataSz); + newFS->GetImpl()->WriteCatalog(textCatalog, theData, cDataSz, "EditableText"); + + NewFork theForkPreview{0}; + + theForkPreview.Kind = NewOS::kNewFSDataForkKind; + theForkPreview.DataSize = kNewFSForkSize; + + NewOS::rt_copy_memory((NewOS::VoidPtr) "EditableTextPreview", + (NewOS::VoidPtr)theForkPreview.Name, + NewOS::rt_string_len("EditableTextPreview")); + + NewOS::Char theDataPreview[cDataSz] = { "NewKernel Info:\r\tNewKernel!" }; + newFS->GetImpl()->CreateFork(textCatalog, theForkPreview); + + newFS->GetImpl()->WriteCatalog(textCatalog, theDataPreview, cDataSz, "EditableTextPreview"); } else { NewOS::kcout << "Catalog already exists.\r"; } char* buf = nullptr; - buf = (NewOS::Char*)newFS->GetImpl()->ReadCatalog(newFS->GetImpl()->GetCatalog("/EditableText"), 512); + buf = (NewOS::Char*)newFS->GetImpl()->ReadCatalog(newFS->GetImpl()->GetCatalog("/EditableText"), 512, "EditableTextPreview"); NewOS::kcout << buf << NewOS::endl; } |
