Version 0.2.3
- Fix `ar create` on Windows - Clippy fixes
This commit is contained in:
parent
d76c554d31
commit
947874adfd
|
@ -3,7 +3,7 @@ name = "decomp-toolkit"
|
|||
description = "GameCube/Wii decompilation project tools."
|
||||
authors = ["Luke Street <luke@street.dev>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
build = "build.rs"
|
||||
|
|
|
@ -71,19 +71,16 @@ fn create(args: CreateArgs) -> Result<()> {
|
|||
let mut identifiers = Vec::with_capacity(files.len());
|
||||
let mut symbol_table = BTreeMap::new();
|
||||
for path in &files {
|
||||
let file_name = path.file_name().ok_or_else(|| {
|
||||
Error::msg(format!("'{}' is not a file path", path.to_string_lossy()))
|
||||
let path_str = path.to_str().ok_or_else(|| {
|
||||
Error::msg(format!("'{}' is not valid UTF-8", path.to_string_lossy()))
|
||||
})?;
|
||||
let file_name = file_name.to_str().ok_or_else(|| {
|
||||
Error::msg(format!("'{}' is not valid UTF-8", file_name.to_string_lossy()))
|
||||
})?;
|
||||
let identifier = file_name.as_bytes().to_vec();
|
||||
let identifier = path_str.as_bytes().to_vec();
|
||||
identifiers.push(identifier.clone());
|
||||
|
||||
let entries = match symbol_table.entry(identifier) {
|
||||
Entry::Vacant(e) => e.insert(Vec::new()),
|
||||
Entry::Occupied(_) => {
|
||||
return Err(Error::msg(format!("Duplicate file name '{file_name}'")))
|
||||
return Err(Error::msg(format!("Duplicate file name '{path_str}'")))
|
||||
}
|
||||
};
|
||||
let object_file = File::open(path)
|
||||
|
@ -103,7 +100,11 @@ fn create(args: CreateArgs) -> Result<()> {
|
|||
let mut builder =
|
||||
ar::GnuBuilder::new(out, identifiers, ar::GnuSymbolTableFormat::Size32, symbol_table)?;
|
||||
for path in files {
|
||||
builder.append_path(path)?;
|
||||
let path_str = path.to_str().ok_or_else(|| {
|
||||
Error::msg(format!("'{}' is not valid UTF-8", path.to_string_lossy()))
|
||||
})?;
|
||||
let mut file = File::open(&path)?;
|
||||
builder.append_file(path_str.as_bytes(), &mut file)?;
|
||||
}
|
||||
builder.into_inner()?.flush()?;
|
||||
Ok(())
|
||||
|
|
|
@ -90,7 +90,7 @@ fn disasm(args: DisasmArgs) -> Result<()> {
|
|||
let asm_dir = args.out.join("asm");
|
||||
let include_dir = args.out.join("include");
|
||||
DirBuilder::new().recursive(true).create(&include_dir)?;
|
||||
fs::write(&include_dir.join("macros.inc"), include_bytes!("../../assets/macros.inc"))?;
|
||||
fs::write(include_dir.join("macros.inc"), include_bytes!("../../assets/macros.inc"))?;
|
||||
|
||||
for (unit, split_obj) in obj.link_order.iter().zip(&split_objs) {
|
||||
let out_path = asm_dir.join(file_name_from_unit(unit, ".s"));
|
||||
|
|
|
@ -376,6 +376,7 @@ fn write_symbol_entry<W: Write>(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn write_data<W: Write>(
|
||||
w: &mut W,
|
||||
symbols: &[ObjSymbol],
|
||||
|
|
|
@ -78,7 +78,6 @@ pub fn process_elf<P: AsRef<Path>>(path: P) -> Result<ObjInfo> {
|
|||
relocations: vec![],
|
||||
original_address: 0, // TODO load from abs symbol
|
||||
file_offset: section.file_range().map(|(v, _)| v).unwrap_or_default(),
|
||||
section_known: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -119,7 +118,7 @@ pub fn process_elf<P: AsRef<Path>>(path: P) -> Result<ObjInfo> {
|
|||
match section_starts.entry(file_name.clone()) {
|
||||
indexmap::map::Entry::Occupied(_) => {
|
||||
let index = match name_to_index.entry(file_name.clone()) {
|
||||
hash_map::Entry::Occupied(mut e) => e.into_mut(),
|
||||
hash_map::Entry::Occupied(e) => e.into_mut(),
|
||||
hash_map::Entry::Vacant(e) => e.insert(0),
|
||||
};
|
||||
*index += 1;
|
||||
|
|
Loading…
Reference in New Issue