mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 06:38:37 -04:00 
			
		
		
		
	Macaron 1.5 (#12596)
* update macaron to v1.5 of fork * update macaron to v1.5 of fork * test gzip PR * add push method impl to context_tests * use proper gzip commit Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		
							
								
								
									
										10
									
								
								vendor/github.com/klauspost/compress/huff0/compress.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/klauspost/compress/huff0/compress.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -77,8 +77,11 @@ func compress(in []byte, s *Scratch, compressor func(src []byte) ([]byte, error) | ||||
| 		// Each symbol present maximum once or too well distributed. | ||||
| 		return nil, false, ErrIncompressible | ||||
| 	} | ||||
|  | ||||
| 	if s.Reuse == ReusePolicyPrefer && canReuse { | ||||
| 	if s.Reuse == ReusePolicyMust && !canReuse { | ||||
| 		// We must reuse, but we can't. | ||||
| 		return nil, false, ErrIncompressible | ||||
| 	} | ||||
| 	if (s.Reuse == ReusePolicyPrefer || s.Reuse == ReusePolicyMust) && canReuse { | ||||
| 		keepTable := s.cTable | ||||
| 		keepTL := s.actualTableLog | ||||
| 		s.cTable = s.prevTable | ||||
| @@ -90,6 +93,9 @@ func compress(in []byte, s *Scratch, compressor func(src []byte) ([]byte, error) | ||||
| 			s.OutData = s.Out | ||||
| 			return s.Out, true, nil | ||||
| 		} | ||||
| 		if s.Reuse == ReusePolicyMust { | ||||
| 			return nil, false, ErrIncompressible | ||||
| 		} | ||||
| 		// Do not attempt to re-use later. | ||||
| 		s.prevTable = s.prevTable[:0] | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user