From 7f727a637741e4592c401a554c4d57a5bb4c38ee Mon Sep 17 00:00:00 2001 From: Terence Boldt Date: Sun, 23 Jan 2022 18:51:44 -0500 Subject: [PATCH] Fix comments for documentation --- prodos/directory.go | 16 +++++++++++----- prodos/memfile.go | 4 ++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/prodos/directory.go b/prodos/directory.go index 422a62b..90f6e5b 100644 --- a/prodos/directory.go +++ b/prodos/directory.go @@ -39,11 +39,17 @@ type DirectoryHeader struct { } const ( - StorageDeleted = 0 - StorageSeedling = 1 - StorageSapling = 2 - StorageTree = 3 - StoragePascal = 4 + // File is deleted + StorageDeleted = 0 + // File is <= 512 bytes + StorageSeedling = 1 + // File is > 512 bytes and <= 128 KB + StorageSapling = 2 + // File is > 128 KB and <= 16 MB + StorageTree = 3 + // Pacal storage area + StoragePascal = 4 + // Directory StorageDirectory = 13 ) diff --git a/prodos/memfile.go b/prodos/memfile.go index 726115d..f7c1354 100644 --- a/prodos/memfile.go +++ b/prodos/memfile.go @@ -6,20 +6,24 @@ package prodos +// MemoryFile containts file data and size type MemoryFile struct { data []byte size int } +// NewMemoryFile creates an in-memory file of the specified size in bytes func NewMemoryFile(size int) *MemoryFile { return &MemoryFile{make([]byte, size), size} } +// WriteAt writes data to the specified offset in the file func (memoryFile *MemoryFile) WriteAt(data []byte, offset int64) (int, error) { copy(memoryFile.data[int(offset):], data) return len(data), nil } +// ReadAt reads data from the specified offset in the file func (memoryFile *MemoryFile) ReadAt(data []byte, offset int64) (int, error) { copy(data, memoryFile.data[int(offset):]) return len(data), nil