StringBlock: changed type of m_strings from int[] to byte[].

This commit is contained in:
Ryszard Wiśniewski 2010-06-03 12:51:44 +02:00
parent 397d69c72a
commit a7fd5fd70a

View File

@ -54,7 +54,8 @@ public class StringBlock {
if ((size % 4) != 0) { if ((size % 4) != 0) {
throw new IOException("String data size is not multiple of 4 (" + size + ")."); throw new IOException("String data size is not multiple of 4 (" + size + ").");
} }
block.m_strings = reader.readIntArray(size / 4); block.m_strings = new byte[size];
reader.readFully(block.m_strings);
} }
if (stylesOffset != 0) { if (stylesOffset != 0) {
int size = (chunkSize - stylesOffset); int size = (chunkSize - stylesOffset);
@ -227,6 +228,10 @@ public class StringBlock {
return style; return style;
} }
private static final int getShort(byte[] array, int offset) {
return (array[offset + 1] & 0xff) << 8 | array[offset] & 0xff;
}
private static final int getShort(int[] array, int offset) { private static final int getShort(int[] array, int offset) {
int value = array[offset / 4]; int value = array[offset / 4];
if ((offset % 4) / 2 == 0) { if ((offset % 4) / 2 == 0) {
@ -236,7 +241,7 @@ public class StringBlock {
} }
} }
private int[] m_stringOffsets; private int[] m_stringOffsets;
private int[] m_strings; private byte[] m_strings;
private int[] m_styleOffsets; private int[] m_styleOffsets;
private int[] m_styles; private int[] m_styles;
private static final int CHUNK_TYPE = 0x001C0001; private static final int CHUNK_TYPE = 0x001C0001;