Skip to content

Commit

Permalink
Formatting changes and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Gonzales committed Aug 6, 2015
1 parent f9d4de7 commit 23b5a83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
14 changes: 5 additions & 9 deletions src/com/pnf/plugin/fat/FatPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import com.pnfsoftware.jeb.util.logging.ILogger;

public class FatPlugin extends AbstractUnitIdentifier {
private static final String ID = "fat_plugin";
static final String ID = "fat";
private static final int[] FAT_BOOT_SIG = { (byte)0x55, (byte)0xAA };
private static final int FAT_BOOT_SIG_OFFSET = 0x200 - FAT_BOOT_SIG.length;
private static final int[] OBB_SIG = { (byte)0x83, (byte)0x99, (byte)0x05, (byte)0x01 };
Expand All @@ -59,13 +59,8 @@ public boolean canIdentify(IInput stream, IUnitCreator unit) {
isObb = false;
}

return !isObb && checkBytes(stream, FAT_BOOT_SIG_OFFSET, FAT_BOOT_SIG); // Then
// check
// for
// FAT
// boot
// sector
// signature
// Then check for FAT boot sector signature
return !isObb && checkBytes(stream, FAT_BOOT_SIG_OFFSET, FAT_BOOT_SIG);
}

public void initialize(IPropertyDefinitionManager parent) {
Expand All @@ -82,6 +77,7 @@ public IUnit prepare(String name, IInput data, IUnitProcessor processor, IUnitCr

@Override
public PluginInformation getPluginInformation() {
return new PluginInformation("FAT Plugin", "", "PNF Software", new Version(1, 0, 0));
return new PluginInformation("FAT Plugin", "Parser for FAT filesystem images", "PNF Software", new Version(1,
0, 0));
}
}
19 changes: 9 additions & 10 deletions src/com/pnf/plugin/fat/FatProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ public class FatProcessor {
*/
public FatProcessor(String name, byte[] stream) {
try {
RamDisk rd = RamDisk.read(stream); // Create in-memory
// representation of disk image
image = FatFileSystem.read(rd, true); // Open as read-only to
// prevent accidental writes
// Create in-memory representation of disk image
RamDisk rd = RamDisk.read(stream);

// Open as read-only to prevent accidental writes
image = FatFileSystem.read(rd, true);
}
catch(IOException e) {
}

type = image.getFatType().toString(); // Store type of FAT image
// Store type of FAT image
type = image.getFatType().toString();
root = new ContainerStream(null, name, false);

/* Create list of files */
Expand Down Expand Up @@ -107,11 +109,8 @@ private void addAll(ContainerStream parentDir, FsDirectory fatDir) {
readError = true;
}

new DocumentStream(parentDir, e.getName(), buff, readError); // constructor
// handles
// adding
// to
// parent
// constructor handles adding to parent
new DocumentStream(parentDir, e.getName(), buff, readError);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/com/pnf/plugin/fat/FatUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@
import com.pnfsoftware.jeb.util.IO;

public class FatUnit extends AbstractBinaryUnit {
private static final String FILE_TYPE = "fat_image";
private StringBuffer desc;
private boolean descSet = false;

public FatUnit(String name, IInput data, IUnitProcessor unitProcessor, IUnitCreator parent,
IPropertyDefinitionManager pdm) {
super(null, data, FILE_TYPE, name, unitProcessor, parent, pdm);
super(null, data, FatPlugin.ID, name, unitProcessor, parent, pdm);
}

public String getDescription() {
Expand Down

0 comments on commit 23b5a83

Please sign in to comment.