psi: removed redundent return in updateCrc

This commit is contained in:
saxon 2019-01-07 16:25:08 +10:30
parent 26f26cbeee
commit 0c0afa8bde
2 changed files with 4 additions and 5 deletions

View File

@ -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 {

View File

@ -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
}