Browse Source

Remove use of magic number

Sean Hanson 5 years ago
parent
commit
dec71e97e5
1 changed files with 2 additions and 1 deletions
  1. 2 1
      real_decoder.go

+ 2 - 1
real_decoder.go

@@ -291,7 +291,8 @@ func (rd *realDecoder) peek(offset, length int) (packetDecoder, error) {
 }
 
 func (rd *realDecoder) peekInt8(offset int) (int8, error) {
-	if rd.remaining() < offset+1 {
+	const byteLen = 1
+	if rd.remaining() < offset+byteLen {
 		return -1, ErrInsufficientData
 	}
 	return int8(rd.raw[rd.off+offset]), nil