shithub: furgit

Download patch

ref: 5b7b35ea3ad3901a495ff378b6bfdd7d64f2ed67
parent: 3c26f0a4e36d8d597dc25e12eb40e9ef35a098ae
author: Runxi Yu <me@runxiyu.org>
date: Sat Mar 7 21:30:36 EST 2026

internal/compress: Remove InputConsumed/Progress

--- a/internal/compress/flate/inflate.go
+++ b/internal/compress/flate/inflate.go
@@ -288,14 +288,6 @@
 	io.ByteReader
 }
 
-// InputProgress reports compressed input bytes consumed by inflate state.
-//
-// InputConsumed returns bytes that have been consumed by the decompressor's
-// parser and state machine, not bytes merely read ahead from the source.
-type InputProgress interface {
-	InputConsumed() int64
-}
-
 type step uint8
 
 const (
@@ -352,11 +344,6 @@
 	final bool
 
 	flushMode flushMode
-}
-
-// InputConsumed returns compressed input bytes consumed by receiver.
-func (f *decompressor) InputConsumed() int64 {
-	return f.roffset
 }
 
 func (f *decompressor) nextBlock() {
--- a/internal/compress/zlib/reader.go
+++ b/internal/compress/zlib/reader.go
@@ -73,7 +73,6 @@
 type Reader struct {
 	r            flate.Reader
 	decompressor io.ReadCloser
-	progress     flate.InputProgress
 	digest       hash.Hash32
 	headerRead   uint64
 	trailerRead  uint64
@@ -161,24 +160,6 @@
 	}
 
 	return n, io.EOF
-}
-
-// InputConsumed returns compressed bytes consumed from stream input.
-//
-// This count includes the zlib header, deflate payload, and zlib checksum
-// trailer bytes read by the reader.
-func (z *Reader) InputConsumed() uint64 {
-	out := z.headerRead + z.trailerRead
-	if z.progress != nil {
-		progressIn, err := intconv.Int64ToUint64(z.progress.InputConsumed())
-		if err != nil {
-			panic(err)
-		}
-
-		out += progressIn
-	}
-
-	return out
 }
 
 // Close does not close the wrapped [io.Reader] originally passed to [NewReader].
--- a/internal/compress/zlib/reader_reset.go
+++ b/internal/compress/zlib/reader_reset.go
@@ -95,13 +95,6 @@
 			return z.err
 		}
 
-		progress, ok := z.decompressor.(flate.InputProgress)
-		if !ok {
-			panic("zlib: pooled decompressor does not implement flate.InputProgress")
-		}
-
-		z.progress = progress
-
 		z.digest = adler32.New()
 
 		return nil
@@ -112,13 +105,6 @@
 	} else {
 		z.decompressor = flate.NewReader(z.r)
 	}
-
-	progress, ok := z.decompressor.(flate.InputProgress)
-	if !ok {
-		panic("zlib: decompressor does not implement flate.InputProgress")
-	}
-
-	z.progress = progress
 
 	z.digest = adler32.New()
 
--