callback_proxy.c | 15 --------------- callback_proxy.h | 3 --- stream.go | 10 ++++++---- diff --git a/callback_proxy.c b/callback_proxy.c deleted file mode 100644 index dfa103114418059cec68d19cd27ee76ac0777f49..0000000000000000000000000000000000000000 --- a/callback_proxy.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Named proxy callback function, see - * - * https://code.google.com/p/go-wiki/wiki/cgo - */ - -#include "callback_proxy.h" - -int go_readproxy(void *p, unsigned char *buf, int nbytes); - -int -c_readproxy(void *p, unsigned char *buf, int nbytes) -{ - return go_readproxy(p, buf, nbytes); -} diff --git a/callback_proxy.h b/callback_proxy.h deleted file mode 100644 index f8456c80ca941ad9456560b883f016b4793a8c51..0000000000000000000000000000000000000000 --- a/callback_proxy.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -int c_readproxy(void *p, unsigned char *buf, int nbytes); diff --git a/stream.go b/stream.go index 37a039e60f53f9e062330276290e60fdc2a82646..af6cff4acca772bcdca36621ad1b5bc1437f4361 100644 --- a/stream.go +++ b/stream.go @@ -10,7 +10,9 @@ /* #cgo CFLAGS: -std=c99 -Wall -Werror -pedantic -Ibuild/include/opus #include #include -#include "callback_proxy.h" + +// Uses the same signature as Go, no need for proxy +int go_readcallback(void *p, unsigned char *buf, int nbytes); */ import "C" @@ -21,8 +23,8 @@ // Preallocated buffer to pass to the reader buf []byte } -//export go_readproxy -func go_readproxy(p unsafe.Pointer, cbuf *C.uchar, cmaxbytes C.int) C.int { +//export go_readcallback +func go_readcallback(p unsafe.Pointer, cbuf *C.uchar, cmaxbytes C.int) C.int { stream := (*Stream)(p) maxbytes := int(cmaxbytes) if maxbytes > cap(stream.buf) { @@ -39,7 +41,7 @@ return C.int(n) } var callbacks = C.struct_OpusFileCallbacks{ - read: C.op_read_func(C.c_readproxy), + read: C.op_read_func(C.go_readcallback), seek: nil, tell: nil, close: nil,