From a0614693190bb91b43ff31c0537eb6f4687578f1 Mon Sep 17 00:00:00 2001 From: Albert Date: Thu, 17 Aug 2023 10:38:12 +0800 Subject: [PATCH] Fix bug in dataVisitorDispatch The obx_data_visitor in core is: ```c typedef bool obx_data_visitor(const void* data, size_t size, void* user_data); ``` So the `dataVisitorDispatch` function in Go have wrong parameter order. --- go.mod | 2 +- go.sum | 3 ++- objectbox/datavisitorc.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2de2632..95c4755 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/objectbox/objectbox-go go 1.11 require ( - github.com/google/flatbuffers v1.12.0 + github.com/google/flatbuffers v1.12.1 github.com/objectbox/objectbox-generator v0.13.0 ) diff --git a/go.sum b/go.sum index eb55e54..f21270c 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ -github.com/google/flatbuffers v1.12.0 h1:/PtAHvnBY4Kqnx/xCQ3OIV9uYcSFGScBsWI3Oogeh6w= github.com/google/flatbuffers v1.12.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= +github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/objectbox/objectbox-generator v0.13.0 h1:WyI97psLk3FLw/qGsVIMl49HCSyuFwVekBdIbQDrxXE= github.com/objectbox/objectbox-generator v0.13.0/go.mod h1:kanX8YAsG9Fi9tufV0iLMAKfV+d4WLAvSj5rtL01WhQ= diff --git a/objectbox/datavisitorc.go b/objectbox/datavisitorc.go index b4a7aaf..743757c 100644 --- a/objectbox/datavisitorc.go +++ b/objectbox/datavisitorc.go @@ -32,7 +32,7 @@ import ( //export dataVisitorDispatch // This function finds the data visitor (based on the pointer to the visitorId) and calls it with the given data // NOTE: don't change ptr contents, it's `const void*` in C but go doesn't support const pointers -func dataVisitorDispatch(visitorIdPtr unsafe.Pointer, data unsafe.Pointer, size C.size_t) C.bool { +func dataVisitorDispatch(data unsafe.Pointer, size C.size_t, visitorIdPtr unsafe.Pointer) C.bool { var visitorId = *(*uint32)(visitorIdPtr) // create an empty byte slice and map the C data to it, no copy required