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:
parent
7b596457d1
commit
0a38b2cdaf
@ -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)))
|
||||
|
Loading…
Reference in New Issue
Block a user