diff --git a/http.go b/http.go index 0f0600d..275ab91 100644 --- a/http.go +++ b/http.go @@ -335,7 +335,7 @@ func getSmartSubtransportStreamInterface(_s *C.git_smart_subtransport_stream) (S } //export smartSubtransportRead -func smartSubtransportRead(s *C.git_smart_subtransport_stream, data unsafe.Pointer, l C.size_t, read *C.size_t) C.int { +func smartSubtransportRead(s *C.git_smart_subtransport_stream, data *C.char, l C.size_t, read *C.size_t) C.int { stream, err := getSmartSubtransportStreamInterface(s) if err != nil { return setLibgit2Error(err) @@ -345,7 +345,7 @@ func smartSubtransportRead(s *C.git_smart_subtransport_stream, data unsafe.Point header := (*reflect.SliceHeader)(unsafe.Pointer(&p)) header.Cap = int(l) header.Len = int(l) - header.Data = uintptr(data) + header.Data = uintptr(unsafe.Pointer(data)) n, err := stream.Read(p) if err != nil { diff --git a/wrapper.c b/wrapper.c index d498284..aafe901 100644 --- a/wrapper.c +++ b/wrapper.c @@ -198,7 +198,9 @@ int _go_git_transport_smart(git_transport **out, git_remote *owner) void _go_git_setup_smart_subtransport(managed_smart_subtransport *t, void *ptr) { - t->parent.action = httpAction; + typedef int (*transport_action)(git_smart_subtransport_stream **out, git_smart_subtransport *transport, const char *url, git_smart_service_t action); + + t->parent.action = (transport_action)httpAction; t->parent.close = httpClose; t->parent.free = httpFree; @@ -207,8 +209,10 @@ void _go_git_setup_smart_subtransport(managed_smart_subtransport *t, void *ptr) void _go_git_setup_smart_subtransport_stream(managed_smart_subtransport_stream *s, void *ptr) { + typedef int (*transport_stream_write)(git_smart_subtransport_stream *stream, const char *buffer, size_t len); + s->parent.read = smartSubtransportRead; - s->parent.write = smartSubtransportWrite; + s->parent.write = (transport_stream_write)smartSubtransportWrite; s->parent.free = smartSubtransportFree; s->ptr = ptr;