Skip to content

Commit

Permalink
Use iota for disc type constants
Browse files Browse the repository at this point in the history
  • Loading branch information
bodgit committed Sep 7, 2022
1 parent ccfa521 commit 970cd9c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ const (
Extension = ".rvz"

rvzMagic uint32 = 0x52565a01 // 'R', 'V', 'Z', 0x01
)

compressed uint32 = 1 << 31
compressedMask = compressed - 1

gameCube = 1
wii = 2
const (
gameCube = iota + 1
wii
)

// A Reader has Read and Size methods.
Expand Down Expand Up @@ -122,6 +121,11 @@ func (g *group) offset() int64 {
return int64(g.Offset << 2)
}

const (
compressed uint32 = 1 << 31
compressedMask = compressed - 1
)

func (g *group) compressed() bool {
return g.Size&compressed == compressed
}
Expand Down Expand Up @@ -371,13 +375,11 @@ func NewReader(ra io.ReaderAt) (Reader, error) {
return nil, errors.New("rvz: partition hash doesn't match")
}

var err error

if err = r.readRaw(); err != nil {
if err := r.readRaw(); err != nil {
return nil, err
}

if err = r.readGroup(); err != nil {
if err := r.readGroup(); err != nil {
return nil, err
}

Expand Down

0 comments on commit 970cd9c

Please sign in to comment.