From 28675baffe8f5590401a96c5a0cb4fe0fc6f4da7 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 21 Jul 2019 06:08:14 +0200 Subject: plumbing/format: idxfile, unsigned values are never < 0 Signed-off-by: Christian Muehlhaeuser (cherry picked from commit 047bb4f6d0657389ddd4ca3230ff3bee08d66a6b) --- plumbing/format/idxfile/decoder.go | 4 ---- 1 file changed, 4 deletions(-) (limited to 'plumbing/format/idxfile') diff --git a/plumbing/format/idxfile/decoder.go b/plumbing/format/idxfile/decoder.go index 5b92782..9e9c176 100644 --- a/plumbing/format/idxfile/decoder.go +++ b/plumbing/format/idxfile/decoder.go @@ -110,10 +110,6 @@ func readObjectNames(idx *MemoryIndex, r io.Reader) error { continue } - if buckets < 0 { - return ErrMalformedIdxFile - } - idx.FanoutMapping[k] = len(idx.Names) nameLen := int(buckets * objectIDLength) -- cgit From e5c9c0dd9ff1f42dcdaba7a51919cf43abdb79f9 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 21 Jul 2019 06:24:22 +0200 Subject: *: avoid unnecessary conversions No need to convert these values, they're already of the right type. Signed-off-by: Christian Muehlhaeuser (cherry picked from commit a1d8a7ac8bd0e4aff0f27dbb8bb37b8bd13a1346) --- plumbing/format/idxfile/writer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plumbing/format/idxfile') diff --git a/plumbing/format/idxfile/writer.go b/plumbing/format/idxfile/writer.go index aa919e7..fcc78c5 100644 --- a/plumbing/format/idxfile/writer.go +++ b/plumbing/format/idxfile/writer.go @@ -147,7 +147,7 @@ func (w *Writer) createIndex() (*MemoryIndex, error) { idx.Offset32[bucket] = append(idx.Offset32[bucket], buf.Bytes()...) buf.Truncate(0) - binary.WriteUint32(buf, uint32(o.CRC32)) + binary.WriteUint32(buf, o.CRC32) idx.CRC32[bucket] = append(idx.CRC32[bucket], buf.Bytes()...) } -- cgit