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:
parent
88f5bd9481
commit
971a04f1dc
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user