Remove non-relative Seek calls from all functions.
Previously we would seek to the beginning of the io.ReadSeeker. It is much more flexible to assume that the caller passes the ReadSeeker in an appropriate state.
This commit is contained in:
@@ -7,7 +7,9 @@ package tag
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
// ErrNoTagsFound is the error returned by ReadFrom when the metadata format
|
||||
@@ -25,6 +27,11 @@ func ReadFrom(r io.ReadSeeker) (Metadata, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = r.Seek(-11, os.SEEK_CUR)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not seek back to original position: %v", err)
|
||||
}
|
||||
|
||||
switch {
|
||||
case string(b[0:4]) == "fLaC":
|
||||
return ReadFLACTags(r)
|
||||
|
||||
Reference in New Issue
Block a user