"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/golang.org/x/text/unicode/norm/transform.go" between
etcd-3.4.12.tar.gz and etcd-3.4.13.tar.gz

About: etcd is a distributed reliable key-value store for the most critical data of a distributed system (written in "Go").

transform.go  (etcd-3.4.12):transform.go  (etcd-3.4.13)
skipping to change at line 21 skipping to change at line 21
) )
// Reset implements the Reset method of the transform.Transformer interface. // Reset implements the Reset method of the transform.Transformer interface.
func (Form) Reset() {} func (Form) Reset() {}
// Transform implements the Transform method of the transform.Transformer // Transform implements the Transform method of the transform.Transformer
// interface. It may need to write segments of up to MaxSegmentSize at once. // interface. It may need to write segments of up to MaxSegmentSize at once.
// Users should either catch ErrShortDst and allow dst to grow or have dst be at // Users should either catch ErrShortDst and allow dst to grow or have dst be at
// least of size MaxTransformChunkSize to be guaranteed of progress. // least of size MaxTransformChunkSize to be guaranteed of progress.
func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
n := 0
// Cap the maximum number of src bytes to check. // Cap the maximum number of src bytes to check.
b := src b := src
eof := atEOF eof := atEOF
if ns := len(dst); ns < len(b) { if ns := len(dst); ns < len(b) {
err = transform.ErrShortDst err = transform.ErrShortDst
eof = false eof = false
b = b[:ns] b = b[:ns]
} }
i, ok := formTable[f].quickSpan(inputBytes(b), n, len(b), eof) i, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), eof)
n += copy(dst[n:], b[n:i]) n := copy(dst, b[:i])
if !ok { if !ok {
nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF) nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF)
return nDst + n, nSrc + n, err return nDst + n, nSrc + n, err
} }
if n < len(src) && !atEOF {
if err == nil && n < len(src) && !atEOF {
err = transform.ErrShortSrc err = transform.ErrShortSrc
} }
return n, n, err return n, n, err
} }
func flushTransform(rb *reorderBuffer) bool { func flushTransform(rb *reorderBuffer) bool {
// Write out (must fully fit in dst, or else it is an ErrShortDst). // Write out (must fully fit in dst, or else it is an ErrShortDst).
if len(rb.out) < rb.nrune*utf8.UTFMax { if len(rb.out) < rb.nrune*utf8.UTFMax {
return false return false
} }
skipping to change at line 82 skipping to change at line 82
if n := nSrc + len(dst) - nDst; n < end { if n := nSrc + len(dst) - nDst; n < end {
err = transform.ErrShortDst err = transform.ErrShortDst
end = n end = n
eof = false eof = false
} }
end, ok := rb.f.quickSpan(rb.src, nSrc, end, eof) end, ok := rb.f.quickSpan(rb.src, nSrc, end, eof)
n := copy(dst[nDst:], rb.src.bytes[nSrc:end]) n := copy(dst[nDst:], rb.src.bytes[nSrc:end])
nSrc += n nSrc += n
nDst += n nDst += n
if ok { if ok {
if n < rb.nsrc && !atEOF { if err == nil && n < rb.nsrc && !atEOF {
err = transform.ErrShortSrc err = transform.ErrShortSrc
} }
return nDst, nSrc, err return nDst, nSrc, err
} }
} }
} }
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)