diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-11-18 20:56:12 -0800 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-11-18 20:56:12 -0800 |
| commit | 489e26d1b3c224beffba2649406efd83580989fe (patch) | |
| tree | ecb447b869c9af1df15ce8d88d7a5d013133ae1d /hotline/file_resume_data.go | |
| parent | ecae9f7cbc7a462aefdb167fa6a8b2ae83009540 (diff) | |
Replace hardcoded magic values with named constants and improve type safety
Adds new constants for file format identifiers (FormatFILP), fork types
(ForkTypeINFO), and platform identifiers (PlatformAMAC, PlatformMWIN) to
improve code maintainability and readability. Changes FlatFileForkHeader.ForkType
field from [4]byte to ForkType type alias for better compile-time type checking,
matching the pattern used in ForkInfoList.Fork.
Diffstat (limited to 'hotline/file_resume_data.go')
| -rw-r--r-- | hotline/file_resume_data.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hotline/file_resume_data.go b/hotline/file_resume_data.go index 80f5fe5..c9f27f6 100644 --- a/hotline/file_resume_data.go +++ b/hotline/file_resume_data.go @@ -32,6 +32,7 @@ type ForkInfoList struct { var ( ForkTypeDATA = ForkType{0x44, 0x41, 0x54, 0x41} // DATA: Data fork + ForkTypeINFO = ForkType{0x49, 0x4E, 0x46, 0x4F} // INFO: Information fork ForkTypeMACR = ForkType{0x4d, 0x41, 0x43, 0x52} // MACR: Mac resource fork ) @@ -45,7 +46,11 @@ func NewForkInfoList(b []byte) *ForkInfoList { } var ( + FormatFILP = [4]byte{0x46, 0x49, 0x4c, 0x50} // Flattened file format: "FILP" FormatRFLT = [4]byte{0x52, 0x46, 0x4C, 0x54} // File resume format: "RFLT" (?) + + PlatformAMAC = [4]byte{0x41, 0x4D, 0x41, 0x43} // Mac platform: "AMAC" + PlatformMWIN = [4]byte{0x4D, 0x57, 0x49, 0x4E} // Windows platform: "MWIN" ) func NewFileResumeData(list []ForkInfoList) *FileResumeData { |