mirror of
https://github.com/Monibuca/engine.git
synced 2025-10-06 09:06:52 +08:00
parse config一处判断无效value
This commit is contained in:
@@ -2,12 +2,23 @@ package util
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
"math"
|
||||
"net"
|
||||
)
|
||||
|
||||
type Buffer []byte
|
||||
|
||||
func (b *Buffer) Read(buf []byte) (n int, err error) {
|
||||
if !b.CanReadN(len(buf)) {
|
||||
copy(buf, *b)
|
||||
return b.Len(), io.EOF
|
||||
}
|
||||
ret := b.ReadN(len(buf))
|
||||
copy(buf, ret)
|
||||
return len(ret), err
|
||||
}
|
||||
|
||||
func (b *Buffer) ReadN(n int) Buffer {
|
||||
l := b.Len()
|
||||
r := (*b)[:n]
|
||||
|
Reference in New Issue
Block a user