Skip to content

Commit

Permalink
update dependencies (#4)
Browse files Browse the repository at this point in the history
* update deps

* update crc

* bump version
  • Loading branch information
Srlion authored Nov 25, 2021
1 parent d2e3438 commit de5736a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "gma"
version = "0.3.0"
version = "0.3.1"
authors = ["diogo <diogo464@protonmail.com>"]
edition = "2018"
license = "MIT"
description = "read and write .gma files, the format used by garry's mods addons"
repository = "https://github.com/diogo464/gma"
readme="README.md"
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
nanoserde = "0.1.18"
crc = "1.8.1"
lzma-rs = "0.1.3"
nanoserde = "0.1.29"
crc = "2.1.0"
lzma-rs = "0.2.0"
10 changes: 5 additions & 5 deletions src/gma_builder.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::binary::BinaryWriter;
use crate::{addon_metadata::AddonMetadata, result::Result, AddonTag, AddonType, Error, IDENT};
use crc::crc32;
use crc::Crc;
use std::io::{BufReader, Cursor, Read, Seek, SeekFrom, Write};
use std::{
fs::File,
hash::Hasher,
path::Path,
time::{Duration, SystemTime, UNIX_EPOCH},
};
Expand Down Expand Up @@ -293,7 +292,8 @@ impl<'a> GMABuilder<'a> {
const BLOCK_SIZE: usize = 8096;
let mut bytes_written: usize = 0;
let mut buffer: [u8; BLOCK_SIZE] = [0; BLOCK_SIZE];
let mut digest = crc32::Digest::new(crc32::IEEE);
let crc = Crc::<u32>::new(&crc::CRC_32_ISO_HDLC);
let mut digest = crc.digest();
loop {
let read_result = reader.read(&mut buffer);
match read_result {
Expand All @@ -302,13 +302,13 @@ impl<'a> GMABuilder<'a> {
bytes_written,
FilePatchInfo {
filesize: bytes_written as u64,
crc: digest.finish() as u32,
crc: digest.finalize() as u32,
},
));
}
Ok(n) => {
let data_slice = &buffer[0..n];
digest.write(data_slice);
digest.update(data_slice);
writer.write_all(data_slice)?;
bytes_written += n;
}
Expand Down

0 comments on commit de5736a

Please sign in to comment.