removing 64bit parameter where unnecessary

This commit is contained in:
Jindra Petřík
2016-11-27 09:21:35 +01:00
parent d2bdf8eb94
commit 7fcb962809
8 changed files with 10 additions and 33 deletions

View File

@@ -173,7 +173,7 @@ public class IggyFile implements StructureInterface {
}
private static boolean updateIndex(long item_offset /*uint32_t*/, boolean is_64, byte index_bytes[], long item_size_change /*int32_t*/) throws IOException {
ByteArrayDataStream stream = new ByteArrayDataStream(index_bytes, is_64);
ByteArrayDataStream stream = new ByteArrayDataStream(index_bytes);
/*
index_table:
@@ -389,7 +389,7 @@ public class IggyFile implements StructureInterface {
* @throws IOException
*/
private static Long itemLength(long item_offset /*uint32_t*/, boolean is_64, byte index_bytes[], Long newValue) throws IOException {
ByteArrayDataStream stream = new ByteArrayDataStream(index_bytes, is_64);
ByteArrayDataStream stream = new ByteArrayDataStream(index_bytes);
/*
index_table:
@@ -604,11 +604,11 @@ public class IggyFile implements StructureInterface {
for (int i = 0; i < subFileEntries.size(); i++) {
IggySubFileEntry entry = subFileEntries.get(i);
AbstractDataStream dataStream = new ByteArrayDataStream(getEntryData(i), header.is64());
AbstractDataStream dataStream = new ByteArrayDataStream(getEntryData(i));
if (entry.type == IggySubFileEntry.TYPE_INDEX) {
List<Integer> indexTable = new ArrayList<>();
List<Long> offsets = new ArrayList<>();
IggyIndexParser.parseIndex(dataStream, indexTable, offsets);
IggyIndexParser.parseIndex(header.is64(), dataStream, indexTable, offsets);
indexTables.add(indexTable);
offsetTables.add(offsets);
} else if (entry.type == IggySubFileEntry.TYPE_FLASH) {

View File

@@ -177,7 +177,7 @@ public class IggyFont extends IggyTag {
@Override
public void readFromDataStream(AbstractDataStream stream) throws IOException {
ByteArrayDataStream s = new ByteArrayDataStream(stream.readBytes((int) (long) stream.available()), stream.is64());
ByteArrayDataStream s = new ByteArrayDataStream(stream.readBytes((int) (long) stream.available()));
type = s.readUI16();
fontId = s.readUI16();
zeroone = s.readBytes(28);

View File

@@ -30,7 +30,7 @@ public class IggyIndexParser {
* @param offsets Output list of offsets
* @throws IOException on error
*/
public static void parseIndex(AbstractDataStream indexStream, List<Integer> indexTableEntry, List<Long> offsets) throws IOException {
public static void parseIndex(boolean is64, AbstractDataStream indexStream, List<Integer> indexTableEntry, List<Long> offsets) throws IOException {
int indexTableSize = indexStream.readUI8();
int[] indexTable = new int[indexTableSize];
for (int i = 0; i < indexTableSize; i++) {
@@ -90,7 +90,7 @@ public class IggyIndexParser {
n = n8 + 1;
if (indexStream.is64()) {
if (is64) {
if (i <= 2) {
offset += 8 * n; // Ptr type
} else if (i <= 4) {

View File

@@ -20,9 +20,6 @@ public abstract class AbstractDataStream implements DataStreamInterface {
@Override
public abstract long position();
@Override
public abstract boolean is64();
@Override
public long readUI64() throws IOException {
try {

View File

@@ -12,10 +12,9 @@ public class ByteArrayDataStream extends AbstractDataStream {
private byte[] data;
private long pos;
private boolean use64bit;
public ByteArrayDataStream(int initialSize, boolean use64bit) {
this(new byte[initialSize], use64bit);
public ByteArrayDataStream(int initialSize) {
this(new byte[initialSize]);
}
@Override
@@ -23,15 +22,9 @@ public class ByteArrayDataStream extends AbstractDataStream {
return pos;
}
public ByteArrayDataStream(byte data[], boolean use64bit) {
public ByteArrayDataStream(byte data[]) {
this.data = data;
pos = 0;
this.use64bit = use64bit;
}
@Override
public boolean is64() {
return use64bit;
}
@Override

View File

@@ -41,15 +41,6 @@ public class RandomAccessFileDataStream extends AbstractDataStream {
}
}
public void set64(boolean is64) {
this.is64 = is64;
}
@Override
public boolean is64() {
return is64;
}
@Override
public int read() throws IOException {
int val = raf.read();

View File

@@ -17,8 +17,6 @@ public interface ReadDataStreamInterface extends AutoCloseable {
public long position();
public boolean is64();
public long readUI64() throws IOException;
public long readUI32() throws IOException;

View File

@@ -17,8 +17,6 @@ public interface WriteDataStreamInterface extends AutoCloseable {
public long position();
public boolean is64();
public boolean writeUI64(long val) throws IOException;
public boolean writeUI32(long val) throws IOException;