Skip to content

Commit

Permalink
Merge pull request pedrocr#28 from paolobarbolini/enum_primitive_to_e…
Browse files Browse the repository at this point in the history
…numn

Replace enum_primitive with enumn
  • Loading branch information
pedrocr authored Oct 1, 2020
2 parents 18c940e + 8233bc4 commit 85ceba6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build = "data/cameras/join.rs"

[dependencies]
toml = "0.5"
enum_primitive = "0.1"
enumn = "0.1"
num = "0.3"
lazy_static = "1"
byteorder = "1"
Expand Down
3 changes: 0 additions & 3 deletions src/decoders/ciff.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use enum_primitive::{enum_from_primitive, enum_from_primitive_impl, enum_from_primitive_impl_ty};
use std::collections::HashMap;

use crate::decoders::basics::*;
use crate::decoders::Buffer;

enum_from_primitive! {
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum CiffTag {
Null = 0x0000,
Expand All @@ -20,7 +18,6 @@ pub enum CiffTag {
SubIFD = 0x300a,
Exif = 0x300b,
}
}

fn ct (tag: CiffTag) -> u16 {
tag as u16
Expand Down
8 changes: 3 additions & 5 deletions src/decoders/tiff.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use enum_primitive::{enum_from_primitive, enum_from_primitive_impl, enum_from_primitive_impl_ty};
use num::FromPrimitive;
use std::collections::HashMap;
use std::str;

use crate::decoders::basics::*;

enum_from_primitive! {
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, enumn::N)]
#[repr(u16)]
pub enum Tag {
PanaWidth = 0x0002,
PanaLength = 0x0003,
Expand Down Expand Up @@ -95,7 +94,6 @@ pub enum Tag {
KdcLength = 0xFD01,
KdcOffset = 0xFD04,
KdcIFD = 0xFE00,
}
}

// 0-1-2-3-4-5-6-7-8-9-10-11-12-13
Expand Down Expand Up @@ -202,7 +200,7 @@ impl<'a> TiffIFD<'a> {
}
for i in 0..num {
let entry_offset: usize = offset + 2 + (i as usize)*12;
if Tag::from_u16(e.ru16(buf, entry_offset)).is_none() {
if Tag::n(e.ru16(buf, entry_offset)).is_none() {
// Skip entries we don't know about to speedup decoding
continue;
}
Expand Down

0 comments on commit 85ceba6

Please sign in to comment.