diff --git a/source/durandal/cksum.rs b/source/durandal/cksum.rs index 7441ae7..f1322cb 100644 --- a/source/durandal/cksum.rs +++ b/source/durandal/cksum.rs @@ -58,6 +58,6 @@ pub fn crc32(b: &[u8], s: u32) -> u32 } const ISO_3309_POLYNOMIAL: u32 = 0xEDB8_8320; -const ADLER32_MODULO: u32 = 65521; +const ADLER32_MODULO: u32 = 0xFFF1; // EOF diff --git a/source/marathon/defl.rs b/source/marathon/defl.rs index 2580240..faabbc2 100644 --- a/source/marathon/defl.rs +++ b/source/marathon/defl.rs @@ -389,7 +389,7 @@ impl HuffmanTable p += 1; // check our symbol table for this one (quick tree check) - let count = u16::from(self.nums[i]); + let count = self.nums[i]; if i32::from(code) - i32::from(count) < i32::from(first) { return Ok((i, self.syms[usize::from(index + code - first)])); diff --git a/source/marathon/pict.rs b/source/marathon/pict.rs index 4dc88e3..6092be9 100644 --- a/source/marathon/pict.rs +++ b/source/marathon/pict.rs @@ -47,8 +47,8 @@ fn read_pm_header<'a>(b: &'a [u8], } let rle = pack_t == PackType::Default || - pack_t == PackType::Rle16 && depth == Depth::Bits16 || - pack_t == PackType::Rle32 && depth == Depth::Bits32; + pack_t == PackType::Rle16 && depth == Depth::_16 || + pack_t == PackType::Rle32 && depth == Depth::_32; let pitch = usize::from(pt_fl & 0x3FFF); @@ -61,7 +61,7 @@ fn read_pm_ind(mut im: Image8, b: &[u8], hdr: Header) -> ResultS let clut = ok!(hdr.clut, "no CLUT in indexed mode")?; let mut p = 0; - if hdr.pitch < 8 && hdr.depth == Depth::Bits8 { + if hdr.pitch < 8 && hdr.depth == Depth::_8 { // uncompressed 8-bit colormap indices for _ in 0..im.h() { for _ in 0..im.w() { @@ -79,7 +79,7 @@ fn read_pm_ind(mut im: Image8, b: &[u8], hdr: Header) -> ResultS for _ in 0..im.h() { let (d, pp) = read_rle::(&b[p..], hdr.pitch)?; - let d = if hdr.depth < Depth::Bits8 { + let d = if hdr.depth < Depth::_8 { expand_data(d, hdr.depth)? } else { d @@ -195,12 +195,12 @@ fn read_pm_area(im: Image8, b: &[u8], pack: bool, clip: bool) let (b, hdr) = read_pm_header(&b[p..], pack, clip, &im)?; match hdr.depth { - Depth::Bits1 | - Depth::Bits2 | - Depth::Bits4 | - Depth::Bits8 => read_pm_ind(im, b, hdr), - Depth::Bits16 => read_pm_16(im, b, hdr), - Depth::Bits32 => read_pm_32(im, b, hdr), + Depth::_1 | + Depth::_2 | + Depth::_4 | + Depth::_8 => read_pm_ind(im, b, hdr), + Depth::_16 => read_pm_16(im, b, hdr), + Depth::_32 => read_pm_32(im, b, hdr), } } @@ -442,25 +442,25 @@ impl ReadRleData for u8 fn expand_data(b: Vec, depth: Depth) -> ResultS> { let mut o = Vec::with_capacity(match depth { - Depth::Bits4 => b.len() * 2, - Depth::Bits2 => b.len() * 4, - Depth::Bits1 => b.len() * 8, + Depth::_4 => b.len() * 2, + Depth::_2 => b.len() * 4, + Depth::_1 => b.len() * 8, _ => bail!("invalid bit depth"), }); for ch in b { match depth { - Depth::Bits4 => { + Depth::_4 => { for i in (0..=1).rev() { o.push(ch >> (i * 4) & 0xF_u8); } } - Depth::Bits2 => { + Depth::_2 => { for i in (0..=3).rev() { o.push(ch >> (i * 2) & 0x3_u8); } } - Depth::Bits1 => { + Depth::_1 => { for i in (0..=7).rev() { o.push(ch >> i & 0x1_u8); } @@ -484,12 +484,12 @@ struct Header c_enum! { enum Depth: u16 { - Bits1 = 1, - Bits2 = 2, - Bits4 = 4, - Bits8 = 8, - Bits16 = 16, - Bits32 = 32, + _1 = 1, + _2 = 2, + _4 = 4, + _8 = 8, + _16 = 16, + _32 = 32, } } diff --git a/source/marathon/ppm.rs b/source/marathon/ppm.rs index 48448f3..ca7458a 100644 --- a/source/marathon/ppm.rs +++ b/source/marathon/ppm.rs @@ -1,4 +1,4 @@ -//! Portable PixMap format images. +//! Portable Pixel Map format images. use crate::durandal::{err::*, fixed::FixedLong, image::*}; use std::io; @@ -40,7 +40,7 @@ pub fn read_ppm(inp: &[u8]) -> ResultS st => break st } }; - let st = unsafe {std::str::from_utf8_unchecked(&st)}; + let st = unsafe {std::str::from_utf8_unchecked(st)}; let nu = u16::from_str_radix(st, 10)?; Ok(nu) }; @@ -56,9 +56,9 @@ pub fn read_ppm(inp: &[u8]) -> ResultS let g = FixedLong::from_int(get_num()?.into()); let b = FixedLong::from_int(get_num()?.into()); - let r = (r / depth * 65535).integ() as u16; - let g = (g / depth * 65535).integ() as u16; - let b = (b / depth * 65535).integ() as u16; + let r = (r / depth * 0xFFFF).integ() as u16; + let g = (g / depth * 0xFFFF).integ() as u16; + let b = (b / depth * 0xFFFF).integ() as u16; im.cr.push(Color16::new(r, g, b)); } diff --git a/source/tycho/data/icon_index.theme b/source/tycho/data/icon_index.theme deleted file mode 100644 index 488015b..0000000 --- a/source/tycho/data/icon_index.theme +++ /dev/null @@ -1,15 +0,0 @@ -[Icon Theme] -Name=hicolor -Inherits=HighContrast -DisplayDepth=32 -Directories=48x48/actions,48x48/apps - -[48x48/actions] -Size=48 -Context=Actions -Type=Fixed - -[48x48/apps] -Size=48 -Context=Applications -Type=Fixed