GP-652 Minor correction and cleanup of CoffArchive support

This commit is contained in:
ghidra1
2021-02-01 19:33:40 -05:00
parent 3bccb8ce65
commit 9a4918213b
3 changed files with 5 additions and 8 deletions

View File

@@ -17,10 +17,7 @@ package ghidra.app.util.bin.format.coff.archive;
public final class CoffArchiveConstants { public final class CoffArchiveConstants {
public final static String MAGIC = "!<arch>\n"; public static final String MAGIC = "!<arch>\n";
public final static int MAGIC_LEN = MAGIC.length(); public static final int MAGIC_LEN = MAGIC.length();
public static final int MAGIC_LEN_CONST_EXPR = 8;
public static final byte[] MAGIC_BYTES = MAGIC.getBytes(); public static final byte[] MAGIC_BYTES = MAGIC.getBytes();
public final static String END_OF_HEADER_MAGIC = "'\n";
} }

View File

@@ -47,8 +47,8 @@ public final class CoffArchiveHeader implements StructConverter {
* @throws IOException * @throws IOException
*/ */
public static boolean isMatch(ByteProvider provider) throws IOException { public static boolean isMatch(ByteProvider provider) throws IOException {
return (provider.length() > 2) && CoffArchiveConstants.MAGIC.equals( return (provider.length() > CoffArchiveConstants.MAGIC_LEN) && CoffArchiveConstants.MAGIC
new String(provider.readBytes(0, CoffArchiveConstants.MAGIC_LEN))); .equals(new String(provider.readBytes(0, CoffArchiveConstants.MAGIC_LEN)));
} }
/** /**

View File

@@ -30,7 +30,7 @@ import utilities.util.ArrayUtilities;
public class CoffArchiveFileSystemFactory public class CoffArchiveFileSystemFactory
implements GFileSystemFactoryFull<CoffArchiveFileSystem>, GFileSystemProbeBytesOnly { implements GFileSystemFactoryFull<CoffArchiveFileSystem>, GFileSystemProbeBytesOnly {
public static final int PROBE_BYTES_REQUIRED = CoffArchiveConstants.MAGIC_LEN_CONST_EXPR; public static final int PROBE_BYTES_REQUIRED = CoffArchiveConstants.MAGIC_LEN;
@Override @Override
public CoffArchiveFileSystem create(FSRL containerFSRL, FSRLRoot targetFSRL, public CoffArchiveFileSystem create(FSRL containerFSRL, FSRLRoot targetFSRL,