aboutsummaryrefslogtreecommitdiff
path: root/hotline
diff options
context:
space:
mode:
Diffstat (limited to 'hotline')
-rw-r--r--hotline/file_resume_data.go5
-rw-r--r--hotline/file_wrapper.go8
-rw-r--r--hotline/flattened_file_object.go4
-rw-r--r--hotline/transfer_test.go4
4 files changed, 13 insertions, 8 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 {
diff --git a/hotline/file_wrapper.go b/hotline/file_wrapper.go
index b6aff94..5ec99c3 100644
--- a/hotline/file_wrapper.go
+++ b/hotline/file_wrapper.go
@@ -227,7 +227,7 @@ func (f *fileWrapper) flattenedFileObject() (*flattenedFileObject, error) {
}
f.Ffo.FlatFileHeader = FlatFileHeader{
- Format: [4]byte{0x46, 0x49, 0x4c, 0x50}, // "FILP"
+ Format: FormatFILP,
Version: [2]byte{0, 1},
ForkCount: [2]byte{0, 2},
}
@@ -247,7 +247,7 @@ func (f *fileWrapper) flattenedFileObject() (*flattenedFileObject, error) {
}
} else {
f.Ffo.FlatFileInformationFork = FlatFileInformationFork{
- Platform: [4]byte{0x41, 0x4D, 0x41, 0x43}, // "AMAC" TODO: Remove hardcode to support "AWIN" Platform (maybe?)
+ Platform: PlatformAMAC, // TODO: Remove hardcode to support "MWIN" Platform (maybe?)
TypeSignature: [4]byte([]byte(ft.TypeCode)),
CreatorSignature: [4]byte([]byte(ft.CreatorCode)),
PlatformFlags: [4]byte{0, 0, 1, 0}, // TODO: What is this?
@@ -263,12 +263,12 @@ func (f *fileWrapper) flattenedFileObject() (*flattenedFileObject, error) {
}
f.Ffo.FlatFileInformationForkHeader = FlatFileForkHeader{
- ForkType: [4]byte{0x49, 0x4E, 0x46, 0x4F}, // "INFO"
+ ForkType: ForkTypeINFO,
DataSize: f.Ffo.FlatFileInformationFork.Size(),
}
f.Ffo.FlatFileDataForkHeader = FlatFileForkHeader{
- ForkType: [4]byte{0x44, 0x41, 0x54, 0x41}, // "DATA"
+ ForkType: ForkTypeDATA,
DataSize: [4]byte{dataSize[0], dataSize[1], dataSize[2], dataSize[3]},
}
f.Ffo.FlatFileResForkHeader = f.rsrcForkHeader()
diff --git a/hotline/flattened_file_object.go b/hotline/flattened_file_object.go
index 99ce204..7c0cd7d 100644
--- a/hotline/flattened_file_object.go
+++ b/hotline/flattened_file_object.go
@@ -45,7 +45,7 @@ type FlatFileInformationFork struct {
func NewFlatFileInformationFork(fileName string, modifyTime [8]byte, typeSignature string, creatorSignature string) FlatFileInformationFork {
return FlatFileInformationFork{
- Platform: [4]byte{0x41, 0x4D, 0x41, 0x43}, // "AMAC" TODO: Remove hardcode to support "AWIN" Platform (maybe?)
+ Platform: PlatformAMAC, // TODO: Remove hardcode to support "MWIN" Platform (maybe?)
TypeSignature: [4]byte([]byte(typeSignature)), // TODO: Don't infer types from filename
CreatorSignature: [4]byte([]byte(creatorSignature)), // TODO: Don't infer types from filename
PlatformFlags: [4]byte{0, 0, 1, 0}, // TODO: What is this?
@@ -128,7 +128,7 @@ func (ffif *FlatFileInformationFork) ReadNameSize() []byte {
}
type FlatFileForkHeader struct {
- ForkType [4]byte // Either INFO, DATA or MACR
+ ForkType ForkType // Either INFO, DATA or MACR
CompressionType [4]byte
RSVD [4]byte
DataSize [4]byte
diff --git a/hotline/transfer_test.go b/hotline/transfer_test.go
index 4aa142b..c915498 100644
--- a/hotline/transfer_test.go
+++ b/hotline/transfer_test.go
@@ -120,14 +120,14 @@ func Test_receiveFile(t *testing.T) {
conn: func() io.Reader {
testFile := flattenedFileObject{
FlatFileHeader: FlatFileHeader{
- Format: [4]byte{0x46, 0x49, 0x4c, 0x50}, // "FILP"
+ Format: FormatFILP,
Version: [2]byte{0, 1},
ForkCount: [2]byte{0, 2},
},
FlatFileInformationForkHeader: FlatFileForkHeader{},
FlatFileInformationFork: NewFlatFileInformationFork("testfile.txt", [8]byte{}, "TEXT", "TEXT"),
FlatFileDataForkHeader: FlatFileForkHeader{
- ForkType: [4]byte{0x4d, 0x41, 0x43, 0x52}, // DATA
+ ForkType: ForkTypeMACR,
DataSize: [4]byte{0x00, 0x00, 0x00, 0x03},
},
}