mirror of
https://github.com/ivanizag/izapple2.git
synced 2025-03-19 16:30:21 +00:00
Error strings should not be capitalized
This commit is contained in:
parent
98316a9f66
commit
cd23f03b82
@ -53,12 +53,12 @@ func OpenBlockDisk(filename string) (*BlockDisk, error) {
|
||||
}
|
||||
|
||||
if fileInfo.Size() > int64(ProDosBlockSize*proDosMaxBlocks) {
|
||||
return nil, fmt.Errorf("File is too big OR %s", err2mg.Error())
|
||||
return nil, fmt.Errorf("file is too big OR %s", err2mg.Error())
|
||||
}
|
||||
|
||||
size := uint32(fileInfo.Size())
|
||||
if size%ProDosBlockSize != 0 {
|
||||
return nil, fmt.Errorf("File size os invalid OR %s", err2mg.Error())
|
||||
return nil, fmt.Errorf("file size os invalid OR %s", err2mg.Error())
|
||||
}
|
||||
|
||||
// It's a valid raw file
|
||||
|
@ -21,7 +21,7 @@ func IsDiskette(data []byte) bool {
|
||||
// MakeDiskette returns a Diskette by detecting the format
|
||||
func MakeDiskette(data []byte, filename string, writeable bool) (Diskette, error) {
|
||||
if isFileD13(data) {
|
||||
return nil, errors.New("files with .d13 format not supported for 13 sectors disk, use .nib or .woz")
|
||||
return nil, errors.New("files with .d13 format are not supported for 13 sectors disk, use .nib or .woz")
|
||||
}
|
||||
|
||||
if isFileNib(data) {
|
||||
@ -46,5 +46,5 @@ func MakeDiskette(data []byte, filename string, writeable bool) (Diskette, error
|
||||
return newDisquetteWoz(f)
|
||||
}
|
||||
|
||||
return nil, errors.New("Diskette format not supported")
|
||||
return nil, errors.New("diskette format not supported")
|
||||
}
|
||||
|
@ -33,6 +33,6 @@ func (d *disketteNib) Write(quarterTrack int, value uint8, _ uint64) {
|
||||
}
|
||||
|
||||
func (d *disketteNib) Is13Sectors() bool {
|
||||
// It amy be 13 sectors but we don't know
|
||||
// It may be 13 sectors but we don't know
|
||||
return false
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package storage
|
||||
|
||||
//lint:ignore U1000 This is an experiment
|
||||
type disketteNibTimed struct {
|
||||
nib *fileNib
|
||||
cycleOn uint64 // Cycle when the disk was last turned on
|
||||
@ -40,6 +41,6 @@ func (d *disketteNibTimed) Write(quarterTrack int, value uint8, _ uint64) {
|
||||
}
|
||||
|
||||
func (d *disketteNibTimed) Is13Sectors() bool {
|
||||
// It amy be 13 sectors but we don't know
|
||||
// It may be 13 sectors but we don't know
|
||||
return false
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ type disketteWoz struct {
|
||||
func newDisquetteWoz(f *FileWoz) (*disketteWoz, error) {
|
||||
// Discard not supported features
|
||||
if f.Info.DiskType != 1 {
|
||||
return nil, errors.New("Only 5.25 disks are supported")
|
||||
return nil, errors.New("only 5.25 disks are supported")
|
||||
}
|
||||
|
||||
var d disketteWoz
|
||||
|
@ -44,7 +44,7 @@ func parse2mg(bd *BlockDisk) error {
|
||||
var header file2mgHeader
|
||||
minHeaderSize := binary.Size(&header)
|
||||
if fileInfo.Size() < int64(minHeaderSize) {
|
||||
return errors.New("Invalid 2MG file")
|
||||
return errors.New("invalid 2MG file")
|
||||
}
|
||||
|
||||
err = readHeader(bd.file, &header)
|
||||
@ -56,7 +56,7 @@ func parse2mg(bd *BlockDisk) error {
|
||||
bd.dataOffset = header.OffsetData
|
||||
|
||||
if fileInfo.Size() < int64(bd.dataOffset+bd.blocks*ProDosBlockSize) {
|
||||
return errors.New("The 2MG file is too small")
|
||||
return errors.New("the 2MG file is too small")
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -69,15 +69,15 @@ func readHeader(buf io.Reader, header *file2mgHeader) error {
|
||||
}
|
||||
|
||||
if header.Preamble != file2mgPreamble {
|
||||
return errors.New("The 2mg file must start with '2IMG'")
|
||||
return errors.New("the 2mg file must start with '2IMG'")
|
||||
}
|
||||
|
||||
if header.Format != file2mgFormatProdos {
|
||||
return errors.New("Only prodos disks are supported")
|
||||
return errors.New("only prodos disks are supported")
|
||||
}
|
||||
|
||||
if header.Version != file2mgVersion {
|
||||
return errors.New("Version of 2MG image not supported")
|
||||
return errors.New("version of 2MG image not supported")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -101,6 +101,7 @@ func (f *fileNib) saveTrack(track int) {
|
||||
}
|
||||
}
|
||||
|
||||
//lint:ignore U1000 This should be done per track
|
||||
func (f *fileNib) saveNib(filename string) error {
|
||||
file, err := os.Create(filename)
|
||||
if err != nil {
|
||||
@ -301,7 +302,7 @@ func nibDecodeTrack(data []byte, logicalOrder *[16]int) ([]byte, error) {
|
||||
for j := 0; j < secondaryBufferSize; j++ {
|
||||
w := sixAndTwoUntranslateTable[data[i%l]]
|
||||
if w == -1 {
|
||||
return nil, errors.New("Invalid byte from nib data")
|
||||
return nil, errors.New("invalid byte from nib data")
|
||||
}
|
||||
v := byte(w) ^ prevV
|
||||
prevV = v
|
||||
@ -320,7 +321,7 @@ func nibDecodeTrack(data []byte, logicalOrder *[16]int) ([]byte, error) {
|
||||
for j := 0; j < primaryBufferSize; j++ {
|
||||
w := sixAndTwoUntranslateTable[data[i%l]]
|
||||
if w == -1 {
|
||||
return nil, errors.New("Invalid byte from nib data")
|
||||
return nil, errors.New("invalid byte from nib data")
|
||||
}
|
||||
v := byte(w) ^ prevV
|
||||
b[dst+j] |= v << 2 // The elements of the secondary buffer are the 6 MSB bits
|
||||
|
@ -148,7 +148,7 @@ func NewFileWoz(data []uint8) (*FileWoz, error) {
|
||||
} else if bytes.Equal(headerWoz2, header) {
|
||||
f.version = 2
|
||||
} else {
|
||||
return nil, errors.New("Invalid WOZ header")
|
||||
return nil, errors.New("invalid WOZ header")
|
||||
}
|
||||
|
||||
// Extract the chunks
|
||||
@ -161,7 +161,7 @@ func NewFileWoz(data []uint8) (*FileWoz, error) {
|
||||
i += wozChunkHeaderLen
|
||||
iNext := i + int(chunkHeader.Size)
|
||||
if i == iNext || iNext > len(data) {
|
||||
return nil, errors.New("Invalid chunk in WOZ file")
|
||||
return nil, errors.New("invalid chunk in WOZ file")
|
||||
}
|
||||
|
||||
id := string(chunkHeader.ID[:])
|
||||
@ -174,7 +174,7 @@ func NewFileWoz(data []uint8) (*FileWoz, error) {
|
||||
// Read the INFO chunk
|
||||
infoData, ok := chunks["INFO"]
|
||||
if !ok {
|
||||
return nil, errors.New("Chunk INFO missing from WOZ file")
|
||||
return nil, errors.New("chunk INFO missing from WOZ file")
|
||||
}
|
||||
switch f.version {
|
||||
case 1:
|
||||
@ -201,14 +201,14 @@ func NewFileWoz(data []uint8) (*FileWoz, error) {
|
||||
// Read the TMAP chunk
|
||||
trackMap, ok := chunks["TMAP"]
|
||||
if !ok {
|
||||
return nil, errors.New("Chunk TMAP missing from WOZ file")
|
||||
return nil, errors.New("chunk TMAP missing from WOZ file")
|
||||
}
|
||||
f.trackMap = trackMap
|
||||
|
||||
// Read the TRKS chunk
|
||||
tracksData, ok := chunks["TRKS"]
|
||||
if !ok {
|
||||
return nil, errors.New("Chunk TRKS missing from WOZ file")
|
||||
return nil, errors.New("chunk TRKS missing from WOZ file")
|
||||
}
|
||||
if f.version == 1 {
|
||||
i := 0
|
||||
@ -236,7 +236,7 @@ func NewFileWoz(data []uint8) (*FileWoz, error) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return nil, errors.New("Woz version not supported")
|
||||
return nil, errors.New("woz version not supported")
|
||||
}
|
||||
|
||||
return &f, nil
|
||||
@ -263,7 +263,7 @@ func (f *FileWoz) DumpTrackAsNib(quarterTrack int) []uint8 {
|
||||
return out
|
||||
}
|
||||
|
||||
func (f *FileWoz) dump() {
|
||||
func (f *FileWoz) Dump() {
|
||||
fmt.Printf("Woz image:\n")
|
||||
fmt.Printf(" Version: %v\n", f.Info.Version)
|
||||
fmt.Printf(" Disk type: %v\n", f.Info.DiskType)
|
||||
|
Loading…
x
Reference in New Issue
Block a user