Skip to content

Commit

Permalink
Debloat & Package maint (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeWaka authored Oct 27, 2022
1 parent fc009cb commit b739b2c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
args: --all -- -D warnings
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "dmi"
version = "0.1.3"
edition = "2018"
edition = "2021"
license = "MIT"
description = "DMI library written in Rust. Provides helpers to manipulate and produce DMI format files."
authors = ["Rohesie <[email protected]>"]
Expand All @@ -12,6 +12,6 @@ exclude = ["src/tests.rs", "tests/*"]

[dependencies]
thiserror = "1.0"
image = "0.23"
image = { version = "0.24", default-features = false, features = ["png"] }
deflate = "1.0"
inflate = "0.4"
11 changes: 6 additions & 5 deletions src/dmi/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use image::imageops;
use image::GenericImageView;
use std::collections::HashMap;
use std::io::prelude::*;
use std::io::Cursor;

#[derive(Clone, Default)]
pub struct Icon {
Expand Down Expand Up @@ -345,14 +346,14 @@ impl Icon {
imageops::replace(
&mut new_png,
*image,
self.width * (index % max_index),
self.height * (index / max_index),
(self.width * (index % max_index)).into(),
(self.height * (index / max_index)).into(),
);
}

let mut new_dmi = vec![];
new_png.write_to(&mut new_dmi, image::ImageOutputFormat::Png)?;
let mut new_dmi = RawDmi::load(&new_dmi[..])?;
let mut dmi_data = Cursor::new(vec![]);
new_png.write_to(&mut dmi_data, image::ImageOutputFormat::Png)?;
let mut new_dmi = RawDmi::load(&dmi_data.into_inner()[..])?;

let new_ztxt = ztxt::create_ztxt_chunk(signature.as_bytes())?;

Expand Down
10 changes: 4 additions & 6 deletions src/dmi/ztxt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,10 @@ impl RawZtxtData {
pub fn decode(&self) -> Result<Vec<u8>, error::DmiError> {
match inflate::inflate_bytes_zlib(&self.compressed_text) {
Ok(decompressed_text) => Ok(decompressed_text),
Err(text) => {
return Err(error::DmiError::Generic(format!(
"Failed to read compressed text. Error: {}",
text
)))
}
Err(text) => Err(error::DmiError::Generic(format!(
"Failed to read compressed text. Error: {}",
text
))),
}
}

Expand Down

0 comments on commit b739b2c

Please sign in to comment.