Skip to content

Commit

Permalink
Fix bug in dataVisitorDispatch
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chzhongsending committed Aug 17, 2023
1 parent 3024d90 commit a061469
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
@@ -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=
2 changes: 1 addition & 1 deletion objectbox/datavisitorc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a061469

Please sign in to comment.