Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions bitswap/benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,7 @@ func unixfsFileFetchLarge(b *testing.B, bs *bitswap.Bitswap, ks []cid.Cid) {
for len(rest) > 0 {
var batch [][]cid.Cid
for i := 0; i < 5 && len(rest) > 0; i++ {
cnt := 10
if len(rest) < 10 {
cnt = len(rest)
}
cnt := min(len(rest), 10)
group := rest[:cnt]
rest = rest[cnt:]
batch = append(batch, group)
Expand Down
5 changes: 1 addition & 4 deletions gateway/backend_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,7 @@
if err != nil {
return err
}
from = fileLength + entityRange.From
if from < 0 {
from = 0
}
from = max(fileLength+entityRange.From, 0)

Check warning on line 506 in gateway/backend_blocks.go

View check run for this annotation

Codecov / codecov/patch

gateway/backend_blocks.go#L506

Added line #L506 was not covered by tests
foundFileLength = true
}

Expand Down
6 changes: 2 additions & 4 deletions ipld/merkledag/coding.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@ func (n *ProtoNode) marshalImmutable() (*immutableProtoNode, error) {
qp.ListEntry(la, qp.Map(3, func(ma ipld.MapAssembler) {
qp.MapEntry(ma, "Hash", qp.Link(cidlink.Link{Cid: link.Cid}))
qp.MapEntry(ma, "Name", qp.String(link.Name))
sz := int64(link.Size)
if sz < 0 { // overflow, >MaxInt64 is almost certainly an error
sz = 0
}
// overflow, >MaxInt64 is almost certainly an error
sz := max(int64(link.Size), 0)
qp.MapEntry(ma, "Tsize", qp.Int(sz))
}))
}
Expand Down
Loading