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

Delta Between Two Patch Sets: src/pkg/compress/flate/inflate.go

Issue 7712044: code review 7712044: all: remove now-unnecessary unreachable panics (Closed)
Left Patch Set: Created 12 years ago
Right Patch Set: diff -r 6db3ee1a6ff3 https://go.googlecode.com/hg/ Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/compress/flate/deflate_test.go ('k') | src/pkg/compress/flate/token.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Package flate implements the DEFLATE compressed data format, described in 5 // Package flate implements the DEFLATE compressed data format, described in
6 // RFC 1951. The gzip and zlib packages implement access to DEFLATE-based file 6 // RFC 1951. The gzip and zlib packages implement access to DEFLATE-based file
7 // formats. 7 // formats.
8 package flate 8 package flate
9 9
10 import ( 10 import (
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 if len(f.toRead) > 0 { 256 if len(f.toRead) > 0 {
257 n := copy(b, f.toRead) 257 n := copy(b, f.toRead)
258 f.toRead = f.toRead[n:] 258 f.toRead = f.toRead[n:]
259 return n, nil 259 return n, nil
260 } 260 }
261 if f.err != nil { 261 if f.err != nil {
262 return 0, f.err 262 return 0, f.err
263 } 263 }
264 f.step(f) 264 f.step(f)
265 } 265 }
266 panic("unreachable")
267 } 266 }
268 267
269 func (f *decompressor) Close() error { 268 func (f *decompressor) Close() error {
270 if f.err == io.EOF { 269 if f.err == io.EOF {
271 return nil 270 return nil
272 } 271 }
273 return f.err 272 return f.err
274 } 273 }
275 274
276 // RFC 1951 section 3.2.7. 275 // RFC 1951 section 3.2.7.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if !f.hfull && dist > f.hp { 487 if !f.hfull && dist > f.hp {
489 f.err = CorruptInputError(f.roffset) 488 f.err = CorruptInputError(f.roffset)
490 return 489 return
491 } 490 }
492 491
493 f.copyLen, f.copyDist = length, dist 492 f.copyLen, f.copyDist = length, dist
494 if f.copyHist() { 493 if f.copyHist() {
495 return 494 return
496 } 495 }
497 } 496 }
498 panic("unreached")
499 } 497 }
500 498
501 // copyHist copies f.copyLen bytes from f.hist (f.copyDist bytes ago) to itself. 499 // copyHist copies f.copyLen bytes from f.hist (f.copyDist bytes ago) to itself.
502 // It reports whether the f.hist buffer is full. 500 // It reports whether the f.hist buffer is full.
503 func (f *decompressor) copyHist() bool { 501 func (f *decompressor) copyHist() bool {
504 p := f.hp - f.copyDist 502 p := f.hp - f.copyDist
505 if p < 0 { 503 if p < 0 {
506 p += len(f.hist) 504 p += len(f.hist)
507 } 505 }
508 for f.copyLen > 0 { 506 for f.copyLen > 0 {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 func NewReaderDict(r io.Reader, dict []byte) io.ReadCloser { 685 func NewReaderDict(r io.Reader, dict []byte) io.ReadCloser {
688 var f decompressor 686 var f decompressor
689 f.r = makeReader(r) 687 f.r = makeReader(r)
690 f.hist = new([maxHist]byte) 688 f.hist = new([maxHist]byte)
691 f.bits = new([maxLit + maxDist]int) 689 f.bits = new([maxLit + maxDist]int)
692 f.codebits = new([numCodes]int) 690 f.codebits = new([numCodes]int)
693 f.step = (*decompressor).nextBlock 691 f.step = (*decompressor).nextBlock
694 f.setDict(dict) 692 f.setDict(dict)
695 return &f 693 return &f
696 } 694 }
LEFTRIGHT

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