Commit 0a38b2cd authored by Alex Brainman's avatar Alex Brainman

[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
parent 7b596457
...@@ -175,7 +175,7 @@ func goenvs() { ...@@ -175,7 +175,7 @@ func goenvs() {
n := 0 n := 0
for p = env; *p != 0; n++ { 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)) envs = makeStringSlice(int(n))
...@@ -183,7 +183,7 @@ func goenvs() { ...@@ -183,7 +183,7 @@ func goenvs() {
p = env p = env
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
envs[i] = gostringw(p) 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))) stdcall1(_FreeEnvironmentStringsW, uintptr(unsafe.Pointer(env)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment