mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-01-11 01:10:17 +01:00
Merged.
This commit is contained in:
commit
0030f7bc02
@ -137,7 +137,12 @@ func NewDecodedBlock(data []byte, colors *Colors) (db *DecodedBlock, err error)
|
||||
return
|
||||
}
|
||||
|
||||
offset += buf.Pos + 4
|
||||
// There is a bug before Go 1.7 that enforces
|
||||
// to add 4 as an offset after the compressed
|
||||
// geometry data. This is resolved via build tags
|
||||
// and definitions in pre17offset.go and
|
||||
// post17offset.go.
|
||||
offset += buf.Pos + afterCompressOfs
|
||||
buf.Pos = 0
|
||||
if offset >= dataLen {
|
||||
return nil, ErrBlockTruncated
|
||||
|
10
common/post17offset.go
Normal file
10
common/post17offset.go
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2016 by Sascha L. Teichmann
|
||||
// Use of this source code is governed by the MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
// +build go1.7
|
||||
|
||||
package common
|
||||
|
||||
// afterCompressOfs is not necessary after Go 1.7.
|
||||
const afterCompressOfs = 0
|
10
common/pre17offset.go
Normal file
10
common/pre17offset.go
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2016 by Sascha L. Teichmann
|
||||
// Use of this source code is governed by the MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
// +build !go1.7
|
||||
|
||||
package common
|
||||
|
||||
// afterCompressOfs is necessary before Go 1.7.
|
||||
const afterCompressOfs = 4
|
Loading…
Reference in New Issue
Block a user