diff --git a/hvsock_test.go b/hvsock_test.go index f492f47f..366062be 100644 --- a/hvsock_test.go +++ b/hvsock_test.go @@ -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) { diff --git a/wim/lzx/lzx.go b/wim/lzx/lzx.go index e5db8260..52ab6151 100644 --- a/wim/lzx/lzx.go +++ b/wim/lzx/lzx.go @@ -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) @@ -153,28 +153,28 @@ 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< 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<> (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 } }