From cf4c44f4d5979d6bec04c69142daa3d74277838b Mon Sep 17 00:00:00 2001 From: saxon Date: Fri, 14 Dec 2018 16:06:01 +1030 Subject: [PATCH] psi: using HasLocation or HasTime instead of ChkLocation or ChkTime --- stream/mts/psi/op.go | 10 +++++----- stream/mts/psi/psi_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stream/mts/psi/op.go b/stream/mts/psi/op.go index d2483e2f..56fed186 100644 --- a/stream/mts/psi/op.go +++ b/stream/mts/psi/op.go @@ -54,7 +54,7 @@ func ChkTime(p []byte) error { // ChkLocation takes a psi as a byte slice and checks to see if it has a location descriptor // - if so return nil, otherwise return error -func ChkLocation(p []byte) error { +func HasLocation(p []byte) error { if p[locationTagIndx] != locationDescTag { return errors.New("PSI does not contain a location descriptor, cannot update") } @@ -80,7 +80,7 @@ func UpdateTime(d []byte, t uint64) error { // TimeOf takes a byte slice representation of a psi-pmt and extracts it's // timestamp, returning as a uint64 if it exists, otherwise returning 0 and nil // if it does not exist -func TimeOf(p []byte) (t uint64, err error) { +func TimeFrom(p []byte) (t uint64, err error) { err = ChkTime(p) if err != nil { return 0, err @@ -96,8 +96,8 @@ func TimeOf(p []byte) (t uint64, err error) { // TimeOf takes a byte slice representation of a psi-pmt and extracts it's // timestamp, returning as a uint64 if it exists, otherwise returning 0 and nil // if it does not exist -func LocationOf(p []byte) (g string, err error) { - err = ChkLocation(p) +func LocationFrom(p []byte) (g string, err error) { + err = HasLocation(p) if err != nil { return "", err } @@ -119,7 +119,7 @@ func LocationStrBytes(l string) (out []byte) { // descriptor and attempts to update the location data value with the passed string. // If the psi does not contain a location descriptor, and error is returned. func UpdateLocation(d []byte, s string) error { - err := ChkLocation(d) + err := HasLocation(d) if err != nil { return err } diff --git a/stream/mts/psi/psi_test.go b/stream/mts/psi/psi_test.go index 83df4bcc..eccf057a 100644 --- a/stream/mts/psi/psi_test.go +++ b/stream/mts/psi/psi_test.go @@ -231,7 +231,7 @@ func TestTimeUpdate(t *testing.T) { // TestTimeGet tsts to see if we can correctly get the timestamp from a pmt func TestTimeGet(t *testing.T) { - s, err := TimeOf(pmtTimeBytes1) + s, err := TimeFrom(pmtTimeBytes1) if err != nil { t.Errorf("Getting timestamp failed with err: %v", err) } @@ -246,7 +246,7 @@ func TestLocationGet(t *testing.T) { if err != nil { t.Errorf("Error for TestLocationGet UpdateLocation(pb, locationTstStr1): %v", err) } - g, err := LocationOf(pb) + g, err := LocationFrom(pb) if err != nil { t.Errorf("Error for TestLocationGet LocationOf(pb): %v", err) }