Skip to content
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
10 changes: 4 additions & 6 deletions src/compress/flate/deflate.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,6 @@ Loop:
if !d.sync {
break Loop
}
if d.index > d.windowEnd {
panic("index > windowEnd")
}
if lookahead == 0 {
// Flush current output block if any.
if d.byteAvailable {
Expand Down Expand Up @@ -527,10 +524,11 @@ func (d *compressor) fillStore(b []byte) int {
}

func (d *compressor) store() {
if d.windowEnd > 0 && (d.windowEnd == maxStoreBlockSize || d.sync) {
d.err = d.writeStoredBlock(d.window[:d.windowEnd])
d.windowEnd = 0
if !d.sync || d.windowEnd == 0 && d.windowEnd < maxStoreBlockSize {
return
}
d.err = d.writeStoredBlock(d.window[:d.windowEnd])
d.windowEnd = 0
}

// storeHuff compresses and stores the currently added data
Expand Down
3 changes: 0 additions & 3 deletions src/compress/flate/huffman_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,9 @@ func (h *huffmanEncoder) generate(freq []int32, maxBits int32) {
list[count] = literalNode{uint16(i), f}
count++
} else {
list[count] = literalNode{}
h.codes[i].len = 0
}
}
list[len(freq)] = literalNode{}

list = list[:count]
if count <= 2 {
// Handle the small cases here, because they are awkward for the general case code. With
Expand Down