global: buff -> buf
This always struck me as kind of weird and non-standard. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
7d327ed35a
commit
0ad14a89f5
18 changed files with 189 additions and 189 deletions
|
|
@ -217,7 +217,7 @@ func (tun *NativeTun) Events() <-chan Event {
|
|||
return tun.events
|
||||
}
|
||||
|
||||
func (tun *NativeTun) Read(buffs [][]byte, sizes []int, offset int) (int, error) {
|
||||
func (tun *NativeTun) Read(bufs [][]byte, sizes []int, offset int) (int, error) {
|
||||
// TODO: the BSDs look very similar in Read() and Write(). They should be
|
||||
// collapsed, with platform-specific files containing the varying parts of
|
||||
// their implementations.
|
||||
|
|
@ -225,8 +225,8 @@ func (tun *NativeTun) Read(buffs [][]byte, sizes []int, offset int) (int, error)
|
|||
case err := <-tun.errors:
|
||||
return 0, err
|
||||
default:
|
||||
buff := buffs[0][offset-4:]
|
||||
n, err := tun.tunFile.Read(buff[:])
|
||||
buf := bufs[0][offset-4:]
|
||||
n, err := tun.tunFile.Read(buf[:])
|
||||
if n < 4 {
|
||||
return 0, err
|
||||
}
|
||||
|
|
@ -235,11 +235,11 @@ func (tun *NativeTun) Read(buffs [][]byte, sizes []int, offset int) (int, error)
|
|||
}
|
||||
}
|
||||
|
||||
func (tun *NativeTun) Write(buffs [][]byte, offset int) (int, error) {
|
||||
func (tun *NativeTun) Write(bufs [][]byte, offset int) (int, error) {
|
||||
if offset < 4 {
|
||||
return 0, io.ErrShortBuffer
|
||||
}
|
||||
for i, buf := range buffs {
|
||||
for i, buf := range bufs {
|
||||
buf = buf[offset-4:]
|
||||
buf[0] = 0x00
|
||||
buf[1] = 0x00
|
||||
|
|
@ -256,7 +256,7 @@ func (tun *NativeTun) Write(buffs [][]byte, offset int) (int, error) {
|
|||
return i, err
|
||||
}
|
||||
}
|
||||
return len(buffs), nil
|
||||
return len(bufs), nil
|
||||
}
|
||||
|
||||
func (tun *NativeTun) Close() error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue