Commit Graph

16 Commits (d21ac8e2de85274733c163a2e1f62d8bb239c31d)

Author SHA1 Message Date
Dustin Oprea 120bcdb2a5 common/parser.go: Trim ASCII-NUL strings to exclude binary characters
This is for convenience. We're already ignoring whether it does or does
not have the NUL. Since having binary characters is likely an
undesireable flaw in the image and support for binary characters by EXIF
is probably just a vestigial, ridiculous feature, just stop short and
return the preceding characters if encountered. If we do actually need
the binary at some point in the future, we can circle back and
potentially add an option to do so.

Closes #55
2021-05-12 00:36:55 -04:00
Dustin Oprea dca55bf8ca type.go: Bugfix for newlines interpreted as binary. Add tests.
Fixes #55
2021-04-28 00:20:52 -04:00
Dustin Oprea 443fda923a common/type.go: Truncate ASCII strings at the first NUL
This can prevent the string from being classified as "binary" and its
value being suppressed in output.
2021-01-31 17:15:54 -05:00
Dustin Oprea 0d9ceeb35b exif.go: Add support for seeking to multiple EXIF blobs (SearchAndExtractExifN)
- ifd_enumerate.go
  - Bugfixes for various broken log messages.
  - Bugfix for ErrTagNotFound not actually skipping.

- common/parser.go: Parsing ASCII now panics if there's binary (8-bit)
  characters.
  - utility.go: GetFlatExifData() just logs and skips these.

- exif.go: Add searchAndExtractExifWithReaderWithDiscarded(), to return
  how many bytes it seeks through.

Supports https://github.com/dsoprea/go-exif/issues/53
2021-01-31 17:15:48 -05:00
Dustin Oprea 64f5c6ad03 value_context.go: Bugfix for missing float and double cases in Values()
Related to 325de3c
2020-12-15 01:18:58 -05:00
Dustin Oprea fe4ea0ee06 value_encoder_test.go: Tweak test name for correctness 2020-12-09 01:44:58 -05:00
Wendel Hime 325de3c5bb
adding float and double as types with name and size tests (#51)
add translate to type cases

replace float compare by Nextafter and Nextafter32

add parser for floats and doubles

add float and double parsers

add support for doubles and floats in FormatFrom functions

add ReadFloats and ReadDoubles for context

add float32 and double encoder

merging

merge

add float and double parsers

add ReadFloats and ReadDoubles for context

add float32 and double encoder

removing log alias from parser

removing log alias from parser_test

removing log alias from type

removing log alias from type_test

removing log alias from value_context

removing aliases from value_contex_test

removing log alias from value_encoder

removing log alias from value_encoder_test

update parser slices from floats and doubles

merge

update values for tests

raise exception when parsing with different expected size
2020-12-09 01:40:27 -05:00
Dustin Oprea de21411905 common/type.go: No longer format text verbatim if has binary 2020-08-26 18:56:25 -04:00
Dustin Oprea 9393e7afd4 Upgrade from go-utility v1 to v2 2020-07-17 03:10:58 -04:00
Dustin Oprea 46b1a0cd17 ifd_enumerate.go: Add date normalization. Skip altitude if zero denominator.
Fixes #43
2020-07-17 02:39:59 -04:00
Dustin Oprea 3f7ee4ce89 backwards incompatible: Move time utilities to exifcommon 2020-07-11 13:15:18 -04:00
Dustin Oprea 83b844408c backwards incompatible: Stop exporting ParseOneIfd and ParseOneTag 2020-07-11 13:15:18 -04:00
Dustin Oprea ee26db1fc4 backwards incompatible: Drop redundant variables 2020-07-11 13:15:18 -04:00
Dustin Oprea 7d4721b065 backwards incompatible: Removed bridging functions
NewIfdMappingWithStandard and related (in ifd.go). We now use the same
functions in common/.

- NewIfdMappingWithStandard now returns an error, too.

This took care of several backwards-incompatible tasks that have been
waiting on v3 to be forked.
2020-07-11 13:15:12 -04:00
Dustin Oprea 312218d7b1 Use encapsulated data/reader rather than bytes
Given a stream of data, it is possible to determine the beginning of
EXIF data but not the end. Therefore, either an image-aware
implementation must know how to parse an image and extract the EXIF
data or a brute-force search implementation (one of which is provided
by this project) must find the start anchor and then return all bytes
from that to the end of the file.

We have been made aware of some use-cases where a brute-force search
might be unavoidable due to trust or stability issues with the image
structure. This leads to large allocations. This can be avoided by
accomodating support that will allow for both a byte-slice or an
`io.ReadSeeker`. Since the EXIF structure is typically not read-
intensive (a couple of kilobytes if no thumbnail is present), this
should have a minimal performance impact.

Closes #42
2020-07-11 12:12:48 -04:00
Dustin Oprea 56058635d0 Seed v3 release. Copy from v2 release. 2020-07-11 12:12:48 -04:00