Skip to content

Commit

Permalink
Simplify function
Browse files Browse the repository at this point in the history
  • Loading branch information
bodgit committed Apr 26, 2023
1 parent 7a455e1 commit d6abcbc
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,10 @@ const (
)

func findSignature(r io.ReaderAt, search []byte) ([]int64, error) {
var (
offset int64
offsets []int64
)

chunk := make([]byte, chunkSize+len(search))
offsets := make([]int64, 0, 2)

for offset < searchLimit {
for offset := int64(0); offset < searchLimit; offset += chunkSize {
n, err := r.ReadAt(chunk, offset)

for i := 0; ; {
Expand All @@ -295,8 +291,6 @@ func findSignature(r io.ReaderAt, search []byte) ([]int64, error) {

return nil, err
}

offset += chunkSize
}

return offsets, nil
Expand Down

0 comments on commit d6abcbc

Please sign in to comment.