Skip to content

Commit

Permalink
Rename to CoffImportFIle
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Jun 19, 2023
1 parent 5fe4485 commit 3840ff1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions crates/examples/src/objdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn print<W: Write, E: Write>(
writeln!(w)?;
writeln!(w, "{}:", String::from_utf8_lossy(member.name()))?;
if let Ok(data) = member.data(file) {
if FileKind::parse(data) == Ok(FileKind::MsImportFile) {
if FileKind::parse(data) == Ok(FileKind::CoffImportFile) {
dump_import(w, e, data)?;
} else {
dump_object(w, e, data)?;
Expand Down Expand Up @@ -252,7 +252,7 @@ fn dump_parsed_object<W: Write, E: Write>(w: &mut W, e: &mut E, file: &object::F
}

fn dump_import<W: Write, E: Write>(w: &mut W, e: &mut E, data: &[u8]) -> Result<()> {
let file = match coff::MsImportFile::parse(data) {
let file = match coff::CoffImportFile::parse(data) {
Ok(import) => import,
Err(err) => {
writeln!(e, "Failed to parse short import: {}", err)?;
Expand Down
4 changes: 2 additions & 2 deletions src/read/coff/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use crate::{pe, ByteString, Bytes, LittleEndian as LE};
/// A Windows short form description of a symbol to import.
/// Used in Windows import libraries. This is not an object file.
#[derive(Debug, Clone)]
pub struct MsImportFile<'data> {
pub struct CoffImportFile<'data> {
header: &'data pe::ImportObjectHeader,
dll: ByteString<'data>,
symbol: ByteString<'data>,
kind: ImportType,
import: Option<ByteString<'data>>,
}
impl<'data> MsImportFile<'data> {
impl<'data> CoffImportFile<'data> {
/// Parse it.
pub fn parse<R: ReadRef<'data>>(data: R) -> Result<Self> {
let mut offset = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ pub enum FileKind {
/// This supports a larger number of sections.
#[cfg(feature = "coff")]
CoffBig,
/// A Windows short import file.
#[cfg(feature = "coff")]
CoffImportFile,
/// A dyld cache file containing Mach-O images.
#[cfg(feature = "macho")]
DyldCache,
Expand All @@ -165,9 +168,6 @@ pub enum FileKind {
/// A 64-bit ELF file.
#[cfg(feature = "elf")]
Elf64,
/// A Windows short import file.
#[cfg(feature = "coff")]
MsImportFile,
/// A 32-bit Mach-O file.
#[cfg(feature = "macho")]
MachO32,
Expand Down Expand Up @@ -267,7 +267,7 @@ impl FileKind {
#[cfg(feature = "xcoff")]
[0x01, 0xF7, ..] => FileKind::Xcoff64,
#[cfg(feature = "coff")]
[0, 0, 0xFF, 0xFF, ..] => FileKind::MsImportFile,
[0, 0, 0xFF, 0xFF, ..] => FileKind::CoffImportFile,
_ => return Err(Error("Unknown file magic")),
};
Ok(kind)
Expand Down

0 comments on commit 3840ff1

Please sign in to comment.