1
0
mirror of https://github.com/golang/go synced 2024-11-19 05:04:43 -07:00

[dev.cc] runtime: fix windows goenvs conversion mistake

uint16 occupies 2 bytes, not 1

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/178100043
This commit is contained in:
Alex Brainman 2014-11-21 12:15:18 +11:00
parent 7b596457d1
commit 0a38b2cdaf

View File

@ -175,7 +175,7 @@ func goenvs() {
n := 0
for p = env; *p != 0; n++ {
p = (*uint16)(add(unsafe.Pointer(p), uintptr(findnullw(p)+1)))
p = (*uint16)(add(unsafe.Pointer(p), uintptr(findnullw(p)+1)*unsafe.Sizeof(*p)))
}
envs = makeStringSlice(int(n))
@ -183,7 +183,7 @@ func goenvs() {
p = env
for i := 0; i < n; i++ {
envs[i] = gostringw(p)
p = (*uint16)(add(unsafe.Pointer(p), uintptr(findnullw(p)+1)))
p = (*uint16)(add(unsafe.Pointer(p), uintptr(findnullw(p)+1)*unsafe.Sizeof(*p)))
}
stdcall1(_FreeEnvironmentStringsW, uintptr(unsafe.Pointer(env)))