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

Method getNullableInt32Array

real_decoder.go:564–588  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

562}
563
564func (rd *realFlexibleDecoder) getNullableInt32Array() ([]int32, error) {
565 n, err := rd.getUVarint()
566 if err != nil {
567 return nil, err
568 }
569
570 if n == 0 {
571 return nil, nil
572 }
573
574 arrayLength := n - 1
575
576 if uint64(rd.remaining()/4) < arrayLength { //nolint:gosec // G115 - remaining() is non-negative
577 rd.off = len(rd.raw)
578 return nil, ErrInsufficientData
579 }
580
581 ret := make([]int32, int(arrayLength)) //nolint:gosec // G115 - value bounded by remaining() above
582
583 for i := range ret {
584 ret[i] = int32(binary.BigEndian.Uint32(rd.raw[rd.off:]))
585 rd.off += 4
586 }
587 return ret, nil
588}
589
590func (rd *realFlexibleDecoder) getInt64Array() ([]int64, error) {
591 ret, err := rd.getNullableInt64Array()

Callers 2

getInt32ArrayMethod · 0.95

Calls 2

getUVarintMethod · 0.65
remainingMethod · 0.65