aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-19 08:00:00 +0800
committerGravatar Runxi Yu2025-11-19 08:00:00 +0800
commited0a113f034aa42aea23471c4bc0d7af159b7002 (patch)
tree7e828011b9e213499ce382eb17e2552da6e48de4
parentRemove some redundant code (diff)
signatureNo signature
Probably should name the custom packages specially
-rw-r--r--internal/flatex/LICENSE (renamed from internal/flate/LICENSE)0
-rw-r--r--internal/flatex/decompress_bytes.go (renamed from internal/flate/decompress_bytes.go)2
-rw-r--r--internal/flatex/decompress_test.go (renamed from internal/flate/decompress_test.go)2
-rw-r--r--internal/flatex/dict_decoder.go (renamed from internal/flate/dict_decoder.go)2
-rw-r--r--internal/flatex/inflate.go (renamed from internal/flate/inflate.go)4
-rw-r--r--internal/flatex/slice_inflate.go (renamed from internal/flate/slice_inflate.go)2
-rw-r--r--internal/zlibx/LICENSE (renamed from internal/zlib/LICENSE)0
-rw-r--r--internal/zlibx/decompress.go (renamed from internal/zlib/decompress.go)6
-rw-r--r--internal/zlibx/decompress_test.go (renamed from internal/zlib/decompress_test.go)2
-rw-r--r--internal/zlibx/reader.go (renamed from internal/zlib/reader.go)14
-rw-r--r--loose.go10
-rw-r--r--pack_pack.go5
12 files changed, 24 insertions, 25 deletions
diff --git a/internal/flate/LICENSE b/internal/flatex/LICENSE
index 2a7cf70d..2a7cf70d 100644
--- a/internal/flate/LICENSE
+++ b/internal/flatex/LICENSE
diff --git a/internal/flate/decompress_bytes.go b/internal/flatex/decompress_bytes.go
index 18fe21fc..5a660b0a 100644
--- a/internal/flate/decompress_bytes.go
+++ b/internal/flatex/decompress_bytes.go
@@ -1,4 +1,4 @@
-package flate
+package flatex
import (
"io"
diff --git a/internal/flate/decompress_test.go b/internal/flatex/decompress_test.go
index 089159d6..afb84292 100644
--- a/internal/flate/decompress_test.go
+++ b/internal/flatex/decompress_test.go
@@ -1,4 +1,4 @@
-package flate
+package flatex
import (
"bytes"
diff --git a/internal/flate/dict_decoder.go b/internal/flatex/dict_decoder.go
index d2c19040..7a81e640 100644
--- a/internal/flate/dict_decoder.go
+++ b/internal/flatex/dict_decoder.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package flate
+package flatex
// dictDecoder implements the LZ77 sliding dictionary as used in decompression.
// LZ77 decompresses data through sequences of two forms of commands:
diff --git a/internal/flate/inflate.go b/internal/flatex/inflate.go
index cfcff084..5e9d861e 100644
--- a/internal/flate/inflate.go
+++ b/internal/flatex/inflate.go
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package flate implements the DEFLATE compressed data format, described in
+// Package flatex implements the DEFLATE compressed data format, described in
// RFC 1951. The [compress/gzip] and [compress/zlib] packages implement access
// to DEFLATE-based file formats.
-package flate
+package flatex
import (
"bufio"
diff --git a/internal/flate/slice_inflate.go b/internal/flatex/slice_inflate.go
index 0df4ed45..9ece08f4 100644
--- a/internal/flate/slice_inflate.go
+++ b/internal/flatex/slice_inflate.go
@@ -1,4 +1,4 @@
-package flate
+package flatex
import (
"io"
diff --git a/internal/zlib/LICENSE b/internal/zlibx/LICENSE
index 2a7cf70d..2a7cf70d 100644
--- a/internal/zlib/LICENSE
+++ b/internal/zlibx/LICENSE
diff --git a/internal/zlib/decompress.go b/internal/zlibx/decompress.go
index 55f6d3e2..34e62c6f 100644
--- a/internal/zlib/decompress.go
+++ b/internal/zlibx/decompress.go
@@ -1,4 +1,4 @@
-package zlib
+package zlibx
import (
"encoding/binary"
@@ -6,7 +6,7 @@ import (
"git.sr.ht/~runxiyu/furgit/internal/adler32"
"git.sr.ht/~runxiyu/furgit/internal/bufpool"
- "git.sr.ht/~runxiyu/furgit/internal/flate"
+ "git.sr.ht/~runxiyu/furgit/internal/flatex"
)
// Decompress inflates the provided zlib wrapped stream and returns the
@@ -50,7 +50,7 @@ func DecompressDict(src []byte, dict []byte) (bufpool.Buffer, error) {
}
deflateData := src[offset:]
- out, consumed, err := flate.DecompressDict(deflateData, dict)
+ out, consumed, err := flatex.DecompressDict(deflateData, dict)
if err != nil {
return bufpool.Buffer{}, err
}
diff --git a/internal/zlib/decompress_test.go b/internal/zlibx/decompress_test.go
index bb517ae6..a4e9c608 100644
--- a/internal/zlib/decompress_test.go
+++ b/internal/zlibx/decompress_test.go
@@ -1,4 +1,4 @@
-package zlib
+package zlibx
import (
"bytes"
diff --git a/internal/zlib/reader.go b/internal/zlibx/reader.go
index 2c8fd215..80bbbb58 100644
--- a/internal/zlib/reader.go
+++ b/internal/zlibx/reader.go
@@ -30,7 +30,7 @@ and to read that data back:
io.Copy(os.Stdout, r)
r.Close()
*/
-package zlib
+package zlibx
import (
"bufio"
@@ -41,7 +41,7 @@ import (
"sync"
"git.sr.ht/~runxiyu/furgit/internal/adler32"
- "git.sr.ht/~runxiyu/furgit/internal/flate"
+ "git.sr.ht/~runxiyu/furgit/internal/flatex"
)
const (
@@ -66,7 +66,7 @@ var pool = sync.Pool{
}
type reader struct {
- r flate.Reader
+ r flatex.Reader
decompressor io.ReadCloser
digest hash.Hash32
err error
@@ -146,7 +146,7 @@ func (z *reader) Close() error {
func (z *reader) Reset(r io.Reader, dict []byte) error {
*z = reader{decompressor: z.decompressor}
- if fr, ok := r.(flate.Reader); ok {
+ if fr, ok := r.(flatex.Reader); ok {
z.r = fr
} else {
z.r = bufio.NewReader(r)
@@ -183,12 +183,12 @@ func (z *reader) Reset(r io.Reader, dict []byte) error {
if z.decompressor == nil {
if haveDict {
- z.decompressor = flate.NewReaderDict(z.r, dict)
+ z.decompressor = flatex.NewReaderDict(z.r, dict)
} else {
- z.decompressor = flate.NewReader(z.r)
+ z.decompressor = flatex.NewReader(z.r)
}
} else {
- z.err = z.decompressor.(flate.Resetter).Reset(z.r, dict)
+ z.err = z.decompressor.(flatex.Resetter).Reset(z.r, dict)
if z.err != nil {
return z.err
}
diff --git a/loose.go b/loose.go
index 207a5abe..9ed14f2e 100644
--- a/loose.go
+++ b/loose.go
@@ -2,7 +2,7 @@ package furgit
import (
"bytes"
- stdzlib "compress/zlib"
+ "compress/zlib"
"fmt"
"io"
"os"
@@ -10,7 +10,7 @@ import (
"strconv"
"git.sr.ht/~runxiyu/furgit/internal/bufpool"
- "git.sr.ht/~runxiyu/furgit/internal/zlib"
+ "git.sr.ht/~runxiyu/furgit/internal/zlibx"
)
const looseHeaderLimit = 4096
@@ -54,7 +54,7 @@ func (repo *Repository) looseReadTyped(id Hash) (ObjectType, bufpool.Buffer, err
return ObjectTypeInvalid, bufpool.Buffer{}, err
}
- raw, err := zlib.Decompress(compressed)
+ raw, err := zlibx.Decompress(compressed)
if err != nil {
return ObjectTypeInvalid, bufpool.Buffer{}, err
}
@@ -104,7 +104,7 @@ func (repo *Repository) looseTypeSize(id Hash) (ObjectType, int64, error) {
}
defer func() { _ = f.Close() }()
- zr, err := stdzlib.NewReader(f)
+ zr, err := zlib.NewReader(f)
if err != nil {
return ObjectTypeInvalid, 0, err
}
@@ -211,7 +211,7 @@ func (repo *Repository) WriteLooseObject(obj Object) (Hash, error) {
}
var buf bytes.Buffer
- zw := stdzlib.NewWriter(&buf)
+ zw := zlib.NewWriter(&buf)
if _, err := zw.Write(raw); err != nil {
return Hash{}, err
}
diff --git a/pack_pack.go b/pack_pack.go
index 5d0f13ac..2f9cd513 100644
--- a/pack_pack.go
+++ b/pack_pack.go
@@ -11,9 +11,8 @@ import (
"sync"
"syscall"
- "git.sr.ht/~runxiyu/furgit/internal/zlib"
-
"git.sr.ht/~runxiyu/furgit/internal/bufpool"
+ "git.sr.ht/~runxiyu/furgit/internal/zlibx"
)
const (
@@ -127,7 +126,7 @@ func packSectionInflate(pf *packFile, objectOfs uint64, r *bytes.Reader, sizeHin
if int64(consumed) < 0 || start > uint64(len(pf.data)) {
return bufpool.Buffer{}, ErrInvalidObject
}
- body, err := zlib.Decompress(pf.data[start:])
+ body, err := zlibx.Decompress(pf.data[start:])
if err != nil {
return bufpool.Buffer{}, err
}