mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
all: replace unsafe slice operations with unsafe.Slice
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"image"
|
||||
"math"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
@@ -850,10 +849,5 @@ func toBlendFactor(f driver.BlendFactor) (uint32, uint32) {
|
||||
|
||||
// sliceOf returns a slice from a (native) pointer.
|
||||
func sliceOf(ptr uintptr, cap int) []byte {
|
||||
var data []byte
|
||||
h := (*reflect.SliceHeader)(unsafe.Pointer(&data))
|
||||
h.Data = ptr
|
||||
h.Cap = cap
|
||||
h.Len = cap
|
||||
return data
|
||||
return unsafe.Slice((*byte)(unsafe.Pointer(ptr)), cap)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user