MCPcopy Create free account
hub / github.com/IBM/sarama / getArrayLength

Method getArrayLength

real_decoder.go:113–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111}
112
113func (rd *realDecoder) getArrayLength() (int, error) {
114 if rd.remaining() < 4 {
115 rd.off = len(rd.raw)
116 return -1, ErrInsufficientData
117 }
118 // cast to int32 first to get correct signedness for length before then
119 // casting to int for ease of interop
120 tmp := int(int32(binary.BigEndian.Uint32(rd.raw[rd.off:])))
121 rd.off += 4
122 if tmp < -1 {
123 return -1, errInvalidArrayLength
124 } else if tmp > rd.remaining() {
125 rd.off = len(rd.raw)
126 return -1, ErrInsufficientData
127 } else if tmp > int(MaxResponseSize) {
128 return -1, errInvalidArrayLength
129 }
130 return tmp, nil
131}
132
133func (rd *realDecoder) getBool() (bool, error) {
134 b, err := rd.getInt8()

Callers 4

getNullableInt32ArrayMethod · 0.95
getInt64ArrayMethod · 0.95
getStringArrayMethod · 0.95

Calls 1

remainingMethod · 0.95

Tested by 1