From 0c0afa8bde7c7383510fe873353274a6e2367b4b Mon Sep 17 00:00:00 2001 From: saxon Date: Mon, 7 Jan 2019 16:25:08 +1030 Subject: [PATCH] psi: removed redundent return in updateCrc --- stream/mts/psi/crc.go | 5 ++--- stream/mts/psi/helpers.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/stream/mts/psi/crc.go b/stream/mts/psi/crc.go index a2e3fa9a..2da603f7 100644 --- a/stream/mts/psi/crc.go +++ b/stream/mts/psi/crc.go @@ -35,15 +35,14 @@ import ( // addCrc appends a crc table to a given psi table in bytes func addCrc(out []byte) []byte { out = append(out, make([]byte, 4)...) - out = updateCrc(out) + updateCrc(out) return out } // updateCrc updates the crc of bytes slice, writing the checksum into the last four bytes. -func updateCrc(b []byte) []byte { +func updateCrc(b []byte) { crc32 := crc32_Update(0xffffffff, crc32_MakeTable(bits.Reverse32(crc32.IEEE)), b[1:len(b)-4]) binary.BigEndian.PutUint32(b[len(b)-4:], crc32) - return b } func crc32_MakeTable(poly uint32) *crc32.Table { diff --git a/stream/mts/psi/helpers.go b/stream/mts/psi/helpers.go index 3448a0eb..fa29fc3f 100644 --- a/stream/mts/psi/helpers.go +++ b/stream/mts/psi/helpers.go @@ -70,7 +70,7 @@ func UpdateTime(dst []byte, t uint64) error { for i := range dst[timeDataIndx : timeDataIndx+timeDataSize] { dst[i+timeDataIndx] = ts[i] } - dst = updateCrc(dst) + updateCrc(dst) return nil } @@ -115,7 +115,7 @@ func UpdateLocation(d []byte, s string) error { } gb := LocationStrBytes(s) copy(d[locationDataIndx:locationDataIndx+locationDataSize], gb) - d = updateCrc(d) + updateCrc(d) return nil }