1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:47:57 -07:00

implications of len spec change

R=r
CC=golang-dev
https://golang.org/cl/1712048
This commit is contained in:
Russ Cox 2010-07-01 17:49:28 -07:00
parent 88f5bd9481
commit 971a04f1dc
6 changed files with 8 additions and 8 deletions

View File

@ -58,7 +58,7 @@ func (file *File) Readdirnames(count int) (names []string, err Error) {
if dirent.Ino == 0 { // File absent in directory.
continue
}
bytes := (*[len(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0]))
bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
var name = string(bytes[0:dirent.Namlen])
if name == "." || name == ".." { // Useless names
continue

View File

@ -53,7 +53,7 @@ func (file *File) Readdirnames(count int) (names []string, err Error) {
if dirent.Fileno == 0 { // File absent in directory.
continue
}
bytes := (*[len(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0]))
bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
var name = string(bytes[0:dirent.Namlen])
if name == "." || name == ".." { // Useless names
continue

View File

@ -56,7 +56,7 @@ func (file *File) Readdirnames(count int) (names []string, err Error) {
if dirent.Ino == 0 { // File absent in directory.
continue
}
bytes := (*[len(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0]))
bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
var name = string(bytes[0:clen(bytes[0:])])
if name == "." || name == ".." { // Useless names
continue

View File

@ -56,7 +56,7 @@ func (file *File) Readdirnames(count int) (names []string, err Error) {
if dirent.Ino == 0 { // File absent in directory.
continue
}
bytes := (*[len(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0]))
bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
var name = string(bytes[0:clen(bytes)])
if name == "." || name == ".." { // Useless names
continue

View File

@ -239,8 +239,8 @@ func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, int) {
break
}
}
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))
sa.Name = string(bytes[0:n])
bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
sa.Name = string(bytes)
return sa, 0
case AF_INET:

View File

@ -284,8 +284,8 @@ func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, int) {
for n < len(pp.Path) && pp.Path[n] != 0 {
n++
}
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))
sa.Name = string(bytes[0:n])
bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
sa.Name = string(bytes)
return sa, 0
case AF_INET: