Fix #004: build fails on 32 bit architectures (#34)

* Fix #004: build fails on 32 bit architectures

* Bump go-glib to v0.0.25

Co-authored-by: Niels Avonds <niels@nobi.life>
This commit is contained in:
Niels Avonds
2022-04-19 19:31:52 +02:00
committed by GitHub
parent 640725988f
commit d245327964
7 changed files with 13 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ import "C"
import (
"fmt"
"math"
"time"
"unsafe"
@@ -62,7 +63,7 @@ func formatOffset(offset C.gfloat) string {
// goStrings returns a string slice for an array of size argc starting at the address argv.
func goStrings(argc C.int, argv **C.gchar) []string {
length := int(argc)
tmpslice := (*[1 << 30]*C.gchar)(unsafe.Pointer(argv))[:length:length]
tmpslice := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.gchar)(nil))]*C.gchar)(unsafe.Pointer(argv))[:length:length]
gostrings := make([]string, length)
for i, s := range tmpslice {
gostrings[i] = C.GoString(s)