removed many code warnings

This commit is contained in:
Denis Molony 2018-04-26 06:41:03 +10:00
parent 058da1da91
commit c22dd51ef8
26 changed files with 121 additions and 114 deletions

View File

@ -12,7 +12,7 @@ public class BasicProgram extends AbstractFile
{
private static final byte ASCII_QUOTE = 0x22;
private static final byte ASCII_COLON = 0x3A;
private static final byte ASCII_SEMI_COLON = 0x3B;
// private static final byte ASCII_SEMI_COLON = 0x3B;
private static final byte ASCII_CARET = 0x5E;
private static final byte TOKEN_FOR = (byte) 0x81;

View File

@ -26,6 +26,7 @@ public class DeviceDriver extends AbstractFile
text.append (String.format ("Classifications ... %02X%n", classifications));
text.append (String.format ("Driver Class ...... %02X%n", driverClass));
text.append (String.format ("Aux type .......... %d%n", auxType));
text.append (String.format ("Inactive .......... %s%n", inactive ? "True" : "False"));
text.deleteCharAt (text.length () - 1);

View File

@ -25,7 +25,7 @@ public class DoubleScrunch extends CPU
final byte[][] memory = new byte[2][0x2000];
private byte[] packedBuffer;
private final boolean debug = false;
// private final boolean debug = false;
private int count;
private final int[] rows = new int[192];
private int ptr;

View File

@ -12,24 +12,23 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class IconFile extends AbstractFile
{
private static Palette palette = new Palette ("Virtual II",
new int[] { 0x000000, // 0 black
0xDD0033, // 1 magenta
0x885500, // 2 brown (8)
0xFF6600, // 3 orange (9)
0x007722, // 4 dark green
0x555555, // 5 grey1
0x11DD00, // 6 light green (C)
0xFFFF00, // 7 yellow (D)
0x000099, // 8 dark blue (2)
0xDD22DD, // 9 purple (3)
0xAAAAAA, // A grey2
0xFF9988, // B pink
0x2222FF, // C med blue (6)
0x66AAFF, // D light blue (7)
0x44FF99, // E aqua
0xFFFFFF // F white
});
private static Palette palette = new Palette ("Virtual II", new int[] { 0x000000, // 0 black
0xDD0033, // 1 magenta
0x885500, // 2 brown (8)
0xFF6600, // 3 orange (9)
0x007722, // 4 dark green
0x555555, // 5 grey1
0x11DD00, // 6 light green (C)
0xFFFF00, // 7 yellow (D)
0x000099, // 8 dark blue (2)
0xDD22DD, // 9 purple (3)
0xAAAAAA, // A grey2
0xFF9988, // B pink
0x2222FF, // C med blue (6)
0x66AAFF, // D light blue (7)
0x44FF99, // E aqua
0xFFFFFF // F white
});
// private static Palette palette = new Palette ("Icon palette",
// new int[] { 0x000000, // 0 black
// 0x2222FF, // C med blue (6)
@ -213,7 +212,7 @@ public class IconFile extends AbstractFile
System.arraycopy (buffer, ptr + 8 + iconSize, iconMask, 0, iconSize);
int[] colours = palette.getColours ();
int gap = 5;
// int gap = 5;
image = new BufferedImage (iconWidth, iconHeight, BufferedImage.TYPE_INT_RGB);

View File

@ -197,7 +197,7 @@ public class PascalSegment extends AbstractFile implements PascalConstants
private String getMultiDiskAddresses ()
{
String multiDiskAddressText = "";
int sizeInBlocks = (size - 1) / BLOCK_SIZE + 1;
// int sizeInBlocks = (size - 1) / BLOCK_SIZE + 1;
// if (segmentNoHeader == 1) // main segment
// {

View File

@ -189,9 +189,9 @@ public class QuickDrawFont extends AbstractFile
// how the character image to be drawn should be positioned with
// respect to the current pen location
int offset = buffer[offsetWidthTableOffset + i * 2 + 1];
// int offset = buffer[offsetWidthTableOffset + i * 2 + 1];
// how far the pen should be advanced after the character is drawn
int width = buffer[offsetWidthTableOffset + i * 2] & 0xFF;
// int width = buffer[offsetWidthTableOffset + i * 2] & 0xFF;
if (character != null)
g2d.drawImage (character.image, x, y, null);

View File

@ -83,7 +83,7 @@ public class SHRPictureFile extends HiResImage
for (int row = 0; row < mainBlock.numScanLines; row++)
{
DirEntry dirEntry = mainBlock.scanLineDirectory[row];
int hi = dirEntry.mode & 0xFF00;
// int hi = dirEntry.mode & 0xFF00;
int lo = dirEntry.mode & 0x00FF;
ColorTable colorTable = multipalBlock != null ? multipalBlock.colorTables[row]

View File

@ -27,15 +27,15 @@ public class WizardryTitle extends AbstractFile
return text.toString ();
}
private StringBuilder decode (int value, StringBuilder text)
{
for (int bit = 0; bit < 8; bit++)
{
text.append ((value & 0x01) == 1 ? "X" : " ");
value >>= 1;
}
return text;
}
// private StringBuilder decode (int value, StringBuilder text)
// {
// for (int bit = 0; bit < 8; bit++)
// {
// text.append ((value & 0x01) == 1 ? "X" : " ");
// value >>= 1;
// }
// return text;
// }
private StringBuilder decode2 (int value, StringBuilder text)
{

View File

@ -141,6 +141,7 @@ public class AppleworksADBFile extends AbstractFile
text.append (String.format ("Categories ......... %d%n", categories));
text.append (String.format ("Reports ............ %d%n", totalReports));
text.append (String.format ("Records ............ %d%n", totalRecords));
text.append (String.format ("Standard Record .... %s%n", standardRecord != null));
text.append (String.format ("Min version ........ %d%n", dbMinVersion));
text.append (String.format ("1st Frozen col ..... %d%n", firstFrozenColumn));
text.append (String.format ("Last Frozen col .... %d%n", lastFrozenColumn));

View File

@ -48,8 +48,9 @@ public class AppleworksWPFile extends AbstractFile
int textLen = b4 & 0x7F;
boolean cr = (b4 & 0x80) != 0;
// System.out.printf ("%02X %02X %d %d %s %s%n", b3, b4, margin, textLen,
// containsTabs, cr);
if (false)
System.out.printf ("%02X %02X %d %d %s %s%n", b3, b4, lineMargin, textLen,
containsTabs, cr);
if (b3 == 0xFF)
text.append ("--------- Ruler ----------\n");
else
@ -137,6 +138,9 @@ public class AppleworksWPFile extends AbstractFile
}
ptr += 2;
}
if (false)
System.out.printf ("", leftMargin, rightMargin, topMargin, bottomMargin,
paperLength, indent);
return text.toString ();
}
@ -182,6 +186,8 @@ public class AppleworksWPFile extends AbstractFile
text.append (String.format ("Mail merge ... %s %n", mailMerge));
text.append (String.format ("Left margin .. %d %n", leftMargin));
text.append (String.format ("Min version .. %d %n", sfMinVers));
text.append (String.format ("Mult rulers .. %s %n", multipleRulers));
text.append (String.format ("Paginated .... %s %n", paginated));
return text.toString ();
}

View File

@ -190,9 +190,7 @@ public class AppleDisk implements Disk
{
BufferedInputStream in = new BufferedInputStream (new FileInputStream (file));
if (skip > 0)
{
long result = in.skip (skip);
}
in.skip (skip);
in.read (diskBuffer);
in.close ();
}

View File

@ -580,7 +580,7 @@ public class DiskFactory
String fileName = file.getAbsolutePath ().toLowerCase ();
int pos = file.getAbsolutePath ().indexOf ('.');
char c = fileName.charAt (pos - 1);
String suffix = fileName.substring (pos + 1);
// String suffix = fileName.substring (pos + 1);
int requiredDisks = c == '1' ? 6 : c == 'a' ? 10 : 0;
if (requiredDisks > 0)

View File

@ -12,10 +12,10 @@ public class Nibblizer
{ { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 },
{ 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 } };
private static final int DOS = 0;
private static final int PRODOS = 1;
private static final int BLOCK_SIZE = 256;
private static final int TRACK_SIZE = 4096;
static final int DOS = 0;
static final int PRODOS = 1;
static final int BLOCK_SIZE = 256;
static final int TRACK_SIZE = 4096;
private static final int RAW_BUFFER_SIZE = 342;
private static final int BUFFER_WITH_CHECKSUM_SIZE = RAW_BUFFER_SIZE + 1;

View File

@ -32,12 +32,12 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class V2dDisk
{
private static int[][] interleave =
{ { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 },
{ 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 } };
// private static int[][] interleave =
// { { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 },
// { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 } };
private static final int DOS = 0;
private static final int PRODOS = 1;
// private static final int DOS = 0;
// private static final int PRODOS = 1;
private static final int TRACK_LENGTH = 6304;

View File

@ -274,7 +274,7 @@ abstract class AbstractCatalogEntry implements AppleFileSource
byte[] exactBuffer;
// int loadAddress = HexFormatter.intValue (buffer[0], buffer[1]);
int loadAddress = HexFormatter.unsignedShort (buffer, 0);
// int loadAddress = HexFormatter.unsignedShort (buffer, 0);
// int reportedLength = HexFormatter.intValue (buffer[2], buffer[3]);
int reportedLength = HexFormatter.unsignedShort (buffer, 2);
if (reportedLength == 0)

View File

@ -1,7 +1,7 @@
package com.bytezone.diskbrowser.gui;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.net.URL;
import java.util.ArrayList;
@ -25,13 +25,15 @@ class RedoHandler implements FileSelectionListener, DiskSelectionListener,
public RedoHandler (JRootPane jRootPane, JToolBar toolBar)
{
// This code works as long as the toolBar arrows have focus first
InputMap im = jRootPane.getInputMap (JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap am = jRootPane.getActionMap ();
InputMap inputMap = jRootPane.getInputMap (JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap actionMap = jRootPane.getActionMap ();
im.put (KeyStroke.getKeyStroke (KeyEvent.VK_LEFT, Event.ALT_MASK), "LeftAction");
am.put ("LeftAction", leftAction);
im.put (KeyStroke.getKeyStroke (KeyEvent.VK_RIGHT, Event.ALT_MASK), "RightAction");
am.put ("RightAction", rightAction);
inputMap.put (KeyStroke.getKeyStroke (KeyEvent.VK_LEFT, InputEvent.ALT_DOWN_MASK),
"LeftAction");
actionMap.put ("LeftAction", leftAction);
inputMap.put (KeyStroke.getKeyStroke (KeyEvent.VK_RIGHT, InputEvent.ALT_DOWN_MASK),
"RightAction");
actionMap.put ("RightAction", rightAction);
toolBar.add (leftAction);
toolBar.add (rightAction);

View File

@ -15,7 +15,7 @@ class Dictionary extends AbstractFile
private final int totalSeparators;
private final int dictionaryPtr, dictionarySize;
private final int entryLength;
private final Header header;
// private final Header header;
// this could be a Google Multimap
Map<Integer, List<WordEntry>> synonymList = new TreeMap<Integer, List<WordEntry>> ();
@ -23,7 +23,7 @@ class Dictionary extends AbstractFile
public Dictionary (Header header)
{
super ("Dictionary", header.buffer);
this.header = header;
// this.header = header;
dictionaryPtr = header.dictionaryOffset;
dictionary = new TreeMap<Integer, ZString> ();
@ -142,9 +142,8 @@ class Dictionary extends AbstractFile
for (ZString word : dictionary.values ())
{
text.append (String
.format ("%04X %3d %-6s %s", ptr, count++, word.value,
HexFormatter.getHexString (buffer, ptr + 4, entryLength - 4)));
text.append (String.format ("%04X %3d %-6s %s", ptr, count++, word.value,
HexFormatter.getHexString (buffer, ptr + 4, entryLength - 4)));
int b1 = buffer[ptr + 4] & 0xFF;
int b2 = buffer[ptr + 5] & 0xFF;
int b3 = buffer[ptr + 6] & 0xFF;
@ -235,10 +234,9 @@ class Dictionary extends AbstractFile
StringBuilder text = new StringBuilder ();
text.append (String.format ("%04X %3d %-6s %s %s %s", word.startPtr, seq,
word.value, bits,
HexFormatter.getHexString (buffer, word.startPtr + 4,
entryLength - 4),
list.toString ()));
word.value, bits,
HexFormatter.getHexString (buffer, word.startPtr + 4, entryLength - 4),
list.toString ()));
return text.toString ();
}
}

View File

@ -9,7 +9,7 @@ class Header extends InfocomAbstractFile
final String[] propertyNames = new String[32];
private final File file;
private final Disk disk;
// private final Disk disk;
int version;
int highMemory;
int programCounter;
@ -33,7 +33,7 @@ class Header extends InfocomAbstractFile
public Header (String name, byte[] buffer, Disk disk)
{
super (name, buffer);
this.disk = disk;
// this.disk = disk;
this.file = disk.getFile ();
version = getByte (0);

View File

@ -10,7 +10,7 @@ class Routine extends InfocomAbstractFile
private static final String padding = " ";
int startPtr, length, strings, locals;
private final Header header;
// private final Header header;
List<Parameter> parameters = new ArrayList<Parameter> ();
List<Instruction> instructions = new ArrayList<Instruction> ();
@ -21,7 +21,7 @@ class Routine extends InfocomAbstractFile
public Routine (int ptr, Header header, int caller)
{
super (String.format ("Routine %05X", ptr), header.buffer);
this.header = header;
// this.header = header;
locals = buffer[ptr] & 0xFF;
if (locals > 15)
@ -134,7 +134,7 @@ class Routine extends InfocomAbstractFile
public String toString ()
{
return String.format ("%05X : L%02d : %d", (startPtr + (sequence - 1) * 2 + 1),
sequence, value);
sequence, value);
}
}

View File

@ -24,7 +24,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
private final int endOfFile;
private final int auxType;
private final GregorianCalendar modified;
private final int headerPointer;
// private final int headerPointer;
private DataSource file;
private final DiskAddress catalogBlock;
private DiskAddress masterIndexBlock;
@ -47,7 +47,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
auxType = HexFormatter.unsignedShort (entryBuffer, 0x1F);
modified = HexFormatter.getAppleDate (entryBuffer, 0x21);
headerPointer = HexFormatter.unsignedShort (entryBuffer, 0x25);
// headerPointer = HexFormatter.unsignedShort (entryBuffer, 0x25);
if (isGSOSFile ()) // I think this is wrong
System.out.printf ("************************************ %s is GS/OS%n", name);
@ -110,7 +110,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
{
int storageType = buffer2[i] & 0x0F;
int keyBlock = HexFormatter.unsignedShort (buffer2, i + 1);
int eof = HexFormatter.intValue (buffer2[i + 3], buffer2[i + 4], buffer2[i + 5]);
// int eof = HexFormatter.intValue (buffer2[i + 3], buffer2[i + 4], buffer2[i + 5]);
addDataBlocks (storageType, keyBlock);
}
}

View File

@ -27,7 +27,7 @@ class ProdosBitMapSector extends AbstractSector
// more than a single block
int relativeBlock = diskAddress.getBlock () - parent.vdh.bitMapBlock;
int startBit = relativeBlock * 4096;
int endBit = startBit + 4096;
// int endBit = startBit + 4096;
if (startBit >= grid.width * grid.height)
return "This sector is not used - the physical file size makes it unnecessary";

View File

@ -20,14 +20,9 @@ class SubDirectoryHeader extends DirectoryHeader
parentPointer = HexFormatter.intValue (entryBuffer[35], entryBuffer[36]);
parentSequence = entryBuffer[37] & 0xFF;
parentSize = entryBuffer[38] & 0xFF;
}
@Override
public String toString ()
{
String locked = (access == 0x01) ? "*" : " ";
return String.format (" %s%-40s %15s", locked, "/" + name,
parentDisk.df.format (created.getTime ()));
if (false)
System.out.printf ("", parentPointer, parentSequence, parentSize);
}
@Override
@ -42,4 +37,12 @@ class SubDirectoryHeader extends DirectoryHeader
{
return null;
}
@Override
public String toString ()
{
String locked = (access == 0x01) ? "*" : " ";
return String.format (" %s%-40s %15s", locked, "/" + name,
parentDisk.df.format (created.getTime ()));
}
}

View File

@ -1,7 +1,6 @@
package com.bytezone.diskbrowser.utilities;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import java.awt.geom.AffineTransform;
import java.util.Arrays;
import java.util.List;
@ -12,18 +11,18 @@ public class Utility
Arrays.asList ("po", "dsk", "do", "hdv", "2mg", "v2d", "d13", "sdk");
// not used - it doesn't work with Oracle's JDK
private static boolean hasRetinaDisplay ()
{
Object obj =
Toolkit.getDefaultToolkit ().getDesktopProperty ("apple.awt.contentScaleFactor");
if (obj instanceof Float)
{
Float f = (Float) obj;
int scale = f.intValue ();
return (scale == 2); // 1 indicates a regular mac display.
}
return false;
}
// private static boolean hasRetinaDisplay ()
// {
// Object obj =
// Toolkit.getDefaultToolkit ().getDesktopProperty ("apple.awt.contentScaleFactor");
// if (obj instanceof Float)
// {
// Float f = (Float) obj;
// int scale = f.intValue ();
// return (scale == 2); // 1 indicates a regular mac display.
// }
// return false;
// }
public static boolean test (Graphics2D g)
{

View File

@ -350,13 +350,13 @@ public class Sheet
+ " ";
String underline = "---------------------------------------------------------"
+ "-----------------------------------------------------------------";
String left = "";
String right = "";
if (columnWidth > 2)
{
left = underline.substring (0, (columnWidth - 2) / 2);
right = underline.substring (0, columnWidth - 3 - left.length ()) + "+";
}
// String left = "";
// String right = "";
// if (columnWidth > 2)
// {
// left = underline.substring (0, (columnWidth - 2) / 2);
// right = underline.substring (0, columnWidth - 3 - left.length ()) + "+";
// }
int lastRow = 0;
int lastColumn = 0;

View File

@ -173,16 +173,16 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
return s1 + " : " + s2;
}
private void split (int offset, int length)
{
for (int p = offset; length > 0; p += 16, length -= 16)
{
int len = length > 15 ? 16 : length;
String s = HexFormatter.getHexString (buffer, p, len);
System.out.println (s);
}
System.out.println ();
}
// private void split (int offset, int length)
// {
// for (int p = offset; length > 0; p += 16, length -= 16)
// {
// int len = length > 15 ? 16 : length;
// String s = HexFormatter.getHexString (buffer, p, len);
// System.out.println (s);
// }
// System.out.println ();
// }
@Override
public String toString ()

View File

@ -428,7 +428,7 @@ public class WizardryScenarioDisk extends PascalDisk
offset += max;
}
int id = 0;
// int id = 0;
int totalLines = 0;
for (int ptr = 0; ptr < buffer.length; ptr += recordLength)
@ -463,7 +463,7 @@ public class WizardryScenarioDisk extends PascalDisk
}
}
addToNode (m, node, messageBlocks, messageSector);
id += totalLines;
// id += totalLines;
totalLines = 0;
}
}