[chore] Update exif terminator version with codeberg libraries (#3855)

This commit is contained in:
tobi 2025-03-02 15:44:02 +01:00 committed by GitHub
commit d8bb1c391b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 60 additions and 59 deletions

View file

@ -23,7 +23,7 @@ import (
"fmt"
"io"
jpegstructure "github.com/superseriousbusiness/go-jpeg-image-structure/v2"
jpegstructure "codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2"
)
var markerLen = map[byte]int{

View file

@ -21,7 +21,7 @@ package terminator
import (
"io"
pngstructure "github.com/superseriousbusiness/go-png-image-structure/v2"
pngstructure "codeberg.org/superseriousbusiness/go-png-image-structure/v2"
)
type pngVisitor struct {

View file

@ -25,8 +25,8 @@ import (
"fmt"
"io"
jpegstructure "github.com/superseriousbusiness/go-jpeg-image-structure/v2"
pngstructure "github.com/superseriousbusiness/go-png-image-structure/v2"
jpegstructure "codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2"
pngstructure "codeberg.org/superseriousbusiness/go-png-image-structure/v2"
)
func Terminate(in io.Reader, mediaType string) (io.Reader, error) {

View file

@ -0,0 +1,7 @@
**Forked from https://github.com/dsoprea/go-jpeg-image-structure**
## Overview
Parse raw JPEG data into individual segments of data. You can print or export this data, including hash digests for each. You can also parse/modify the EXIF data and write an updated image.
EXIF, XMP, and IPTC data can also be extracted. The provided CLI tool can print this data as well.

View file

@ -248,12 +248,30 @@ func (c *Chunk) Bytes() ([]byte, error) {
if len(c.Data) != int(c.Length) {
return nil, errors.New("length of data not correct")
}
b := make([]byte, 0, 4+4+c.Length+4)
b = binary.BigEndian.AppendUint32(b, c.Length)
b = append(b, c.Type...)
b = append(b, c.Data...)
b = binary.BigEndian.AppendUint32(b, c.Crc)
return b, nil
preallocated := make([]byte, 0, 4+4+c.Length+4)
b := bytes.NewBuffer(preallocated)
err := binary.Write(b, binary.BigEndian, c.Length)
if err != nil {
return nil, err
}
if _, err := b.Write([]byte(c.Type)); err != nil {
return nil, err
}
if c.Data != nil {
if _, err := b.Write(c.Data); err != nil {
return nil, err
}
}
if err := binary.Write(b, binary.BigEndian, c.Crc); err != nil {
return nil, err
}
return b.Bytes(), nil
}
// Write encodes and writes the bytes for this chunk.
@ -262,37 +280,23 @@ func (c *Chunk) WriteTo(w io.Writer) (int, error) {
return 0, errors.New("length of data not correct")
}
var n int
b := make([]byte, 4) // uint32 buf
binary.BigEndian.PutUint32(b, c.Length)
if nn, err := w.Write(b); err != nil {
return n + nn, err
if err := binary.Write(w, binary.BigEndian, c.Length); err != nil {
return 0, err
}
n += len(b)
if nn, err := io.WriteString(w, c.Type); err != nil {
return n + nn, err
if _, err := w.Write([]byte(c.Type)); err != nil {
return 0, err
}
n += len(c.Type)
if nn, err := w.Write(c.Data); err != nil {
return n + nn, err
if _, err := w.Write(c.Data); err != nil {
return 0, err
}
n += len(c.Data)
binary.BigEndian.PutUint32(b, c.Crc)
if nn, err := w.Write(b); err != nil {
return n + nn, err
if err := binary.Write(w, binary.BigEndian, c.Crc); err != nil {
return 0, err
}
n += len(b)
return n, nil
return 4 + len(c.Type) + len(c.Data) + 4, nil
}
// readHeader verifies that the PNG header bytes appear next.

View file

@ -1,10 +0,0 @@
[![Build Status](https://travis-ci.org/dsoprea/go-jpeg-image-structure/v2.svg?branch=master)](https://travis-ci.org/dsoprea/go-jpeg-image-structure/v2)
[![codecov](https://codecov.io/gh/dsoprea/go-jpeg-image-structure/branch/master/graph/badge.svg)](https://codecov.io/gh/dsoprea/go-jpeg-image-structure)
[![Go Report Card](https://goreportcard.com/badge/github.com/dsoprea/go-jpeg-image-structure/v2)](https://goreportcard.com/report/github.com/dsoprea/go-jpeg-image-structure/v2)
[![GoDoc](https://godoc.org/github.com/dsoprea/go-jpeg-image-structure/v2?status.svg)](https://godoc.org/github.com/dsoprea/go-jpeg-image-structure/v2)
## Overview
Parse raw JPEG data into individual segments of data. You can print or export this data, including hash digests for each. You can also parse/modify the EXIF data and write an updated image.
EXIF, XMP, and IPTC data can also be extracted. The provided CLI tool can print this data as well.

14
vendor/modules.txt vendored
View file

@ -245,9 +245,15 @@ codeberg.org/superseriousbusiness/activity/streams/values/rfc2045
codeberg.org/superseriousbusiness/activity/streams/values/rfc5988
codeberg.org/superseriousbusiness/activity/streams/values/string
codeberg.org/superseriousbusiness/activity/streams/vocab
# codeberg.org/superseriousbusiness/exif-terminator v0.9.1
# codeberg.org/superseriousbusiness/exif-terminator v0.10.0
## explicit; go 1.21
codeberg.org/superseriousbusiness/exif-terminator
# codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2 v2.1.0-SSB
## explicit; go 1.17
codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2
# codeberg.org/superseriousbusiness/go-png-image-structure/v2 v2.1.0-SSB
## explicit; go 1.12
codeberg.org/superseriousbusiness/go-png-image-structure/v2
# codeberg.org/superseriousbusiness/httpsig v1.3.0-SSB
## explicit; go 1.21
codeberg.org/superseriousbusiness/httpsig
@ -807,12 +813,6 @@ github.com/stretchr/testify/suite
# github.com/subosito/gotenv v1.6.0
## explicit; go 1.18
github.com/subosito/gotenv
# github.com/superseriousbusiness/go-jpeg-image-structure/v2 v2.0.0-20220321154430-d89a106fdabe
## explicit; go 1.17
github.com/superseriousbusiness/go-jpeg-image-structure/v2
# github.com/superseriousbusiness/go-png-image-structure/v2 v2.0.1-SSB
## explicit; go 1.12
github.com/superseriousbusiness/go-png-image-structure/v2
# github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB.0.20230227143000-f4900831d6c8
## explicit; go 1.13
github.com/superseriousbusiness/oauth2/v4