mirror of
https://github.com/golang/go
synced 2024-11-18 09:04:49 -07:00
syscall: simplify unsafe.Slice usage
Same as CL 429915. Change-Id: I83f4d3bd980294d5bae387d875368b069be2d91a Reviewed-on: https://go-review.googlesource.com/c/go/+/429955 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Jenny Rakoczy <jenny@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: hopehook <hopehook@golangcn.org> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Jenny Rakoczy <jenny@golang.org>
This commit is contained in:
parent
e084d84420
commit
242adb784c
@ -77,7 +77,7 @@ func utf16PtrToString(p *uint16) string {
|
|||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
// Turn *uint16 into []uint16.
|
// Turn *uint16 into []uint16.
|
||||||
s := unsafe.Slice((*uint16)(unsafe.Pointer(p)), n)
|
s := unsafe.Slice(p, n)
|
||||||
// Decode []uint16 into string.
|
// Decode []uint16 into string.
|
||||||
return string(utf16.Decode(s))
|
return string(utf16.Decode(s))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user