mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-03-12 00:12:37 +01:00
chore: Remove LimitedReaderCloser
- Introduced in511f6138d4
and removed in270aab429e
.
This commit is contained in:
parent
b7b52fd04d
commit
c4b2352c6c
2 changed files with 0 additions and 29 deletions
|
@ -119,8 +119,6 @@ code.gitea.io/gitea/modules/git
|
||||||
openRepositoryWithDefaultContext
|
openRepositoryWithDefaultContext
|
||||||
IsTagExist
|
IsTagExist
|
||||||
ToEntryMode
|
ToEntryMode
|
||||||
LimitedReaderCloser.Read
|
|
||||||
LimitedReaderCloser.Close
|
|
||||||
|
|
||||||
code.gitea.io/gitea/modules/gitgraph
|
code.gitea.io/gitea/modules/gitgraph
|
||||||
Parser.Reset
|
Parser.Reset
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -105,32 +104,6 @@ func ParseBool(value string) (result, valid bool) {
|
||||||
return intValue != 0, true
|
return intValue != 0, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// LimitedReaderCloser is a limited reader closer
|
|
||||||
type LimitedReaderCloser struct {
|
|
||||||
R io.Reader
|
|
||||||
C io.Closer
|
|
||||||
N int64
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read implements io.Reader
|
|
||||||
func (l *LimitedReaderCloser) Read(p []byte) (n int, err error) {
|
|
||||||
if l.N <= 0 {
|
|
||||||
_ = l.C.Close()
|
|
||||||
return 0, io.EOF
|
|
||||||
}
|
|
||||||
if int64(len(p)) > l.N {
|
|
||||||
p = p[0:l.N]
|
|
||||||
}
|
|
||||||
n, err = l.R.Read(p)
|
|
||||||
l.N -= int64(n)
|
|
||||||
return n, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close implements io.Closer
|
|
||||||
func (l *LimitedReaderCloser) Close() error {
|
|
||||||
return l.C.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
func HashFilePathForWebUI(s string) string {
|
func HashFilePathForWebUI(s string) string {
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
_, _ = h.Write([]byte(s))
|
_, _ = h.Write([]byte(s))
|
||||||
|
|
Loading…
Add table
Reference in a new issue