From 14810b7fc8e6d383d031540b600fb58a1a825b42 Mon Sep 17 00:00:00 2001 From: Dennis Ranke Date: Tue, 16 Nov 2021 07:52:06 +0100 Subject: [PATCH] fix export section not written when needed --- default.nix | 6 ++++++ uw8-tool/src/main.rs | 3 ++- uw8-tool/src/pack.rs | 15 +++++++-------- 3 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..7aadcee --- /dev/null +++ b/default.nix @@ -0,0 +1,6 @@ +with import {}; +stdenv.mkDerivation { + name = "dev-environment"; # Probably put a more meaningful name here + buildInputs = [ pkg-config libxkbcommon ]; +} + diff --git a/uw8-tool/src/main.rs b/uw8-tool/src/main.rs index 797eff2..766a1e0 100644 --- a/uw8-tool/src/main.rs +++ b/uw8-tool/src/main.rs @@ -44,6 +44,7 @@ fn print_help() { println!( "Usage: uw8-tool make-base - uw8-tool pack " + uw8-tool pack + uw8-tool unpack " ); } diff --git a/uw8-tool/src/pack.rs b/uw8-tool/src/pack.rs index db091de..19855d6 100644 --- a/uw8-tool/src/pack.rs +++ b/uw8-tool/src/pack.rs @@ -370,21 +370,20 @@ impl<'a> ParsedModule<'a> { } { - let mut base_exports = base.exports.clone(); - base_exports.sort(); + let base_exports = base.exports.clone(); - let mut my_exports: Vec<(String, u32)> = self + let my_exports: Vec<(String, u32)> = self .exports .data .iter() .map(|(name, func)| (name.clone(), *function_map.get(func).unwrap())) .collect(); - my_exports.sort(); - if base_exports - .iter() - .zip(my_exports.iter()) - .any(|((n1, t1), (n2, t2))| n1 != n2 && t1 != t2) + if base_exports.len() != my_exports.len() + || base_exports + .iter() + .zip(my_exports.iter()) + .any(|((n1, t1), (n2, t2))| n1 != n2 || t1 != t2) { let mut export_section = enc::ExportSection::new(); for (name, fnc) in my_exports {