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
@@ -17,10 +17,7 @@ package ghidra.app.util.bin.format.coff.archive;
public final class CoffArchiveConstants {
public final static String MAGIC = "!<arch>\n";
public final static int MAGIC_LEN = MAGIC.length();
public static final int MAGIC_LEN_CONST_EXPR = 8;
public static final String MAGIC = "!<arch>\n";
public static final int MAGIC_LEN = MAGIC.length();
public static final byte[] MAGIC_BYTES = MAGIC.getBytes();
public final static String END_OF_HEADER_MAGIC = "'\n";
}
@@ -47,8 +47,8 @@ public final class CoffArchiveHeader implements StructConverter {
* @throws IOException
*/
public static boolean isMatch(ByteProvider provider) throws IOException {
return (provider.length() > 2) && CoffArchiveConstants.MAGIC.equals(
new String(provider.readBytes(0, CoffArchiveConstants.MAGIC_LEN)));
return (provider.length() > CoffArchiveConstants.MAGIC_LEN) && CoffArchiveConstants.MAGIC
.equals(new String(provider.readBytes(0, CoffArchiveConstants.MAGIC_LEN)));
}
/**
@@ -30,7 +30,7 @@ import utilities.util.ArrayUtilities;
public class CoffArchiveFileSystemFactory
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
public CoffArchiveFileSystem create(FSRL containerFSRL, FSRLRoot targetFSRL,