aboutsummaryrefslogtreecommitdiffstats
path: root/modules/util
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2023-04-29 01:06:41 +0300
committerGitHub <noreply@github.com>2023-04-28 18:06:41 -0400
commitc0ddec8a2a4cd348462257e0ceb253daf5692c32 (patch)
tree6fd2e68d8d3b874576fdd6a2c7a4a4681bef6c98 /modules/util
parentbf77e2163b670797d5bf7199da88789968e47c61 (diff)
downloadgitea-c0ddec8a2a4cd348462257e0ceb253daf5692c32.tar.gz
gitea-c0ddec8a2a4cd348462257e0ceb253daf5692c32.zip
Revert "Add Debian package registry" (#24412)
Reverts go-gitea/gitea#22854
Diffstat (limited to 'modules/util')
-rw-r--r--modules/util/filebuffer/file_backed_buffer.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/util/filebuffer/file_backed_buffer.go b/modules/util/filebuffer/file_backed_buffer.go
index 6b07bd0413..bfddf90e92 100644
--- a/modules/util/filebuffer/file_backed_buffer.go
+++ b/modules/util/filebuffer/file_backed_buffer.go
@@ -7,10 +7,11 @@ import (
"bytes"
"errors"
"io"
- "math"
"os"
)
+const maxInt = int(^uint(0) >> 1) // taken from bytes.Buffer
+
var (
// ErrInvalidMemorySize occurs if the memory size is not in a valid range
ErrInvalidMemorySize = errors.New("Memory size must be greater 0 and lower math.MaxInt32")
@@ -36,7 +37,7 @@ type FileBackedBuffer struct {
// New creates a file backed buffer with a specific maximum memory size
func New(maxMemorySize int) (*FileBackedBuffer, error) {
- if maxMemorySize < 0 || maxMemorySize > math.MaxInt32 {
+ if maxMemorySize < 0 || maxMemorySize > maxInt {
return nil, ErrInvalidMemorySize
}