]> Sergey Matveev's repositories - go-opus.git/commit
fix: wrap libopusfile init call for go test -race
authorHraban Luyat <hraban@0brg.net>
Fri, 10 Jul 2020 08:37:18 +0000 (09:37 +0100)
committerHraban Luyat <hraban@0brg.net>
Fri, 10 Jul 2020 08:40:35 +0000 (09:40 +0100)
commit2a2b57e79dfdd65379ab4626b58f82cfbd3ba11f
tree28f8a7dc50a16bc8b987e1a8b6e425a6d2f6e20e
parentf08db0e111900fc0d9bc2a1fb2dc9be091730d39
fix: wrap libopusfile init call for go test -race

Since go 1.14 the race checker includes an overzealous pointer checker.
It marks all conversions from uintptr to unsafe.Pointer as an error, but
in reality that's allowed as long as you never dereference the pointer
or do any arithmetic on it. The C compiler doesn't complain about this,
so we pass the uintptr value to C and convert it there, in a small
wrapper function.

See https://groups.google.com/g/golang-nuts/c/995uZyRPKlU for more
details.

Fixes hraban/opus#28
callbacks.c
stream.go