summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/image
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-09-28 18:30:40 +0100
committerLibravatar GitHub <noreply@github.com>2022-09-28 18:30:40 +0100
commita156188b3eb5cb3da44aa1b7452265f5fa38a607 (patch)
tree7097fa48d56fbabc7c2c8750b1f3bc9321d71c0f /vendor/golang.org/x/image
parent[bugfix] Fix emphasis being added to emoji shortcodes with markdown parsing (... (diff)
downloadgotosocial-a156188b3eb5cb3da44aa1b7452265f5fa38a607.tar.xz
[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>
Diffstat (limited to 'vendor/golang.org/x/image')
-rw-r--r--vendor/golang.org/x/image/AUTHORS3
-rw-r--r--vendor/golang.org/x/image/CONTRIBUTORS3
-rw-r--r--vendor/golang.org/x/image/bmp/reader.go78
-rw-r--r--vendor/golang.org/x/image/ccitt/reader.go156
-rw-r--r--vendor/golang.org/x/image/ccitt/table.go917
-rw-r--r--vendor/golang.org/x/image/tiff/fuzz.go1
-rw-r--r--vendor/golang.org/x/image/tiff/lzw/reader.go6
-rw-r--r--vendor/golang.org/x/image/tiff/reader.go3
-rw-r--r--vendor/golang.org/x/image/tiff/writer.go3
9 files changed, 642 insertions, 528 deletions
diff --git a/vendor/golang.org/x/image/AUTHORS b/vendor/golang.org/x/image/AUTHORS
deleted file mode 100644
index 15167cd74..000000000
--- a/vendor/golang.org/x/image/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/vendor/golang.org/x/image/CONTRIBUTORS b/vendor/golang.org/x/image/CONTRIBUTORS
deleted file mode 100644
index 1c4577e96..000000000
--- a/vendor/golang.org/x/image/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/golang.org/x/image/bmp/reader.go b/vendor/golang.org/x/image/bmp/reader.go
index c10a022f6..e165c2e39 100644
--- a/vendor/golang.org/x/image/bmp/reader.go
+++ b/vendor/golang.org/x/image/bmp/reader.go
@@ -85,7 +85,7 @@ func decodeRGB(r io.Reader, c image.Config, topDown bool) (image.Image, error) {
// decodeNRGBA reads a 32 bit-per-pixel BMP image from r.
// If topDown is false, the image rows will be read bottom-up.
-func decodeNRGBA(r io.Reader, c image.Config, topDown bool) (image.Image, error) {
+func decodeNRGBA(r io.Reader, c image.Config, topDown, allowAlpha bool) (image.Image, error) {
rgba := image.NewNRGBA(image.Rect(0, 0, c.Width, c.Height))
if c.Width == 0 || c.Height == 0 {
return rgba, nil
@@ -102,6 +102,9 @@ func decodeNRGBA(r io.Reader, c image.Config, topDown bool) (image.Image, error)
for i := 0; i < len(p); i += 4 {
// BMP images are stored in BGRA order rather than RGBA order.
p[i+0], p[i+2] = p[i+2], p[i+0]
+ if !allowAlpha {
+ p[i+3] = 0xFF
+ }
}
}
return rgba, nil
@@ -110,7 +113,7 @@ func decodeNRGBA(r io.Reader, c image.Config, topDown bool) (image.Image, error)
// Decode reads a BMP image from r and returns it as an image.Image.
// Limitation: The file must be 8, 24 or 32 bits per pixel.
func Decode(r io.Reader) (image.Image, error) {
- c, bpp, topDown, err := decodeConfig(r)
+ c, bpp, topDown, allowAlpha, err := decodeConfig(r)
if err != nil {
return nil, err
}
@@ -120,7 +123,7 @@ func Decode(r io.Reader) (image.Image, error) {
case 24:
return decodeRGB(r, c, topDown)
case 32:
- return decodeNRGBA(r, c, topDown)
+ return decodeNRGBA(r, c, topDown, allowAlpha)
}
panic("unreachable")
}
@@ -129,13 +132,15 @@ func Decode(r io.Reader) (image.Image, error) {
// decoding the entire image.
// Limitation: The file must be 8, 24 or 32 bits per pixel.
func DecodeConfig(r io.Reader) (image.Config, error) {
- config, _, _, err := decodeConfig(r)
+ config, _, _, _, err := decodeConfig(r)
return config, err
}
-func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown bool, err error) {
- // We only support those BMP images that are a BITMAPFILEHEADER
- // immediately followed by a BITMAPINFOHEADER.
+func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown bool, allowAlpha bool, err error) {
+ // We only support those BMP images with one of the following DIB headers:
+ // - BITMAPINFOHEADER (40 bytes)
+ // - BITMAPV4HEADER (108 bytes)
+ // - BITMAPV5HEADER (124 bytes)
const (
fileHeaderLen = 14
infoHeaderLen = 40
@@ -144,18 +149,24 @@ func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown b
)
var b [1024]byte
if _, err := io.ReadFull(r, b[:fileHeaderLen+4]); err != nil {
- return image.Config{}, 0, false, err
+ if err == io.EOF {
+ err = io.ErrUnexpectedEOF
+ }
+ return image.Config{}, 0, false, false, err
}
if string(b[:2]) != "BM" {
- return image.Config{}, 0, false, errors.New("bmp: invalid format")
+ return image.Config{}, 0, false, false, errors.New("bmp: invalid format")
}
offset := readUint32(b[10:14])
infoLen := readUint32(b[14:18])
if infoLen != infoHeaderLen && infoLen != v4InfoHeaderLen && infoLen != v5InfoHeaderLen {
- return image.Config{}, 0, false, ErrUnsupported
+ return image.Config{}, 0, false, false, ErrUnsupported
}
if _, err := io.ReadFull(r, b[fileHeaderLen+4:fileHeaderLen+infoLen]); err != nil {
- return image.Config{}, 0, false, err
+ if err == io.EOF {
+ err = io.ErrUnexpectedEOF
+ }
+ return image.Config{}, 0, false, false, err
}
width := int(int32(readUint32(b[18:22])))
height := int(int32(readUint32(b[22:26])))
@@ -163,12 +174,12 @@ func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown b
height, topDown = -height, true
}
if width < 0 || height < 0 {
- return image.Config{}, 0, false, ErrUnsupported
+ return image.Config{}, 0, false, false, ErrUnsupported
}
// We only support 1 plane and 8, 24 or 32 bits per pixel and no
// compression.
planes, bpp, compression := readUint16(b[26:28]), readUint16(b[28:30]), readUint32(b[30:34])
- // if compression is set to BITFIELDS, but the bitmask is set to the default bitmask
+ // if compression is set to BI_BITFIELDS, but the bitmask is set to the default bitmask
// that would be used if compression was set to 0, we can continue as if compression was 0
if compression == 3 && infoLen > infoHeaderLen &&
readUint32(b[54:58]) == 0xff0000 && readUint32(b[58:62]) == 0xff00 &&
@@ -176,16 +187,16 @@ func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown b
compression = 0
}
if planes != 1 || compression != 0 {
- return image.Config{}, 0, false, ErrUnsupported
+ return image.Config{}, 0, false, false, ErrUnsupported
}
switch bpp {
case 8:
if offset != fileHeaderLen+infoLen+256*4 {
- return image.Config{}, 0, false, ErrUnsupported
+ return image.Config{}, 0, false, false, ErrUnsupported
}
_, err = io.ReadFull(r, b[:256*4])
if err != nil {
- return image.Config{}, 0, false, err
+ return image.Config{}, 0, false, false, err
}
pcm := make(color.Palette, 256)
for i := range pcm {
@@ -193,19 +204,40 @@ func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown b
// Every 4th byte is padding.
pcm[i] = color.RGBA{b[4*i+2], b[4*i+1], b[4*i+0], 0xFF}
}
- return image.Config{ColorModel: pcm, Width: width, Height: height}, 8, topDown, nil
+ return image.Config{ColorModel: pcm, Width: width, Height: height}, 8, topDown, false, nil
case 24:
if offset != fileHeaderLen+infoLen {
- return image.Config{}, 0, false, ErrUnsupported
+ return image.Config{}, 0, false, false, ErrUnsupported
}
- return image.Config{ColorModel: color.RGBAModel, Width: width, Height: height}, 24, topDown, nil
+ return image.Config{ColorModel: color.RGBAModel, Width: width, Height: height}, 24, topDown, false, nil
case 32:
if offset != fileHeaderLen+infoLen {
- return image.Config{}, 0, false, ErrUnsupported
+ return image.Config{}, 0, false, false, ErrUnsupported
}
- return image.Config{ColorModel: color.RGBAModel, Width: width, Height: height}, 32, topDown, nil
- }
- return image.Config{}, 0, false, ErrUnsupported
+ // 32 bits per pixel is possibly RGBX (X is padding) or RGBA (A is
+ // alpha transparency). However, for BMP images, "Alpha is a
+ // poorly-documented and inconsistently-used feature" says
+ // https://source.chromium.org/chromium/chromium/src/+/bc0a792d7ebc587190d1a62ccddba10abeea274b:third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.cc;l=621
+ //
+ // That goes on to say "BITMAPV3HEADER+ have an alpha bitmask in the
+ // info header... so we respect it at all times... [For earlier
+ // (smaller) headers we] ignore alpha in Windows V3 BMPs except inside
+ // ICO files".
+ //
+ // "Ignore" means to always set alpha to 0xFF (fully opaque):
+ // https://source.chromium.org/chromium/chromium/src/+/bc0a792d7ebc587190d1a62ccddba10abeea274b:third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.h;l=272
+ //
+ // Confusingly, "Windows V3" does not correspond to BITMAPV3HEADER, but
+ // instead corresponds to the earlier (smaller) BITMAPINFOHEADER:
+ // https://source.chromium.org/chromium/chromium/src/+/bc0a792d7ebc587190d1a62ccddba10abeea274b:third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_reader.cc;l=258
+ //
+ // This Go package does not support ICO files and the (infoLen >
+ // infoHeaderLen) condition distinguishes BITMAPINFOHEADER (40 bytes)
+ // vs later (larger) headers.
+ allowAlpha = infoLen > infoHeaderLen
+ return image.Config{ColorModel: color.RGBAModel, Width: width, Height: height}, 32, topDown, allowAlpha, nil
+ }
+ return image.Config{}, 0, false, false, ErrUnsupported
}
func init() {
diff --git a/vendor/golang.org/x/image/ccitt/reader.go b/vendor/golang.org/x/image/ccitt/reader.go
index 16bd495d5..340de0536 100644
--- a/vendor/golang.org/x/image/ccitt/reader.go
+++ b/vendor/golang.org/x/image/ccitt/reader.go
@@ -16,6 +16,7 @@ import (
)
var (
+ errIncompleteCode = errors.New("ccitt: incomplete code")
errInvalidBounds = errors.New("ccitt: invalid bounds")
errInvalidCode = errors.New("ccitt: invalid code")
errInvalidMode = errors.New("ccitt: invalid mode")
@@ -48,6 +49,10 @@ const (
Group4
)
+// AutoDetectHeight is passed as the height argument to NewReader to indicate
+// that the image height (the number of rows) is not known in advance.
+const AutoDetectHeight = -1
+
// Options are optional parameters.
type Options struct {
// Align means that some variable-bit-width codes are byte-aligned.
@@ -205,10 +210,14 @@ func decode(b *bitReader, decodeTable [][2]int16) (uint32, error) {
for {
bit, err := b.nextBit()
if err != nil {
+ if err == io.EOF {
+ err = errIncompleteCode
+ }
return 0, err
}
bitsRead |= bit << (63 - nBitsRead)
nBitsRead++
+
// The "&1" is redundant, but can eliminate a bounds check.
state = int32(decodeTable[state][bit&1])
if state < 0 {
@@ -222,6 +231,35 @@ func decode(b *bitReader, decodeTable [][2]int16) (uint32, error) {
}
}
+// decodeEOL decodes the 12-bit EOL code 0000_0000_0001.
+func decodeEOL(b *bitReader) error {
+ nBitsRead, bitsRead := uint32(0), uint64(0)
+ for {
+ bit, err := b.nextBit()
+ if err != nil {
+ if err == io.EOF {
+ err = errMissingEOL
+ }
+ return err
+ }
+ bitsRead |= bit << (63 - nBitsRead)
+ nBitsRead++
+
+ if nBitsRead < 12 {
+ if bit&1 == 0 {
+ continue
+ }
+ } else if bit&1 != 0 {
+ return nil
+ }
+
+ // Unread the bits we've read, then return errMissingEOL.
+ b.bits = (b.bits >> nBitsRead) | bitsRead
+ b.nBits += nBitsRead
+ return errMissingEOL
+ }
+}
+
type reader struct {
br bitReader
subFormat SubFormat
@@ -231,7 +269,10 @@ type reader struct {
// rowsRemaining starts at the image height in pixels, when the reader is
// driven through the io.Reader interface, and decrements to zero as rows
- // are decoded. When driven through DecodeIntoGray, this field is unused.
+ // are decoded. Alternatively, it may be negative if the image height is
+ // not known in advance at the time of the NewReader call.
+ //
+ // When driven through DecodeIntoGray, this field is unused.
rowsRemaining int
// curr and prev hold the current and previous rows. Each element is either
@@ -269,6 +310,19 @@ type reader struct {
// seenStartOfImage is whether we've called the startDecode method.
seenStartOfImage bool
+ // truncated is whether the input is missing the final 6 consecutive EOL's
+ // (for Group3) or 2 consecutive EOL's (for Group4). Omitting that trailer
+ // (but otherwise padding to a byte boundary, with either all 0 bits or all
+ // 1 bits) is invalid according to the spec, but happens in practice when
+ // exporting from Adobe Acrobat to TIFF + CCITT. This package silently
+ // ignores the format error for CCITT input that has been truncated in that
+ // fashion, returning the full decoded image.
+ //
+ // Detecting trailer truncation (just after the final row of pixels)
+ // requires knowing which row is the final row, and therefore does not
+ // trigger if the image height is not known in advance.
+ truncated bool
+
// readErr is a sticky error for the Read method.
readErr error
}
@@ -294,17 +348,50 @@ func (z *reader) Read(p []byte) (int, error) {
// Decode the next row, if necessary.
if z.atStartOfRow {
- if z.rowsRemaining <= 0 {
- if z.readErr = z.finishDecode(); z.readErr != nil {
+ if z.rowsRemaining < 0 {
+ // We do not know the image height in advance. See if the next
+ // code is an EOL. If it is, it is consumed. If it isn't, the
+ // bitReader shouldn't advance along the bit stream, and we
+ // simply decode another row of pixel data.
+ //
+ // For the Group4 subFormat, we may need to align to a byte
+ // boundary. For the Group3 subFormat, the previous z.decodeRow
+ // call (or z.startDecode call) has already consumed one of the
+ // 6 consecutive EOL's. The next EOL is actually the second of
+ // 6, in the middle, and we shouldn't align at that point.
+ if z.align && (z.subFormat == Group4) {
+ z.br.alignToByteBoundary()
+ }
+
+ if err := z.decodeEOL(); err == errMissingEOL {
+ // No-op. It's another row of pixel data.
+ } else if err != nil {
+ z.readErr = err
+ break
+ } else {
+ if z.readErr = z.finishDecode(true); z.readErr != nil {
+ break
+ }
+ z.readErr = io.EOF
+ break
+ }
+
+ } else if z.rowsRemaining == 0 {
+ // We do know the image height in advance, and we have already
+ // decoded exactly that many rows.
+ if z.readErr = z.finishDecode(false); z.readErr != nil {
break
}
z.readErr = io.EOF
break
+
+ } else {
+ z.rowsRemaining--
}
- if z.readErr = z.decodeRow(); z.readErr != nil {
+
+ if z.readErr = z.decodeRow(z.rowsRemaining == 0); z.readErr != nil {
break
}
- z.rowsRemaining--
}
// Pack from z.curr (1 byte per pixel) to p (1 bit per pixel).
@@ -351,32 +438,44 @@ func (z *reader) startDecode() error {
return nil
}
-func (z *reader) finishDecode() error {
+func (z *reader) finishDecode(alreadySeenEOL bool) error {
numberOfEOLs := 0
switch z.subFormat {
case Group3:
+ if z.truncated {
+ return nil
+ }
// The stream ends with a RTC (Return To Control) of 6 consecutive
// EOL's, but we should have already just seen an EOL, either in
// z.startDecode (for a zero-height image) or in z.decodeRow.
numberOfEOLs = 5
case Group4:
- // The stream ends with two EOL's, the first of which is possibly
- // byte-aligned.
- numberOfEOLs = 2
- if err := z.decodeEOL(); err == nil {
- numberOfEOLs--
- } else if err == errInvalidCode {
- // Try again, this time starting from a byte boundary.
+ autoDetectHeight := z.rowsRemaining < 0
+ if autoDetectHeight {
+ // Aligning to a byte boundary was already handled by reader.Read.
+ } else if z.align {
z.br.alignToByteBoundary()
- } else {
+ }
+ // The stream ends with two EOL's. If the first one is missing, and we
+ // had an explicit image height, we just assume that the trailing two
+ // EOL's were truncated and return a nil error.
+ if err := z.decodeEOL(); err != nil {
+ if (err == errMissingEOL) && !autoDetectHeight {
+ z.truncated = true
+ return nil
+ }
return err
}
+ numberOfEOLs = 1
default:
return errUnsupportedSubFormat
}
+ if alreadySeenEOL {
+ numberOfEOLs--
+ }
for ; numberOfEOLs > 0; numberOfEOLs-- {
if err := z.decodeEOL(); err != nil {
return err
@@ -386,19 +485,10 @@ func (z *reader) finishDecode() error {
}
func (z *reader) decodeEOL() error {
- // TODO: EOL doesn't have to be in the modeDecodeTable. It could be in its
- // own table, or we could just hard-code it, especially if we might need to
- // cater for optional byte-alignment, or an arbitrary number (potentially
- // more than 8) of 0-valued padding bits.
- if mode, err := decode(&z.br, modeDecodeTable[:]); err != nil {
- return err
- } else if mode != modeEOL {
- return errMissingEOL
- }
- return nil
+ return decodeEOL(&z.br)
}
-func (z *reader) decodeRow() error {
+func (z *reader) decodeRow(finalRow bool) error {
z.wi = 0
z.atStartOfRow = true
z.penColorIsWhite = true
@@ -414,7 +504,12 @@ func (z *reader) decodeRow() error {
return err
}
}
- return z.decodeEOL()
+ err := z.decodeEOL()
+ if finalRow && (err == errMissingEOL) {
+ z.truncated = true
+ return nil
+ }
+ return err
case Group4:
for ; z.wi < len(z.curr); z.atStartOfRow = false {
@@ -654,13 +749,13 @@ func DecodeIntoGray(dst *image.Gray, r io.Reader, order Order, sf SubFormat, opt
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
p := (y - bounds.Min.Y) * dst.Stride
z.curr = dst.Pix[p : p+width]
- if err := z.decodeRow(); err != nil {
+ if err := z.decodeRow(y+1 == bounds.Max.Y); err != nil {
return err
}
z.curr, z.prev = nil, z.curr
}
- if err := z.finishDecode(); err != nil {
+ if err := z.finishDecode(false); err != nil {
return err
}
@@ -677,9 +772,12 @@ func DecodeIntoGray(dst *image.Gray, r io.Reader, order Order, sf SubFormat, opt
// NewReader returns an io.Reader that decodes the CCITT-formatted data in r.
// The resultant byte stream is one bit per pixel (MSB first), with 1 meaning
// white and 0 meaning black. Each row in the result is byte-aligned.
+//
+// A negative height, such as passing AutoDetectHeight, means that the image
+// height is not known in advance. A negative width is invalid.
func NewReader(r io.Reader, order Order, sf SubFormat, width int, height int, opts *Options) io.Reader {
readErr := error(nil)
- if (width < 0) || (height < 0) {
+ if width < 0 {
readErr = errInvalidBounds
} else if width > maxWidth {
readErr = errUnsupportedWidth
diff --git a/vendor/golang.org/x/image/ccitt/table.go b/vendor/golang.org/x/image/ccitt/table.go
index f01cc12b5..8b3794bc2 100644
--- a/vendor/golang.org/x/image/ccitt/table.go
+++ b/vendor/golang.org/x/image/ccitt/table.go
@@ -31,37 +31,27 @@ package ccitt
// modeDecodeTable represents Table 1 and the End-of-Line code.
//
-// +=XXXXX
-// b015 +-+
-// | +=v0010
-// b014 +-+
-// | +=XXXXX
-// b013 +-+
-// | +=XXXXX
-// b012 +-+
-// | +=XXXXX
-// b011 +-+
-// | +=XXXXX
-// b009 +-+
-// | +=v0009
-// b007 +-+
-// | | +=v0008
-// b010 | +-+
-// | +=v0005
-// b006 +-+
-// | | +=v0007
-// b008 | +-+
-// | +=v0004
-// b005 +-+
-// | +=v0000
-// b003 +-+
-// | +=v0001
-// b002 +-+
-// | | +=v0006
-// b004 | +-+
-// | +=v0003
-// b001 +-+
-// +=v0002
+// +=XXXXX
+// b009 +-+
+// | +=v0009
+// b007 +-+
+// | | +=v0008
+// b010 | +-+
+// | +=v0005
+// b006 +-+
+// | | +=v0007
+// b008 | +-+
+// | +=v0004
+// b005 +-+
+// | +=v0000
+// b003 +-+
+// | +=v0001
+// b002 +-+
+// | | +=v0006
+// b004 | +-+
+// | +=v0003
+// b001 +-+
+// +=v0002
var modeDecodeTable = [...][2]int16{
0: {0, 0},
1: {2, ^2},
@@ -72,226 +62,221 @@ var modeDecodeTable = [...][2]int16{
6: {7, 8},
7: {9, 10},
8: {^7, ^4},
- 9: {11, ^9},
+ 9: {0, ^9},
10: {^8, ^5},
- 11: {12, 0},
- 12: {13, 0},
- 13: {14, 0},
- 14: {15, 0},
- 15: {0, ^10},
}
// whiteDecodeTable represents Tables 2 and 3 for a white run.
//
-// +=XXXXX
-// b059 +-+
-// | | +=v1792
-// b096 | | +-+
-// | | | | +=v1984
-// b100 | | | +-+
-// | | | +=v2048
-// b094 | | +-+
-// | | | | +=v2112
-// b101 | | | | +-+
-// | | | | | +=v2176
-// b097 | | | +-+
-// | | | | +=v2240
-// b102 | | | +-+
-// | | | +=v2304
-// b085 | +-+
-// | | +=v1856
-// b098 | | +-+
-// | | | +=v1920
-// b095 | +-+
-// | | +=v2368
-// b103 | | +-+
-// | | | +=v2432
-// b099 | +-+
-// | | +=v2496
-// b104 | +-+
-// | +=v2560
-// b040 +-+
-// | | +=v0029
-// b060 | +-+
-// | +=v0030
-// b026 +-+
-// | | +=v0045
-// b061 | | +-+
-// | | | +=v0046
-// b041 | +-+
-// | +=v0022
-// b016 +-+
-// | | +=v0023
-// b042 | | +-+
-// | | | | +=v0047
-// b062 | | | +-+
-// | | | +=v0048
-// b027 | +-+
-// | +=v0013
-// b008 +-+
-// | | +=v0020
-// b043 | | +-+
-// | | | | +=v0033
-// b063 | | | +-+
-// | | | +=v0034
-// b028 | | +-+
-// | | | | +=v0035
-// b064 | | | | +-+
-// | | | | | +=v0036
-// b044 | | | +-+
-// | | | | +=v0037
-// b065 | | | +-+
-// | | | +=v0038
-// b017 | +-+
-// | | +=v0019
-// b045 | | +-+
-// | | | | +=v0031
-// b066 | | | +-+
-// | | | +=v0032
-// b029 | +-+
-// | +=v0001
-// b004 +-+
-// | | +=v0012
-// b030 | | +-+
-// | | | | +=v0053
-// b067 | | | | +-+
-// | | | | | +=v0054
-// b046 | | | +-+
-// | | | +=v0026
-// b018 | | +-+
-// | | | | +=v0039
-// b068 | | | | +-+
-// | | | | | +=v0040
-// b047 | | | | +-+
-// | | | | | | +=v0041
-// b069 | | | | | +-+
-// | | | | | +=v0042
-// b031 | | | +-+
-// | | | | +=v0043
-// b070 | | | | +-+
-// | | | | | +=v0044
-// b048 | | | +-+
-// | | | +=v0021
-// b009 | +-+
-// | | +=v0028
-// b049 | | +-+
-// | | | | +=v0061
-// b071 | | | +-+
-// | | | +=v0062
-// b032 | | +-+
-// | | | | +=v0063
-// b072 | | | | +-+
-// | | | | | +=v0000
-// b050 | | | +-+
-// | | | | +=v0320
-// b073 | | | +-+
-// | | | +=v0384
-// b019 | +-+
-// | +=v0010
-// b002 +-+
-// | | +=v0011
-// b020 | | +-+
-// | | | | +=v0027
-// b051 | | | | +-+
-// | | | | | | +=v0059
-// b074 | | | | | +-+
-// | | | | | +=v0060
-// b033 | | | +-+
-// | | | | +=v1472
-// b086 | | | | +-+
-// | | | | | +=v1536
-// b075 | | | | +-+
-// | | | | | | +=v1600
-// b087 | | | | | +-+
-// | | | | | +=v1728
-// b052 | | | +-+
-// | | | +=v0018
-// b010 | | +-+
-// | | | | +=v0024
-// b053 | | | | +-+
-// | | | | | | +=v0049
-// b076 | | | | | +-+
-// | | | | | +=v0050
-// b034 | | | | +-+
-// | | | | | | +=v0051
-// b077 | | | | | | +-+
-// | | | | | | | +=v0052
-// b054 | | | | | +-+
-// | | | | | +=v0025
-// b021 | | | +-+
-// | | | | +=v0055
-// b078 | | | | +-+
-// | | | | | +=v0056
-// b055 | | | | +-+
-// | | | | | | +=v0057
-// b079 | | | | | +-+
-// | | | | | +=v0058
-// b035 | | | +-+
-// | | | +=v0192
-// b005 | +-+
-// | | +=v1664
-// b036 | | +-+
-// | | | | +=v0448
-// b080 | | | | +-+
-// | | | | | +=v0512
-// b056 | | | +-+
-// | | | | +=v0704
-// b088 | | | | +-+
-// | | | | | +=v0768
-// b081 | | | +-+
-// | | | +=v0640
-// b022 | | +-+
-// | | | | +=v0576
-// b082 | | | | +-+
-// | | | | | | +=v0832
-// b089 | | | | | +-+
-// | | | | | +=v0896
-// b057 | | | | +-+
-// | | | | | | +=v0960
-// b090 | | | | | | +-+
-// | | | | | | | +=v1024
-// b083 | | | | | +-+
-// | | | | | | +=v1088
-// b091 | | | | | +-+
-// | | | | | +=v1152
-// b037 | | | +-+
-// | | | | +=v1216
-// b092 | | | | +-+
-// | | | | | +=v1280
-// b084 | | | | +-+
-// | | | | | | +=v1344
-// b093 | | | | | +-+
-// | | | | | +=v1408
-// b058 | | | +-+
-// | | | +=v0256
-// b011 | +-+
-// | +=v0002
-// b001 +-+
-// | +=v0003
-// b012 | +-+
-// | | | +=v0128
-// b023 | | +-+
-// | | +=v0008
-// b006 | +-+
-// | | | +=v0009
-// b024 | | | +-+
-// | | | | | +=v0016
-// b038 | | | | +-+
-// | | | | +=v0017
-// b013 | | +-+
-// | | +=v0004
-// b003 +-+
-// | +=v0005
-// b014 | +-+
-// | | | +=v0014
-// b039 | | | +-+
-// | | | | +=v0015
-// b025 | | +-+
-// | | +=v0064
-// b007 +-+
-// | +=v0006
-// b015 +-+
-// +=v0007
+// +=XXXXX
+// b059 +-+
+// | | +=v1792
+// b096 | | +-+
+// | | | | +=v1984
+// b100 | | | +-+
+// | | | +=v2048
+// b094 | | +-+
+// | | | | +=v2112
+// b101 | | | | +-+
+// | | | | | +=v2176
+// b097 | | | +-+
+// | | | | +=v2240
+// b102 | | | +-+
+// | | | +=v2304
+// b085 | +-+
+// | | +=v1856
+// b098 | | +-+
+// | | | +=v1920
+// b095 | +-+
+// | | +=v2368
+// b103 | | +-+
+// | | | +=v2432
+// b099 | +-+
+// | | +=v2496
+// b104 | +-+
+// | +=v2560
+// b040 +-+
+// | | +=v0029
+// b060 | +-+
+// | +=v0030
+// b026 +-+
+// | | +=v0045
+// b061 | | +-+
+// | | | +=v0046
+// b041 | +-+
+// | +=v0022
+// b016 +-+
+// | | +=v0023
+// b042 | | +-+
+// | | | | +=v0047
+// b062 | | | +-+
+// | | | +=v0048
+// b027 | +-+
+// | +=v0013
+// b008 +-+
+// | | +=v0020
+// b043 | | +-+
+// | | | | +=v0033
+// b063 | | | +-+
+// | | | +=v0034
+// b028 | | +-+
+// | | | | +=v0035
+// b064 | | | | +-+
+// | | | | | +=v0036
+// b044 | | | +-+
+// | | | | +=v0037
+// b065 | | | +-+
+// | | | +=v0038
+// b017 | +-+
+// | | +=v0019
+// b045 | | +-+
+// | | | | +=v0031
+// b066 | | | +-+
+// | | | +=v0032
+// b029 | +-+
+// | +=v0001
+// b004 +-+
+// | | +=v0012
+// b030 | | +-+
+// | | | | +=v0053
+// b067 | | | | +-+
+// | | | | | +=v0054
+// b046 | | | +-+
+// | | | +=v0026
+// b018 | | +-+
+// | | | | +=v0039
+// b068 | | | | +-+
+// | | | | | +=v0040
+// b047 | | | | +-+
+// | | | | | | +=v0041
+// b069 | | | | | +-+
+// | | | | | +=v0042
+// b031 | | | +-+
+// | | | | +=v0043
+// b070 | | | | +-+
+// | | | | | +=v0044
+// b048 | | | +-+
+// | | | +=v0021
+// b009 | +-+
+// | | +=v0028
+// b049 | | +-+
+// | | | | +=v0061
+// b071 | | | +-+
+// | | | +=v0062
+// b032 | | +-+
+// | | | | +=v0063
+// b072 | | | | +-+
+// | | | | | +=v0000
+// b050 | | | +-+
+// | | | | +=v0320
+// b073 | | | +-+
+// | | | +=v0384
+// b019 | +-+
+// | +=v0010
+// b002 +-+
+// | | +=v0011
+// b020 | | +-+
+// | | | | +=v0027
+// b051 | | | | +-+
+// | | | | | | +=v0059
+// b074 | | | | | +-+
+// | | | | | +=v0060
+// b033 | | | +-+
+// | | | | +=v1472
+// b086 | | | | +-+
+// | | | | | +=v1536
+// b075 | | | | +-+
+// | | | | | | +=v1600
+// b087 | | | | | +-+
+// | | | | | +=v1728
+// b052 | | | +-+
+// | | | +=v0018
+// b010 | | +-+
+// | | | | +=v0024
+// b053 | | | | +-+
+// | | | | | | +=v0049
+// b076 | | | | | +-+
+// | | | | | +=v0050
+// b034 | | | | +-+
+// | | | | | | +=v0051
+// b077 | | | | | | +-+
+// | | | | | | | +=v0052
+// b054 | | | | | +-+
+// | | | | | +=v0025
+// b021 | | | +-+
+// | | | | +=v0055
+// b078 | | | | +-+
+// | | | | | +=v0056
+// b055 | | | | +-+
+// | | | | | | +=v0057
+// b079 | | | | | +-+
+// | | | | | +=v0058
+// b035 | | | +-+
+// | | | +=v0192
+// b005 | +-+
+// | | +=v1664
+// b036 | | +-+
+// | | | | +=v0448
+// b080 | | | | +-+
+// | | | | | +=v0512
+// b056 | | | +-+
+// | | | | +=v0704
+// b088 | | | | +-+
+// | | | | | +=v0768
+// b081 | | | +-+
+// | | | +=v0640
+// b022 | | +-+
+// | | | | +=v0576
+// b082 | | | | +-+
+// | | | | | | +=v0832
+// b089 | | | | | +-+
+// | | | | | +=v0896
+// b057 | | | | +-+
+// | | | | | | +=v0960
+// b090 | | | | | | +-+
+// | | | | | | | +=v1024
+// b083 | | | | | +-+
+// | | | | | | +=v1088
+// b091 | | | | | +-+
+// | | | | | +=v1152
+// b037 | | | +-+
+// | | | | +=v1216
+// b092 | | | | +-+
+// | | | | | +=v1280
+// b084 | | | | +-+
+// | | | | | | +=v1344
+// b093 | | | | | +-+
+// | | | | | +=v1408
+// b058 | | | +-+
+// | | | +=v0256
+// b011 | +-+
+// | +=v0002
+// b001 +-+
+// | +=v0003
+// b012 | +-+
+// | | | +=v0128
+// b023 | | +-+
+// | | +=v0008
+// b006 | +-+
+// | | | +=v0009
+// b024 | | | +-+
+// | | | | | +=v0016
+// b038 | | | | +-+
+// | | | | +=v0017
+// b013 | | +-+
+// | | +=v0004
+// b003 +-+
+// | +=v0005
+// b014 | +-+
+// | | | +=v0014
+// b039 | | | +-+
+// | | | | +=v0015
+// b025 | | +-+
+// | | +=v0064
+// b007 +-+
+// | +=v0006
+// b015 +-+
+// +=v0007
var whiteDecodeTable = [...][2]int16{
0: {0, 0},
1: {2, 3},
@@ -402,215 +387,215 @@ var whiteDecodeTable = [...][2]int16{
// blackDecodeTable represents Tables 2 and 3 for a black run.
//
-// +=XXXXX
-// b017 +-+
-// | | +=v1792
-// b042 | | +-+
-// | | | | +=v1984
-// b063 | | | +-+
-// | | | +=v2048
-// b029 | | +-+
-// | | | | +=v2112
-// b064 | | | | +-+
-// | | | | | +=v2176
-// b043 | | | +-+
-// | | | | +=v2240
-// b065 | | | +-+
-// | | | +=v2304
-// b022 | +-+
-// | | +=v1856
-// b044 | | +-+
-// | | | +=v1920
-// b030 | +-+
-// | | +=v2368
-// b066 | | +-+
-// | | | +=v2432
-// b045 | +-+
-// | | +=v2496
-// b067 | +-+
-// | +=v2560
-// b013 +-+
-// | | +=v0018
-// b031 | | +-+
-// | | | | +=v0052
-// b068 | | | | +-+
-// | | | | | | +=v0640
-// b095 | | | | | +-+
-// | | | | | +=v0704
-// b046 | | | +-+
-// | | | | +=v0768
-// b096 | | | | +-+
-// | | | | | +=v0832
-// b069 | | | +-+
-// | | | +=v0055
-// b023 | | +-+
-// | | | | +=v0056
-// b070 | | | | +-+
-// | | | | | | +=v1280
-// b097 | | | | | +-+
-// | | | | | +=v1344
-// b047 | | | | +-+
-// | | | | | | +=v1408
-// b098 | | | | | | +-+
-// | | | | | | | +=v1472
-// b071 | | | | | +-+
-// | | | | | +=v0059
-// b032 | | | +-+
-// | | | | +=v0060
-// b072 | | | | +-+
-// | | | | | | +=v1536
-// b099 | | | | | +-+
-// | | | | | +=v1600
-// b048 | | | +-+
-// | | | +=v0024
-// b018 | +-+
-// | | +=v0025
-// b049 | | +-+
-// | | | | +=v1664
-// b100 | | | | +-+
-// | | | | | +=v1728
-// b073 | | | +-+
-// | | | +=v0320
-// b033 | | +-+
-// | | | | +=v0384
-// b074 | | | | +-+
-// | | | | | +=v0448
-// b050 | | | +-+
-// | | | | +=v0512
-// b101 | | | | +-+
-// | | | | | +=v0576
-// b075 | | | +-+
-// | | | +=v0053
-// b024 | +-+
-// | | +=v0054
-// b076 | | +-+
-// | | | | +=v0896
-// b102 | | | +-+
-// | | | +=v0960
-// b051 | | +-+
-// | | | | +=v1024
-// b103 | | | | +-+
-// | | | | | +=v1088
-// b077 | | | +-+
-// | | | | +=v1152
-// b104 | | | +-+
-// | | | +=v1216
-// b034 | +-+
-// | +=v0064
-// b010 +-+
-// | | +=v0013
-// b019 | | +-+
-// | | | | +=v0023
-// b052 | | | | +-+
-// | | | | | | +=v0050
-// b078 | | | | | +-+
-// | | | | | +=v0051
-// b035 | | | | +-+
-// | | | | | | +=v0044
-// b079 | | | | | | +-+
-// | | | | | | | +=v0045
-// b053 | | | | | +-+
-// | | | | | | +=v0046
-// b080 | | | | | +-+
-// | | | | | +=v0047
-// b025 | | | +-+
-// | | | | +=v0057
-// b081 | | | | +-+
-// | | | | | +=v0058
-// b054 | | | | +-+
-// | | | | | | +=v0061
-// b082 | | | | | +-+
-// | | | | | +=v0256
-// b036 | | | +-+
-// | | | +=v0016
-// b014 | +-+
-// | | +=v0017
-// b037 | | +-+
-// | | | | +=v0048
-// b083 | | | | +-+
-// | | | | | +=v0049
-// b055 | | | +-+
-// | | | | +=v0062
-// b084 | | | +-+
-// | | | +=v0063
-// b026 | | +-+
-// | | | | +=v0030
-// b085 | | | | +-+
-// | | | | | +=v0031
-// b056 | | | | +-+
-// | | | | | | +=v0032
-// b086 | | | | | +-+
-// | | | | | +=v0033
-// b038 | | | +-+
-// | | | | +=v0040
-// b087 | | | | +-+
-// | | | | | +=v0041
-// b057 | | | +-+
-// | | | +=v0022
-// b020 | +-+
-// | +=v0014
-// b008 +-+
-// | | +=v0010
-// b015 | | +-+
-// | | | +=v0011
-// b011 | +-+
-// | | +=v0015
-// b027 | | +-+
-// | | | | +=v0128
-// b088 | | | | +-+
-// | | | | | +=v0192
-// b058 | | | | +-+
-// | | | | | | +=v0026
-// b089 | | | | | +-+
-// | | | | | +=v0027
-// b039 | | | +-+
-// | | | | +=v0028
-// b090 | | | | +-+
-// | | | | | +=v0029
-// b059 | | | +-+
-// | | | +=v0019
-// b021 | | +-+
-// | | | | +=v0020
-// b060 | | | | +-+
-// | | | | | | +=v0034
-// b091 | | | | | +-+
-// | | | | | +=v0035
-// b040 | | | | +-+
-// | | | | | | +=v0036
-// b092 | | | | | | +-+
-// | | | | | | | +=v0037
-// b061 | | | | | +-+
-// | | | | | | +=v0038
-// b093 | | | | | +-+
-// | | | | | +=v0039
-// b028 | | | +-+
-// | | | | +=v0021
-// b062 | | | | +-+
-// | | | | | | +=v0042
-// b094 | | | | | +-+
-// | | | | | +=v0043
-// b041 | | | +-+
-// | | | +=v0000
-// b016 | +-+
-// | +=v0012
-// b006 +-+
-// | | +=v0009
-// b012 | | +-+
-// | | | +=v0008
-// b009 | +-+
-// | +=v0007
-// b004 +-+
-// | | +=v0006
-// b007 | +-+
-// | +=v0005
-// b002 +-+
-// | | +=v0001
-// b005 | +-+
-// | +=v0004
-// b001 +-+
-// | +=v0003
-// b003 +-+
-// +=v0002
+// +=XXXXX
+// b017 +-+
+// | | +=v1792
+// b042 | | +-+
+// | | | | +=v1984
+// b063 | | | +-+
+// | | | +=v2048
+// b029 | | +-+
+// | | | | +=v2112
+// b064 | | | | +-+
+// | | | | | +=v2176
+// b043 | | | +-+
+// | | | | +=v2240
+// b065 | | | +-+
+// | | | +=v2304
+// b022 | +-+
+// | | +=v1856
+// b044 | | +-+
+// | | | +=v1920
+// b030 | +-+
+// | | +=v2368
+// b066 | | +-+
+// | | | +=v2432
+// b045 | +-+
+// | | +=v2496
+// b067 | +-+
+// | +=v2560
+// b013 +-+
+// | | +=v0018
+// b031 | | +-+
+// | | | | +=v0052
+// b068 | | | | +-+
+// | | | | | | +=v0640
+// b095 | | | | | +-+
+// | | | | | +=v0704
+// b046 | | | +-+
+// | | | | +=v0768
+// b096 | | | | +-+
+// | | | | | +=v0832
+// b069 | | | +-+
+// | | | +=v0055
+// b023 | | +-+
+// | | | | +=v0056
+// b070 | | | | +-+
+// | | | | | | +=v1280
+// b097 | | | | | +-+
+// | | | | | +=v1344
+// b047 | | | | +-+
+// | | | | | | +=v1408
+// b098 | | | | | | +-+
+// | | | | | | | +=v1472
+// b071 | | | | | +-+
+// | | | | | +=v0059
+// b032 | | | +-+
+// | | | | +=v0060
+// b072 | | | | +-+
+// | | | | | | +=v1536
+// b099 | | | | | +-+
+// | | | | | +=v1600
+// b048 | | | +-+
+// | | | +=v0024
+// b018 | +-+
+// | | +=v0025
+// b049 | | +-+
+// | | | | +=v1664
+// b100 | | | | +-+
+// | | | | | +=v1728
+// b073 | | | +-+
+// | | | +=v0320
+// b033 | | +-+
+// | | | | +=v0384
+// b074 | | | | +-+
+// | | | | | +=v0448
+// b050 | | | +-+
+// | | | | +=v0512
+// b101 | | | | +-+
+// | | | | | +=v0576
+// b075 | | | +-+
+// | | | +=v0053
+// b024 | +-+
+// | | +=v0054
+// b076 | | +-+
+// | | | | +=v0896
+// b102 | | | +-+
+// | | | +=v0960
+// b051 | | +-+
+// | | | | +=v1024
+// b103 | | | | +-+
+// | | | | | +=v1088
+// b077 | | | +-+
+// | | | | +=v1152
+// b104 | | | +-+
+// | | | +=v1216
+// b034 | +-+
+// | +=v0064
+// b010 +-+
+// | | +=v0013
+// b019 | | +-+
+// | | | | +=v0023
+// b052 | | | | +-+
+// | | | | | | +=v0050
+// b078 | | | | | +-+
+// | | | | | +=v0051
+// b035 | | | | +-+
+// | | | | | | +=v0044
+// b079 | | | | | | +-+
+// | | | | | | | +=v0045
+// b053 | | | | | +-+
+// | | | | | | +=v0046
+// b080 | | | | | +-+
+// | | | | | +=v0047
+// b025 | | | +-+
+// | | | | +=v0057
+// b081 | | | | +-+
+// | | | | | +=v0058
+// b054 | | | | +-+
+// | | | | | | +=v0061
+// b082 | | | | | +-+
+// | | | | | +=v0256
+// b036 | | | +-+
+// | | | +=v0016
+// b014 | +-+
+// | | +=v0017
+// b037 | | +-+
+// | | | | +=v0048
+// b083 | | | | +-+
+// | | | | | +=v0049
+// b055 | | | +-+
+// | | | | +=v0062
+// b084 | | | +-+
+// | | | +=v0063
+// b026 | | +-+
+// | | | | +=v0030
+// b085 | | | | +-+
+// | | | | | +=v0031
+// b056 | | | | +-+
+// | | | | | | +=v0032
+// b086 | | | | | +-+
+// | | | | | +=v0033
+// b038 | | | +-+
+// | | | | +=v0040
+// b087 | | | | +-+
+// | | | | | +=v0041
+// b057 | | | +-+
+// | | | +=v0022
+// b020 | +-+
+// | +=v0014
+// b008 +-+
+// | | +=v0010
+// b015 | | +-+
+// | | | +=v0011
+// b011 | +-+
+// | | +=v0015
+// b027 | | +-+
+// | | | | +=v0128
+// b088 | | | | +-+
+// | | | | | +=v0192
+// b058 | | | | +-+
+// | | | | | | +=v0026
+// b089 | | | | | +-+
+// | | | | | +=v0027
+// b039 | | | +-+
+// | | | | +=v0028
+// b090 | | | | +-+
+// | | | | | +=v0029
+// b059 | | | +-+
+// | | | +=v0019
+// b021 | | +-+
+// | | | | +=v0020
+// b060 | | | | +-+
+// | | | | | | +=v0034
+// b091 | | | | | +-+
+// | | | | | +=v0035
+// b040 | | | | +-+
+// | | | | | | +=v0036
+// b092 | | | | | | +-+
+// | | | | | | | +=v0037
+// b061 | | | | | +-+
+// | | | | | | +=v0038
+// b093 | | | | | +-+
+// | | | | | +=v0039
+// b028 | | | +-+
+// | | | | +=v0021
+// b062 | | | | +-+
+// | | | | | | +=v0042
+// b094 | | | | | +-+
+// | | | | | +=v0043
+// b041 | | | +-+
+// | | | +=v0000
+// b016 | +-+
+// | +=v0012
+// b006 +-+
+// | | +=v0009
+// b012 | | +-+
+// | | | +=v0008
+// b009 | +-+
+// | +=v0007
+// b004 +-+
+// | | +=v0006
+// b007 | +-+
+// | +=v0005
+// b002 +-+
+// | | +=v0001
+// b005 | +-+
+// | +=v0004
+// b001 +-+
+// | +=v0003
+// b003 +-+
+// +=v0002
var blackDecodeTable = [...][2]int16{
0: {0, 0},
1: {2, 3},
@@ -733,17 +718,16 @@ type bitString struct {
// modeEncodeTable represents Table 1 and the End-of-Line code.
var modeEncodeTable = [...]bitString{
- 0: {0x0001, 4}, // "0001"
- 1: {0x0001, 3}, // "001"
- 2: {0x0001, 1}, // "1"
- 3: {0x0003, 3}, // "011"
- 4: {0x0003, 6}, // "000011"
- 5: {0x0003, 7}, // "0000011"
- 6: {0x0002, 3}, // "010"
- 7: {0x0002, 6}, // "000010"
- 8: {0x0002, 7}, // "0000010"
- 9: {0x0001, 7}, // "0000001"
- 10: {0x0001, 12}, // "000000000001"
+ 0: {0x0001, 4}, // "0001"
+ 1: {0x0001, 3}, // "001"
+ 2: {0x0001, 1}, // "1"
+ 3: {0x0003, 3}, // "011"
+ 4: {0x0003, 6}, // "000011"
+ 5: {0x0003, 7}, // "0000011"
+ 6: {0x0002, 3}, // "010"
+ 7: {0x0002, 6}, // "000010"
+ 8: {0x0002, 7}, // "0000010"
+ 9: {0x0001, 7}, // "0000001"
}
// whiteEncodeTable2 represents Table 2 for a white run.
@@ -983,7 +967,6 @@ const (
modeVL2 // Vertical-Left-2
modeVL3 // Vertical-Left-3
modeExt // Extension
- modeEOL // End-of-Line
)
// COPY PASTE table.go END
diff --git a/vendor/golang.org/x/image/tiff/fuzz.go b/vendor/golang.org/x/image/tiff/fuzz.go
index ec52c7882..b27c54004 100644
--- a/vendor/golang.org/x/image/tiff/fuzz.go
+++ b/vendor/golang.org/x/image/tiff/fuzz.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gofuzz
// +build gofuzz
package tiff
diff --git a/vendor/golang.org/x/image/tiff/lzw/reader.go b/vendor/golang.org/x/image/tiff/lzw/reader.go
index 78204ba92..1ccf5858a 100644
--- a/vendor/golang.org/x/image/tiff/lzw/reader.go
+++ b/vendor/golang.org/x/image/tiff/lzw/reader.go
@@ -3,8 +3,8 @@
// license that can be found in the LICENSE file.
// Package lzw implements the Lempel-Ziv-Welch compressed data format,
-// described in T. A. Welch, ``A Technique for High-Performance Data
-// Compression'', Computer, 17(6) (June 1984), pp 8-19.
+// described in T. A. Welch, “A Technique for High-Performance Data
+// Compression”, Computer, 17(6) (June 1984), pp 8-19.
//
// In particular, it implements LZW as used by the TIFF file format, including
// an "off by one" algorithmic difference when compared to standard LZW.
@@ -30,7 +30,7 @@ Aldus "off by one" algorithm.
The Go code doesn't read (invalid) TIFF files written by old versions of
libtiff, but the LZW algorithm in this package still differs from the one in
-Go's standard package library to accomodate this "off by one" in valid TIFFs.
+Go's standard package library to accommodate this "off by one" in valid TIFFs.
*/
import (
diff --git a/vendor/golang.org/x/image/tiff/reader.go b/vendor/golang.org/x/image/tiff/reader.go
index c26ec36bb..de73f4b99 100644
--- a/vendor/golang.org/x/image/tiff/reader.go
+++ b/vendor/golang.org/x/image/tiff/reader.go
@@ -404,6 +404,9 @@ func newDecoder(r io.Reader) (*decoder, error) {
p := make([]byte, 8)
if _, err := d.r.ReadAt(p, 0); err != nil {
+ if err == io.EOF {
+ err = io.ErrUnexpectedEOF
+ }
return nil, err
}
switch string(p[0:4]) {
diff --git a/vendor/golang.org/x/image/tiff/writer.go b/vendor/golang.org/x/image/tiff/writer.go
index c8a01cea7..4272c5aa0 100644
--- a/vendor/golang.org/x/image/tiff/writer.go
+++ b/vendor/golang.org/x/image/tiff/writer.go
@@ -8,6 +8,7 @@ import (
"bytes"
"compress/zlib"
"encoding/binary"
+ "errors"
"image"
"io"
"sort"
@@ -338,6 +339,8 @@ func Encode(w io.Writer, m image.Image, opt *Options) error {
}
case cDeflate:
dst = zlib.NewWriter(&buf)
+ default:
+ return errors.New("tiff: unsupported compression")
}
pr := uint32(prNone)