Commit Graph
79 Commits
Author SHA1 Message Date
Andrew Champion eadec8f0b9 Remove most unchecked size/index casts
Convert most unchecked size/index `as` casts to checked casts with
`TryFrom`, included another top-level error variant.

This has several motivations:
- Making the library as robust as possible, including to platform
differences.
- Unchecked casts are susceptible to breakage during refactorings.
- Preparing for BigTIFF support, which will require the introduction of
generics and associated types for some parts of the de/encoders.
Unchecked primitive casts cannot be bound, while TryFrom can, and
overflowing conversions become more likely.
- Remaining u16 casts may be prone in failure in existing practice and
not just in theory during future changes.
2019-12-21 15:57:24 +00:00
Andrew Champion f92be13f6c Factor tags into own module
Tag representations are not decoder- or encoder-specific, so should live
in their own module accessible to both for reuse. The decoder::ifd
module remains since this module is mainly dedicated to decoding the
IFD.
2019-12-21 15:57:24 +00:00
Andrew Champion f9cace84da Deduplicate primitive conversions for tag enum 2019-12-21 15:57:24 +00:00
Andrew Champion 1fafcccb36 Remove needless cast (minor) 2019-12-21 15:57:24 +00:00
Andrew Champion 8c4cea5d97 Support 64-bit encoding
Note that this adds the LONG8 data type from BigTIFF because of bounds
requiring TiffValue. However, this datatype should not actually be
written to tags.
2019-12-10 20:18:53 +00:00
Andreas Molzer 07e8501ad6 Prefer matching over if-else-chain in tags macro
Thanks to the review comment for pointing this style issue out.
2019-11-12 10:53:38 +01:00
Andreas Molzer f88c9f00c3 Move everything to the tags macro 2019-11-10 18:02:42 +01:00
Andreas Molzer f80f4a06d5 Make the Unknown field optional
Several other uses that currently rely on num-traits for conversion have
no Unknown representation. Thus, the converter now outputs only known
variants or an error and the exposing function then can put the error
value into an Unknown variant instead.
2019-11-10 18:02:08 +01:00
Andreas Molzer ffdeb62b9f Rework the tag macro to make it reusable
Factor out parts that are unique to instantiations such as the name, the
documentation, the underlying type, the public conversion methods.

Also adds the ability to document individual items and remodels the
syntax to more closely resemble ordinary enum definitions.
2019-11-01 01:35:18 +01:00
Yuki Okushi ea19f0f686 Remove try! macros 2019-08-29 19:10:27 +09:00
Dustin Thomson 30eb8487a6 Signed value support
Add support for SBYTE, SSHORT, SLONG, SRATIONAL as per the Tiff 6.0 spec
Add support for multiple BYTE
2019-08-14 21:22:56 -06:00
Birk Tjelmeland 514b7cddaa Change minimal rustc version to 1.24.1 2019-05-03 23:12:29 +02:00
Atul Bhosale 522fbd1a69 Format code using 'cargo fmt' 2019-04-18 00:04:43 +05:30
Birk Tjelmeland 5e86931dff Fix possibly overflowing multiplications 2019-03-12 11:07:57 +01:00
Birk Tjelmeland 5c3f50f800 Fix compiler and clippy warnings 2019-02-28 07:58:07 +01:00
Birk Tjelmeland d637e1f7f6 Fix memory exhaustion bug 2019-02-27 16:15:57 +01:00
Birk Tjelmeland fb30648c12 Implemented basic tiff encoding 2019-01-31 21:20:49 +01:00
Jonathan Behrens fab6734275 Remove unsafe code 2019-01-11 15:03:40 -05:00
Sven Nilsen 742784ddc7 Merge branch 'master' into master 2018-09-19 15:25:24 +02:00
Felix Schütt 0089e93b49 Migrate from String to properly typed TiffUnsupportedError 2018-09-13 13:44:16 +02:00
Felix Schütt 2c6ca5459a Migrate from String to properly typed TiffFormatError 2018-09-13 13:20:50 +02:00
Jim Rybarski ff1d31533b Add support for ASCII tags 2018-08-17 11:43:51 -05:00
zroug 1712b2fc7b Added support for rational tags 2018-07-10 17:21:13 +02:00
R.Chavignat 9c098c4bee Integrate upstream changes 2018-06-17 16:44:51 +02:00
R.Chavignat 112492261f Cleanups, visibility fixes, add authors 2018-06-17 15:45:00 +02:00
R.Chavignat a4d7d1a4fc Clippy run 2018-03-13 00:07:06 +01:00
R.Chavignat 0c623bc3a3 Refactor a bit
Rename the Image* types to Tiff*
Extract the "common" types to the top level.
2018-03-13 00:07:06 +01:00
R.Chavignat 8210a81672 Paste code from image until it builds 2018-03-13 00:06:56 +01:00
R.Chavignat a92205909a Import tiff module from image repo 2018-03-12 18:26:44 +01:00