mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-11-03 18:32:25 -06:00 
			
		
		
		
	[chore] update dependencies, bump to Go 1.19.1 (#826)
* update dependencies, bump Go version to 1.19 * bump test image Go version * update golangci-lint * update gotosocial-drone-build * sign * linting, go fmt * update swagger docs * update swagger docs * whitespace * update contributing.md * fuckin whoopsie doopsie * linterino, linteroni * fix followrequest test not starting processor * fix other api/client tests not starting processor * fix remaining tests where processor not started * bump go-runners version * don't check last-webfingered-at, processor may have updated this * update swagger command * update bun to latest version * fix embed to work the same as before with new bun Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
This commit is contained in:
		
					parent
					
						
							
								00d38855d4
							
						
					
				
			
			
				commit
				
					
						a156188b3e
					
				
			
		
					 1135 changed files with 258905 additions and 137146 deletions
				
			
		
							
								
								
									
										158
									
								
								vendor/github.com/goccy/go-json/internal/decoder/float.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								vendor/github.com/goccy/go-json/internal/decoder/float.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,158 @@
 | 
			
		|||
package decoder
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
 | 
			
		||||
	"github.com/goccy/go-json/internal/errors"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type floatDecoder struct {
 | 
			
		||||
	op         func(unsafe.Pointer, float64)
 | 
			
		||||
	structName string
 | 
			
		||||
	fieldName  string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newFloatDecoder(structName, fieldName string, op func(unsafe.Pointer, float64)) *floatDecoder {
 | 
			
		||||
	return &floatDecoder{op: op, structName: structName, fieldName: fieldName}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	floatTable = [256]bool{
 | 
			
		||||
		'0': true,
 | 
			
		||||
		'1': true,
 | 
			
		||||
		'2': true,
 | 
			
		||||
		'3': true,
 | 
			
		||||
		'4': true,
 | 
			
		||||
		'5': true,
 | 
			
		||||
		'6': true,
 | 
			
		||||
		'7': true,
 | 
			
		||||
		'8': true,
 | 
			
		||||
		'9': true,
 | 
			
		||||
		'.': true,
 | 
			
		||||
		'e': true,
 | 
			
		||||
		'E': true,
 | 
			
		||||
		'+': true,
 | 
			
		||||
		'-': true,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	validEndNumberChar = [256]bool{
 | 
			
		||||
		nul:  true,
 | 
			
		||||
		' ':  true,
 | 
			
		||||
		'\t': true,
 | 
			
		||||
		'\r': true,
 | 
			
		||||
		'\n': true,
 | 
			
		||||
		',':  true,
 | 
			
		||||
		':':  true,
 | 
			
		||||
		'}':  true,
 | 
			
		||||
		']':  true,
 | 
			
		||||
	}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func floatBytes(s *Stream) []byte {
 | 
			
		||||
	start := s.cursor
 | 
			
		||||
	for {
 | 
			
		||||
		s.cursor++
 | 
			
		||||
		if floatTable[s.char()] {
 | 
			
		||||
			continue
 | 
			
		||||
		} else if s.char() == nul {
 | 
			
		||||
			if s.read() {
 | 
			
		||||
				s.cursor-- // for retry current character
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		break
 | 
			
		||||
	}
 | 
			
		||||
	return s.buf[start:s.cursor]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *floatDecoder) decodeStreamByte(s *Stream) ([]byte, error) {
 | 
			
		||||
	for {
 | 
			
		||||
		switch s.char() {
 | 
			
		||||
		case ' ', '\n', '\t', '\r':
 | 
			
		||||
			s.cursor++
 | 
			
		||||
			continue
 | 
			
		||||
		case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
 | 
			
		||||
			return floatBytes(s), nil
 | 
			
		||||
		case 'n':
 | 
			
		||||
			if err := nullBytes(s); err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
			}
 | 
			
		||||
			return nil, nil
 | 
			
		||||
		case nul:
 | 
			
		||||
			if s.read() {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			goto ERROR
 | 
			
		||||
		default:
 | 
			
		||||
			goto ERROR
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
ERROR:
 | 
			
		||||
	return nil, errors.ErrUnexpectedEndOfJSON("float", s.totalOffset())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *floatDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) {
 | 
			
		||||
	for {
 | 
			
		||||
		switch buf[cursor] {
 | 
			
		||||
		case ' ', '\n', '\t', '\r':
 | 
			
		||||
			cursor++
 | 
			
		||||
			continue
 | 
			
		||||
		case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
 | 
			
		||||
			start := cursor
 | 
			
		||||
			cursor++
 | 
			
		||||
			for floatTable[buf[cursor]] {
 | 
			
		||||
				cursor++
 | 
			
		||||
			}
 | 
			
		||||
			num := buf[start:cursor]
 | 
			
		||||
			return num, cursor, nil
 | 
			
		||||
		case 'n':
 | 
			
		||||
			if err := validateNull(buf, cursor); err != nil {
 | 
			
		||||
				return nil, 0, err
 | 
			
		||||
			}
 | 
			
		||||
			cursor += 4
 | 
			
		||||
			return nil, cursor, nil
 | 
			
		||||
		default:
 | 
			
		||||
			return nil, 0, errors.ErrUnexpectedEndOfJSON("float", cursor)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *floatDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
 | 
			
		||||
	bytes, err := d.decodeStreamByte(s)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if bytes == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	str := *(*string)(unsafe.Pointer(&bytes))
 | 
			
		||||
	f64, err := strconv.ParseFloat(str, 64)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return errors.ErrSyntax(err.Error(), s.totalOffset())
 | 
			
		||||
	}
 | 
			
		||||
	d.op(p, f64)
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *floatDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
 | 
			
		||||
	buf := ctx.Buf
 | 
			
		||||
	bytes, c, err := d.decodeByte(buf, cursor)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	if bytes == nil {
 | 
			
		||||
		return c, nil
 | 
			
		||||
	}
 | 
			
		||||
	cursor = c
 | 
			
		||||
	if !validEndNumberChar[buf[cursor]] {
 | 
			
		||||
		return 0, errors.ErrUnexpectedEndOfJSON("float", cursor)
 | 
			
		||||
	}
 | 
			
		||||
	s := *(*string)(unsafe.Pointer(&bytes))
 | 
			
		||||
	f64, err := strconv.ParseFloat(s, 64)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, errors.ErrSyntax(err.Error(), cursor)
 | 
			
		||||
	}
 | 
			
		||||
	d.op(p, f64)
 | 
			
		||||
	return cursor, nil
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue