Skip to content

Commit 4d7601b

Browse files
committed
Merge branch '141-get-many-32-bit' into dev
2 parents 747e63b + ed339c2 commit 4d7601b

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

.gitlab-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test:linux:x64:
3434
- GOVERSION: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22' ]
3535

3636
# TODO Not working on shell runner (e.g. with default (old) version): investigate and find a working setup
37-
.test:linux:ARMv7hf:
37+
test:linux:ARMv7hf:
3838
extends: .test
3939
tags: [ armv7hf, linux, shell ]
4040
variables:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ id, err := box.Put(&Person{ FirstName: "Joe", LastName: "Green" })
3636
Want details? **[Read the docs](https://golang.objectbox.io/)** or
3737
**[check out the API reference](https://godoc.org/github.com/objectbox/objectbox-go/objectbox)**.
3838

39-
Latest release: [v1.8.0 (2024-02-16)](https://golang.objectbox.io/)
39+
Latest release: [v1.8.1 (2024-08-29)](https://golang.objectbox.io/)
4040

4141
## Table of Contents:
4242
- [High-performance Golang database](#high-performance-golang-database)

objectbox/datavisitorc.go

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2021 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2018-2024 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,19 +26,31 @@ package objectbox
2626
*/
2727
import "C"
2828
import (
29+
"fmt"
2930
"unsafe"
3031
)
3132

32-
//export dataVisitorDispatch
33+
// "Implements" the C function obx_data_visitor and dispatches to the registered Go data visitor.
3334
// This function finds the data visitor (based on the pointer to the visitorId) and calls it with the given data
3435
// NOTE: don't change ptr contents, it's `const void*` in C but go doesn't support const pointers
35-
func dataVisitorDispatch(visitorIdPtr unsafe.Pointer, data unsafe.Pointer, size C.size_t) C.bool {
36-
var visitorId = *(*uint32)(visitorIdPtr)
36+
//
37+
//export dataVisitorDispatch
38+
func dataVisitorDispatch(data unsafe.Pointer, size C.size_t, userData unsafe.Pointer) C.bool {
39+
if userData == nil {
40+
panic("Internal error: visitor ID pointer is nil")
41+
}
42+
var visitorId = *(*uint32)(userData)
3743

3844
// create an empty byte slice and map the C data to it, no copy required
3945
var bytes []byte
40-
cVoidPtrToByteSlice(data, int(size), &bytes)
46+
if data != nil {
47+
cVoidPtrToByteSlice(data, int(size), &bytes)
48+
}
49+
50+
var fn = dataVisitorLookup(visitorId)
51+
if fn == nil {
52+
panic(fmt.Sprintf("Internal error: no data visitor found for ID %d", visitorId))
53+
}
4154

42-
var fn = dataVisitorLookup(uint32(visitorId))
4355
return C.bool(fn(bytes))
4456
}

objectbox/version.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2022 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2018-2024 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ func (v Version) String() string {
5151
// VersionGo returns the Version of the ObjectBox-Go binding
5252
func VersionGo() Version {
5353
// for label, use `beta.0` format, increasing the counter for each subsequent release
54-
return Version{1, 8, 0, ""}
54+
return Version{1, 8, 1, ""}
5555
}
5656

5757
// VersionLib returns the Version of the dynamic linked ObjectBox library (loaded at runtime)

0 commit comments

Comments
 (0)