diff --git a/Cargo.toml b/Cargo.toml index 76f5d3a4..f18ded67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "pelite" -version = "0.10.0" +version = "0.10.1" authors = ["Casper "] -edition = "2018" +edition = "2021" license = "MIT" description = "Lightweight, memory-safe, zero-allocation library for reading and navigating PE binaries." @@ -25,11 +25,6 @@ derive_pod = ["dataview/derive_pod"] std = ["no-std-compat/std"] resources_nostd = ["hashbrown"] -[badges] -appveyor = { repository = "CasualX/pelite", branch = "master", service = "github" } -travis-ci = { repository = "CasualX/pelite", branch = "master", service = "github" } -maintenance = { status = "actively-developed" } - [profile.release] lto = true opt-level = 2 @@ -43,8 +38,8 @@ pelite-macros = { path = "src/proc-macros", version = "0.1.1" } dataview = { version = "1.0", default-features = false } serde = { version = "1.0", optional = true, features = ["derive"] } data-encoding = { version = "2.3", optional = true } -no-std-compat = { version = "0.4.0", features = ["alloc"] } -hashbrown = { version = "0.8.0", optional = true } +no-std-compat = { version = "0.4", features = ["alloc"] } +hashbrown = { version = "0.13", optional = true } [target.'cfg(unix)'.dependencies] libc = { version = "0.2", optional = true } @@ -53,6 +48,6 @@ libc = { version = "0.2", optional = true } winapi = { version = "0.3", optional = true, features = ["fileapi", "memoryapi", "handleapi"] } [dev-dependencies] -rand = "0.5" +rand = "0.8" lde = "0.3" -format_xml = "0.2" +format_xml = "0.3" diff --git a/examples/csgo/classes.rs b/examples/csgo/classes.rs index 57542d67..a1b20eb6 100644 --- a/examples/csgo/classes.rs +++ b/examples/csgo/classes.rs @@ -12,7 +12,7 @@ use pelite::pattern as pat; pub fn print(client: PeFile, dll_name: &str) { let classes = classes(client); - tprint! { + format_xml::print! { "### ClientClasses\n\n" for cls in (&classes) { "
\n" diff --git a/examples/csgo/cvars.rs b/examples/csgo/cvars.rs index 4229364f..acde0164 100644 --- a/examples/csgo/cvars.rs +++ b/examples/csgo/cvars.rs @@ -14,7 +14,7 @@ pub fn print(bin: PeFile, dll_name: &str) { let cvars = convars(bin); let cmds = concommands(bin); - tprint! { + format_xml::print! { "### ConVars\n\n" for cvar in (&cvars) { "
\n" diff --git a/examples/csgo/datamaps.rs b/examples/csgo/datamaps.rs index eb5181e2..ad85af0f 100644 --- a/examples/csgo/datamaps.rs +++ b/examples/csgo/datamaps.rs @@ -14,7 +14,7 @@ use pelite::pe32::*; pub fn print(client: PeFile) { let datamaps = datamaps(client).unwrap(); - tprint! { + format_xml::print! { "### Datamaps\n\n" for class in (&datamaps) { "
\n" diff --git a/examples/csgo/interfaces.rs b/examples/csgo/interfaces.rs index d9019947..4006181b 100644 --- a/examples/csgo/interfaces.rs +++ b/examples/csgo/interfaces.rs @@ -19,7 +19,7 @@ use pelite::pe32::*; pub fn print(file: PeFile, dll_name: &str) { let ifaces = interfaces(file); - tprint! { + format_xml::print! { "### Interfaces\n\n" "```\n" for iface in (&ifaces) { diff --git a/examples/csgo/kbutton.rs b/examples/csgo/kbutton.rs index 4616ec4f..daf0936a 100644 --- a/examples/csgo/kbutton.rs +++ b/examples/csgo/kbutton.rs @@ -13,7 +13,7 @@ use pelite::pe32::*; pub fn print(bin: PeFile<'_>, dll_name: &str) { let btns = buttons(bin); - tprint! { + format_xml::print! { "### Buttons\n\n```\n" for btn in (&btns) { {dll_name}"!"{btn.kbutton;#010x}" kbutton_t "{btn.name}"\n" diff --git a/examples/csgo/main.rs b/examples/csgo/main.rs index 8261237c..01cb4226 100644 --- a/examples/csgo/main.rs +++ b/examples/csgo/main.rs @@ -3,12 +3,6 @@ Counter-Strike: Global Offensive ================================ */ -macro_rules! tprint { - ($($tt:tt)*) => { - print!("{}", format_xml::template!{$($tt)*}); - }; -} - mod interfaces; mod classes; mod datamaps; diff --git a/examples/csgo/recvtables.rs b/examples/csgo/recvtables.rs index 41c6fe58..6e7c6683 100644 --- a/examples/csgo/recvtables.rs +++ b/examples/csgo/recvtables.rs @@ -17,7 +17,7 @@ use lde; pub fn print(client: PeFile) { let classes = recvtables(client).unwrap(); - tprint! { + format_xml::print! { "### Recvtables\n\n" for cls in (&classes) { "
\n" diff --git a/examples/csgo/weapondata.rs b/examples/csgo/weapondata.rs index 06525731..ce48f42e 100644 --- a/examples/csgo/weapondata.rs +++ b/examples/csgo/weapondata.rs @@ -14,7 +14,7 @@ use lde; pub fn print(client: PeFile) { let list = weapondata(client).unwrap(); - tprint! { + format_xml::print! { "### WeaponData\n\n" "```\n" "class WeaponInfo {{\n" diff --git a/examples/markovbin.rs b/examples/markovbin.rs index aeaea40b..dbada96d 100644 --- a/examples/markovbin.rs +++ b/examples/markovbin.rs @@ -100,7 +100,7 @@ fn generate(buckets: &[[u32; 256]; 256], count: usize) { // Pick the next byte based on the weight for this byte // FIXME! Use weighted reservoir sampling instead but this is more simple... - let mut pick = rng.gen_range(0, total); + let mut pick = rng.gen_range(0..total); for i in 0..256 { if pick < bucket[i] { byte = i as u8; diff --git a/src/lib.rs b/src/lib.rs index 5960d1f6..d494ff1a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,6 @@ Due to small but incompatible differences the two formats are not unified. */ #![recursion_limit = "128"] -#![allow(ellipsis_inclusive_range_patterns)] #![cfg_attr(not(feature = "std"), no_std)] extern crate no_std_compat as std; diff --git a/src/pe64/imports.rs b/src/pe64/imports.rs index eb184fe1..9258cd76 100644 --- a/src/pe64/imports.rs +++ b/src/pe64/imports.rs @@ -300,8 +300,8 @@ pub(crate) fn test<'a, P: Pe<'a>>(pe: P) -> Result<()> { for desc in imports { let _ = format!("{:?}", desc); let _dll_name = desc.dll_name(); - for _ in desc.iat() {} - for _ in desc.int() {} + for _ in desc.iat()? {} + for _ in desc.int()? {} } let iat = pe.iat()?; diff --git a/src/proc-macros/pattern.rs b/src/proc-macros/pattern.rs index e33a929d..cffa8a2a 100644 --- a/src/proc-macros/pattern.rs +++ b/src/proc-macros/pattern.rs @@ -402,7 +402,7 @@ fn parse_helper(pat: &mut &str, result: &mut Vec) -> Result<(), PatError> chr = iter.next().cloned().ok_or(PatError::ManyInvalid)?; match chr { b'-' | b']' => break, - chr @ b'0'...b'9' => { + chr @ b'0'..=b'9' => { at_least_one_char = true; lower_bound = lower_bound * 10 + (chr - b'0') as u32; if lower_bound >= 16384 { @@ -432,7 +432,7 @@ fn parse_helper(pat: &mut &str, result: &mut Vec) -> Result<(), PatError> chr = iter.next().cloned().ok_or(PatError::ManyInvalid)?; match chr { b']' => break, - chr @ b'0'...b'9' => { + chr @ b'0'..=b'9' => { upper_bound = upper_bound * 10 + (chr - b'0') as u32; if upper_bound >= 16384 { return Err(PatError::ManyOverflow); @@ -454,7 +454,7 @@ fn parse_helper(pat: &mut &str, result: &mut Vec) -> Result<(), PatError> } }, // Match a byte - b'0'...b'9' | b'A'...b'F' | b'a'...b'f' => { + b'0'..=b'9' | b'A'..=b'F' | b'a'..=b'f' => { // High nibble of the byte let hi = if chr >= b'a' { chr - b'a' + 10 } else if chr >= b'A' { chr - b'A' + 10 } diff --git a/src/util/c_str.rs b/src/util/c_str.rs index 334e9fcf..2075c304 100644 --- a/src/util/c_str.rs +++ b/src/util/c_str.rs @@ -129,7 +129,7 @@ impl fmt::Debug for CStr { bytes = &bytes[1..]; f.write_str("\\\\")?; }, - 0x20...0x7E => { + 0x20..=0x7E => { let (s, tail) = split_f(bytes, |&byte| byte < 0x20 || byte >= 0x80 || byte == b'"' || byte == b'\\'); bytes = tail; let s = unsafe { str::from_utf8_unchecked(s) };