Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix linting issues #325

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion hvsock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ func (u testUtil) Assert(b bool, msgs ...string) {
return
}
u.T.Helper()
u.T.Fatalf(msgJoin(msgs, "failed assertion"))
u.T.Fatal(msgJoin(msgs, "failed assertion"))
}

func (u testUtil) Is(err, target error, msgs ...string) {
Expand Down
24 changes: 12 additions & 12 deletions wim/lzx/lzx.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (f *decompressor) ensureAtLeast(n int) error {
}
n, err := io.ReadAtLeast(f.r, f.b[f.bv-f.bo:], n)
if err != nil {
if err == io.EOF { //nolint:errorlint
if err == io.EOF {
err = io.ErrUnexpectedEOF
} else {
f.fail(err)
Expand Down Expand Up @@ -153,43 +153,43 @@ func buildTable(codelens []byte) *huffman {
// Determine the number of codes of each length, and the
// maximum length.
var count [maxTreePathLen + 1]uint
var max byte
var clMax byte
for _, cl := range codelens {
count[cl]++
if max < cl {
max = cl
if clMax < cl {
clMax = cl
}
}

if max == 0 {
if clMax == 0 {
return &huffman{}
}

// Determine the first code of each length.
var first [maxTreePathLen + 1]uint
code := uint(0)
for i := byte(1); i <= max; i++ {
for i := byte(1); i <= clMax; i++ {
code <<= 1
first[i] = code
code += count[i]
}

if code != 1<<max {
if code != 1<<clMax {
return nil
}

// Build a table for code lookup. For code sizes < max,
// put all possible suffixes for the code into the table, too.
// For max > tablebits, split long codes into additional tables
// of suffixes of max-tablebits length.
h := &huffman{maxbits: max}
if max > tablebits {
h := &huffman{maxbits: clMax}
if clMax > tablebits {
core := first[tablebits+1] / 2 // Number of codes that fit without extra tables
nextra := 1<<tablebits - core // Number of extra entries
h.extra = make([][]uint16, nextra)
for code := core; code < 1<<tablebits; code++ {
h.table[code] = uint16(code - core)
h.extra[code-core] = make([]uint16, 1<<(max-tablebits))
h.extra[code-core] = make([]uint16, 1<<(clMax-tablebits))
}
}

Expand All @@ -206,8 +206,8 @@ func buildTable(codelens []byte) *huffman {
} else {
prefix := code >> (cl - tablebits)
suffix := code & (1<<(cl-tablebits) - 1)
extendedCode := suffix << (max - cl)
for j := uint(0); j < 1<<(max-cl); j++ {
extendedCode := suffix << (clMax - cl)
for j := uint(0); j < 1<<(clMax-cl); j++ {
h.extra[h.table[prefix]][extendedCode+j] = v
}
}
Expand Down
Loading