8000 删除无用操作、取消重复判断、代码风格统一 by heisen-li · Pull Request #1 · MabinGo/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

删除无用操作、取消重复判断、代码风格统一 #1

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

Open
wants to merge 2 commits into
base: master
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
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
0