diff options
| author | 2026-01-27 19:05:00 +0100 | |
|---|---|---|
| committer | 2026-01-27 19:09:10 +0100 | |
| commit | 6002485582541df9dff3e2c782a014564e22ed07 (patch) | |
| tree | 0eeb6398044053859c2d80b7b8bc2e13d7fc01ac /pack_idx.go | |
| parent | TODO: HashAlgorithm interface? compression agility? (diff) | |
| signature | No signature | |
hash: Use a hashAlgorithmDetails struct for single source of truth v0.1.2
hashAlgorithm's are assumed to be valid; methods on invalid
hashAlgorithms will panic from out-of-bounds read when it's not found in
hashAlgorithmTable and that's expected and intended.
Diffstat (limited to 'pack_idx.go')
| -rw-r--r-- | pack_idx.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pack_idx.go b/pack_idx.go index c4c166ef..0dbb9bcf 100644 --- a/pack_idx.go +++ b/pack_idx.go @@ -163,7 +163,7 @@ func (pi *packIndex) parse(buf []byte) error { nobj := int(readBE32(pi.fanout[len(pi.fanout)-4:])) namesStart := fanoutEnd - namesEnd := namesStart + nobj*pi.repo.hashAlgo.size() + namesEnd := namesStart + nobj*pi.repo.hashAlgo.Size() if namesEnd > len(buf) { return ErrInvalidObject } @@ -183,7 +183,7 @@ func (pi *packIndex) parse(buf []byte) error { pi.offset32 = buf[off32Start:off32End] off64Start := off32End - trailerStart := len(buf) - 2*pi.repo.hashAlgo.size() + trailerStart := len(buf) - 2*pi.repo.hashAlgo.Size() if trailerStart < off64Start { return ErrInvalidObject } @@ -253,7 +253,7 @@ func (pi *packIndex) lookup(id Hash) (packlocation, error) { lo = int(pi.fanoutEntry(first - 1)) } hi := int(pi.fanoutEntry(first)) - idx, found := bsearchHash(pi.names, pi.repo.hashAlgo.size(), lo, hi, id) + idx, found := bsearchHash(pi.names, pi.repo.hashAlgo.Size(), lo, hi, id) if !found { return packlocation{}, ErrNotFound } |
