all: use unsafe.SliceData where appropriate

This commit is contained in:
Ayke van Laethem
2026-05-11 10:04:00 +02:00
committed by Ron Evans
parent de83d67364
commit 70a0dee8c8
9 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ type reader struct {
func (r *reader) Read(b []byte) (n int, err error) {
if len(b) != 0 {
libc_arc4random_buf(unsafe.Pointer(&b[0]), uint(len(b)))
libc_arc4random_buf(unsafe.Pointer(unsafe.SliceData(b)), uint(len(b)))
}
return len(b), nil
}
+1 -1
View File
@@ -25,7 +25,7 @@ func (r *reader) Read(b []byte) (n int, err error) {
// See for example: https://github.com/golang/go/issues/33542
// For Windows 7 and newer, we might switch to ProcessPrng in the future
// (which is a documented function and might be a tiny bit faster).
ok := libc_RtlGenRandom(unsafe.Pointer(&b[0]), len(b))
ok := libc_RtlGenRandom(unsafe.Pointer(unsafe.SliceData(b)), len(b))
if !ok {
return 0, errRandom
}