mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 13:28:25 +00:00 
			
		
		
		
	go1.16 (#14783)
This commit is contained in:
		
							
								
								
									
										4
									
								
								vendor/github.com/pierrec/lz4/v4/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/pierrec/lz4/v4/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -31,4 +31,6 @@ Temporary Items
 | 
			
		||||
# End of https://www.gitignore.io/api/macos
 | 
			
		||||
 | 
			
		||||
cmd/*/*exe
 | 
			
		||||
.idea
 | 
			
		||||
.idea
 | 
			
		||||
 | 
			
		||||
fuzz/*.zip
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								vendor/github.com/pierrec/lz4/v4/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/github.com/pierrec/lz4/v4/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,19 +0,0 @@
 | 
			
		||||
language: go
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  - GO111MODULE=off
 | 
			
		||||
 | 
			
		||||
go:
 | 
			
		||||
  - 1.13.x
 | 
			
		||||
  - 1.14.x
 | 
			
		||||
 | 
			
		||||
matrix:
 | 
			
		||||
 fast_finish: true
 | 
			
		||||
 | 
			
		||||
sudo: false
 | 
			
		||||
 | 
			
		||||
script: 
 | 
			
		||||
 - go test -v -cpu=2
 | 
			
		||||
 - go test -v -cpu=2 -race
 | 
			
		||||
 - go test -v -cpu=2 -tags noasm
 | 
			
		||||
 - go test -v -cpu=2 -race -tags noasm
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/pierrec/lz4/v4/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/pierrec/lz4/v4/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
# lz4 : LZ4 compression in pure Go
 | 
			
		||||
 | 
			
		||||
[](https://godoc.org/github.com/pierrec/lz4)
 | 
			
		||||
[](https://travis-ci.org/pierrec/lz4)
 | 
			
		||||
[](https://pkg.go.dev/github.com/pierrec/lz4/v4)
 | 
			
		||||
[](https://github.com/pierrec/lz4/actions)
 | 
			
		||||
[](https://goreportcard.com/report/github.com/pierrec/lz4)
 | 
			
		||||
[](https://github.com/pierrec/lz4/tags)
 | 
			
		||||
 | 
			
		||||
@@ -15,13 +15,13 @@ The implementation is based on the reference C [one](https://github.com/lz4/lz4)
 | 
			
		||||
Assuming you have the go toolchain installed:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
go get github.com/pierrec/lz4
 | 
			
		||||
go get github.com/pierrec/lz4/v4
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
There is a command line interface tool to compress and decompress LZ4 files.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
go install github.com/pierrec/lz4/cmd/lz4c
 | 
			
		||||
go install github.com/pierrec/lz4/v4/cmd/lz4c
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Usage
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								vendor/github.com/pierrec/lz4/v4/go.sum
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/pierrec/lz4/v4/go.sum
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,3 +0,0 @@
 | 
			
		||||
github.com/pierrec/lz4 v1.0.1 h1:w6GMGWSsCI04fTM8wQRdnW74MuJISakuUU0onU0TYB4=
 | 
			
		||||
github.com/pierrec/lz4 v2.6.0+incompatible h1:Ix9yFKn1nSPBLFl/yZknTp8TU5G4Ps0JDmguYK6iH1A=
 | 
			
		||||
github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_arm.s
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_arm.s
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -140,25 +140,22 @@ readMatchlenLoop:
 | 
			
		||||
	BEQ     readMatchlenLoop
 | 
			
		||||
 | 
			
		||||
readMatchlenDone:
 | 
			
		||||
	ADD minMatch, len
 | 
			
		||||
 | 
			
		||||
	// Bounds check dst+len and match = dst-offset.
 | 
			
		||||
	// Bounds check dst+len+minMatch and match = dst-offset.
 | 
			
		||||
	ADD    dst, len, tmp1
 | 
			
		||||
	ADD    minMatch, tmp1
 | 
			
		||||
	CMP    dstend, tmp1
 | 
			
		||||
	//BHI  shortDst	// Uncomment for distinct error codes.
 | 
			
		||||
	SUB    offset, dst, match
 | 
			
		||||
	CMP.LS match, dstorig
 | 
			
		||||
	BHI    corrupt
 | 
			
		||||
 | 
			
		||||
	// If the offset is at least four (len is, because of minMatch),
 | 
			
		||||
	// do a four-way unrolled byte copy loop. Using MOVD instead of four
 | 
			
		||||
	// byte loads is much faster, but to remain portable we'd have to
 | 
			
		||||
	// align match first, which in turn is too expensive.
 | 
			
		||||
	CMP $4, offset
 | 
			
		||||
	BLO copyMatch
 | 
			
		||||
 | 
			
		||||
	SUB $4, len
 | 
			
		||||
	// Since len+minMatch is at least four, we can do a 4× unrolled
 | 
			
		||||
	// byte copy loop. Using MOVW instead of four byte loads is faster,
 | 
			
		||||
	// but to remain portable we'd have to align match first, which is
 | 
			
		||||
	// too expensive. By alternating loads and stores, we also handle
 | 
			
		||||
	// the case offset < 4.
 | 
			
		||||
copyMatch4:
 | 
			
		||||
	SUB.S   $4, len
 | 
			
		||||
	MOVBU.P 4(match), tmp1
 | 
			
		||||
	MOVB.P  tmp1, 4(dst)
 | 
			
		||||
	MOVBU   -3(match), tmp2
 | 
			
		||||
@@ -167,7 +164,6 @@ copyMatch4:
 | 
			
		||||
	MOVB    tmp3, -2(dst)
 | 
			
		||||
	MOVBU   -1(match), tmp1
 | 
			
		||||
	MOVB    tmp1, -1(dst)
 | 
			
		||||
	SUB.S   $4, len
 | 
			
		||||
	BPL     copyMatch4
 | 
			
		||||
 | 
			
		||||
	// Restore len, which is now negative.
 | 
			
		||||
@@ -175,7 +171,7 @@ copyMatch4:
 | 
			
		||||
	BEQ   copyMatchDone
 | 
			
		||||
 | 
			
		||||
copyMatch:
 | 
			
		||||
	// Simple byte-at-a-time copy.
 | 
			
		||||
	// Finish with a byte-at-a-time copy.
 | 
			
		||||
	SUB.S   $1, len
 | 
			
		||||
	MOVBU.P 1(match), tmp2
 | 
			
		||||
	MOVB.P  tmp2, 1(dst)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,7 +2,13 @@
 | 
			
		||||
 | 
			
		||||
package lz4block
 | 
			
		||||
 | 
			
		||||
import "encoding/binary"
 | 
			
		||||
 | 
			
		||||
func decodeBlock(dst, src []byte) (ret int) {
 | 
			
		||||
	// Restrict capacities so we don't read or write out of bounds.
 | 
			
		||||
	dst = dst[:len(dst):len(dst)]
 | 
			
		||||
	src = src[:len(src):len(src)]
 | 
			
		||||
 | 
			
		||||
	const hasError = -2
 | 
			
		||||
	defer func() {
 | 
			
		||||
		if recover() != nil {
 | 
			
		||||
@@ -32,7 +38,7 @@ func decodeBlock(dst, src []byte) (ret int) {
 | 
			
		||||
					// if the match length (4..18) fits within the literals, then copy
 | 
			
		||||
					// all 18 bytes, even if not all are part of the literals.
 | 
			
		||||
					mLen += 4
 | 
			
		||||
					if offset := uint(src[si]) | uint(src[si+1])<<8; mLen <= offset {
 | 
			
		||||
					if offset := u16(src[si:]); mLen <= offset {
 | 
			
		||||
						i := di - offset
 | 
			
		||||
						end := i + 18
 | 
			
		||||
						if end > uint(len(dst)) {
 | 
			
		||||
@@ -66,7 +72,7 @@ func decodeBlock(dst, src []byte) (ret int) {
 | 
			
		||||
			return hasError
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		offset := uint(src[si]) | uint(src[si+1])<<8
 | 
			
		||||
		offset := u16(src[si:])
 | 
			
		||||
		if offset == 0 {
 | 
			
		||||
			return hasError
 | 
			
		||||
		}
 | 
			
		||||
@@ -98,3 +104,5 @@ func decodeBlock(dst, src []byte) (ret int) {
 | 
			
		||||
		di += uint(copy(dst[di:di+mLen], expanded[:mLen]))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func u16(p []byte) uint { return uint(binary.LittleEndian.Uint16(p)) }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/pierrec/lz4/v4/internal/lz4stream/block.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/pierrec/lz4/v4/internal/lz4stream/block.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -67,8 +67,9 @@ func (b *Blocks) close(f *Frame, num int) error {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if b.Blocks == nil {
 | 
			
		||||
		// Not initialized yet.
 | 
			
		||||
		return nil
 | 
			
		||||
		err := b.err
 | 
			
		||||
		b.err = nil
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	c := make(chan *FrameDataBlock)
 | 
			
		||||
	b.Blocks <- c
 | 
			
		||||
@@ -114,15 +115,18 @@ func (b *Blocks) initR(f *Frame, num int, src io.Reader) (chan []byte, error) {
 | 
			
		||||
			block := NewFrameDataBlock(f)
 | 
			
		||||
			cumx, err = block.Read(f, src, 0)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				block.Close(f)
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
			// Recheck for an error as reading may be slow and uncompressing is expensive.
 | 
			
		||||
			if b.ErrorR() != nil {
 | 
			
		||||
				block.Close(f)
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
			c := make(chan []byte)
 | 
			
		||||
			blocks <- c
 | 
			
		||||
			go func() {
 | 
			
		||||
				defer block.Close(f)
 | 
			
		||||
				data, err := block.Uncompress(f, size.Get(), false)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					b.closeR(err)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user