rwcarlsen / goexif

Decode embedded EXIF meta data from image files.
BSD 2-Clause "Simplified" License
627 stars 134 forks source link

Adds explicit error value for short tag read and helper to identify error. #33

Closed fgeller closed 9 years ago

fgeller commented 9 years ago

This change is based on a use case from the camlistore project. There we first optimistically pass only a prefix of an image to the decoder hoping that the prefix is sufficient to get metadata out, but would like to pass the entire file in case the decoding fails because the prefix is not sufficient.

The below changes add an error value and helper to identify it that can be used in other projects (like camlistore) to identify a short read without having to match on the error message.

Please let me know what you think :)

mpl commented 9 years ago

@saljam @wathiede Opinions on that change please?

More context, if needed: https://camlistore-review.googlesource.com/#/c/4937/ https://camlistore-review.googlesource.com/#/c/4938/

saljam commented 9 years ago

I'm not very familiar with this codebase, but for what it's worth this looks good to me. IsShortReadTagValueError() seems to fit with the rest of the exif API.

rwcarlsen commented 9 years ago

Looks good. Rebased and merged in 29300d8.

mpl commented 9 years ago

excellent, thanks!