diff --git a/src/com/bytezone/diskbrowser/pascal/CatalogEntry.java b/src/com/bytezone/diskbrowser/pascal/CatalogEntry.java index 015a758..681993d 100644 --- a/src/com/bytezone/diskbrowser/pascal/CatalogEntry.java +++ b/src/com/bytezone/diskbrowser/pascal/CatalogEntry.java @@ -29,7 +29,8 @@ abstract class CatalogEntry implements AppleFileSource firstBlock = HexFormatter.intValue (buffer[0], buffer[1]); lastBlock = HexFormatter.intValue (buffer[2], buffer[3]); - fileType = HexFormatter.intValue (buffer[4], buffer[5]); + // fileType = HexFormatter.intValue (buffer[4], buffer[5]); + fileType = buffer[4] & 0xFF; name = HexFormatter.getPascalString (buffer, 6); bytesUsedInLastBlock = HexFormatter.intValue (buffer[16], buffer[17]); @@ -71,6 +72,8 @@ abstract class CatalogEntry implements AppleFileSource public String toString () { int size = lastBlock - firstBlock; - return String.format ("%03d %s %-15s", size, parent.fileTypes[fileType], name); + String fileTypeText = fileType < 0 || fileType >= parent.fileTypes.length ? "????" + : parent.fileTypes[fileType]; + return String.format ("%03d %s %-15s", size, fileTypeText, name); } } \ No newline at end of file diff --git a/src/com/bytezone/diskbrowser/pascal/PascalDisk.java b/src/com/bytezone/diskbrowser/pascal/PascalDisk.java index bbd6fd2..7949d51 100755 --- a/src/com/bytezone/diskbrowser/pascal/PascalDisk.java +++ b/src/com/bytezone/diskbrowser/pascal/PascalDisk.java @@ -264,9 +264,10 @@ public class PascalDisk extends AbstractFormattedDisk usedBlocks += size; date = ce.date == null ? "--" : df.format (ce.date.getTime ()); int bytes = (size - 1) * 512 + ce.bytesUsedInLastBlock; + String fileType = ce.fileType < 0 || ce.fileType >= fileTypes.length ? "????" + : fileTypes[ce.fileType]; text.append (String.format ("%4d %-15s %s %8s %,8d $%03X $%03X $%03X%n", - size, ce.name, fileTypes[ce.fileType], date, bytes, ce.firstBlock, ce.lastBlock, - size)); + size, ce.name, fileType, date, bytes, ce.firstBlock, ce.lastBlock, size)); } text.append (line); text.append ( diff --git a/src/com/bytezone/diskbrowser/utilities/Utility.java b/src/com/bytezone/diskbrowser/utilities/Utility.java index b8e91a2..1cb3ad8 100644 --- a/src/com/bytezone/diskbrowser/utilities/Utility.java +++ b/src/com/bytezone/diskbrowser/utilities/Utility.java @@ -9,7 +9,7 @@ import java.util.List; public class Utility { public static final List suffixes = - Arrays.asList ("po", "dsk", "do", "hdv", "2mg", "v2d", "nib", "d13", "sdk"); + Arrays.asList ("po", "dsk", "do", "hdv", "2mg", "v2d", "d13", "sdk"); // not used - it doesn't work with Oracle's JDK private static boolean hasRetinaDisplay ()