mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
455 B
25 lines
455 B
8 years ago
|
package ber
|
||
|
|
||
|
import "io"
|
||
|
|
||
|
func readByte(reader io.Reader) (byte, error) {
|
||
|
bytes := make([]byte, 1, 1)
|
||
|
_, err := io.ReadFull(reader, bytes)
|
||
|
if err != nil {
|
||
|
if err == io.EOF {
|
||
|
return 0, io.ErrUnexpectedEOF
|
||
|
}
|
||
|
return 0, err
|
||
|
}
|
||
|
return bytes[0], nil
|
||
|
}
|
||
|
|
||
|
func isEOCPacket(p *Packet) bool {
|
||
|
return p != nil &&
|
||
|
p.Tag == TagEOC &&
|
||
|
p.ClassType == ClassUniversal &&
|
||
|
p.TagType == TypePrimitive &&
|
||
|
len(p.ByteValue) == 0 &&
|
||
|
len(p.Children) == 0
|
||
|
}
|