Files
QSfera/vendor/github.com/shamaton/msgpack/v2/internal/decoding/read.go
T
dependabot[bot]andRalf Haferkamp b3e5d80306 chore(deps): bump github.com/shamaton/msgpack/v2 from 2.2.0 to 2.2.2
Bumps [github.com/shamaton/msgpack/v2](https://github.com/shamaton/msgpack) from 2.2.0 to 2.2.2.
- [Release notes](https://github.com/shamaton/msgpack/releases)
- [Commits](https://github.com/shamaton/msgpack/compare/v2.2.0...v2.2.2)

---
updated-dependencies:
- dependency-name: github.com/shamaton/msgpack/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-23 12:57:52 +02:00

33 lines
755 B
Go

package decoding
import (
"github.com/shamaton/msgpack/v2/def"
)
func (d *decoder) readSize1(index int) (byte, int, error) {
rb := def.Byte1
if len(d.data) < index+rb {
return 0, 0, def.ErrTooShortBytes
}
return d.data[index], index + rb, nil
}
func (d *decoder) readSize2(index int) ([]byte, int, error) {
return d.readSizeN(index, def.Byte2)
}
func (d *decoder) readSize4(index int) ([]byte, int, error) {
return d.readSizeN(index, def.Byte4)
}
func (d *decoder) readSize8(index int) ([]byte, int, error) {
return d.readSizeN(index, def.Byte8)
}
func (d *decoder) readSizeN(index, n int) ([]byte, int, error) {
if len(d.data) < index+n {
return emptyBytes, 0, def.ErrTooShortBytes
}
return d.data[index : index+n], index + n, nil
}