Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(288)

Unified Diff: src/pkg/archive/zip/reader.go

Issue 12421043: code review 12421043: archive/zip: allow user-extensible compression methods
Patch Set: diff -r 7500ec6996b7 http://go.googlecode.com/hg/ Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/pkg/archive/zip/register.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/archive/zip/reader.go
===================================================================
--- a/src/pkg/archive/zip/reader.go
+++ b/src/pkg/archive/zip/reader.go
@@ -6,13 +6,11 @@
import (
"bufio"
- "compress/flate"
"encoding/binary"
"errors"
"hash"
"hash/crc32"
"io"
- "io/ioutil"
"os"
)
@@ -125,15 +123,12 @@
}
size := int64(f.CompressedSize64)
r := io.NewSectionReader(f.zipr, f.headerOffset+bodyOffset, size)
- switch f.Method {
- case Store: // (no compression)
- rc = ioutil.NopCloser(r)
- case Deflate:
- rc = flate.NewReader(r)
- default:
+ dcomp := decompressor(f.Method)
+ if dcomp == nil {
err = ErrAlgorithm
return
}
+ rc = dcomp(r)
var desr io.Reader
if f.hasDataDescriptor() {
desr = io.NewSectionReader(f.zipr, f.headerOffset+bodyOffset+size, dataDescriptorLen)
« no previous file with comments | « no previous file | src/pkg/archive/zip/register.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b