Skip to content

Commit

Permalink
Housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
strazzere committed May 10, 2015
1 parent 7a6743a commit c3b2479
Showing 1 changed file with 5 additions and 9 deletions.
Expand Up @@ -37,17 +37,9 @@ public void readHeader(IntReader inputReader) throws IOException {
stringChunkFlags = inputReader.readInt();

stringChunkPoolOffset = inputReader.readInt();
// TODO : Check that these loose conditions are ok to abide by
if ((stringChunkCount != 0) || (stringChunkPoolOffset != 0)) {
//
}
stringChunkPool = new ArrayList<PoolItem>();

styleChunkPoolOffset = inputReader.readInt();
// TODO : Check that these loose conditions are ok to abide by
if ((styleChunkCount != 0) || (styleChunkPoolOffset != 0)) {
//
}
styleChunkPool = new ArrayList<PoolItem>();
}

Expand All @@ -56,14 +48,17 @@ public void readSection(IntReader inputReader) throws IOException {
for (int i = 0; i < stringChunkCount; i++) {
stringChunkPool.add(new PoolItem(inputReader.readInt(), null));
}

if (!stringChunkPool.isEmpty()) {
readPool(stringChunkPool, stringChunkCount, stringChunkFlags, inputReader);
}

// TODO : Does this need the flags?
// FIXME: This is potentially wrong
for (int i = 0; i < styleChunkCount; i++) {
styleChunkPool.add(new PoolItem(inputReader.readInt(), null));
}

if (!styleChunkPool.isEmpty()) {
readPool(styleChunkPool, styleChunkCount, stringChunkFlags, inputReader);
}
Expand All @@ -85,6 +80,7 @@ private void readPool(ArrayList<PoolItem> pool, int poolSize, int flags, IntRead
length = inputReader.readShort();
offset += 2;
}

StringBuilder result = new StringBuilder(length);
for (; length != 0; length -= 1) {
if ((flags & UTF8_FLAG) != 0) {
Expand All @@ -95,6 +91,7 @@ private void readPool(ArrayList<PoolItem> pool, int poolSize, int flags, IntRead
offset += 2;
}
}

item.setString(result.toString());
}
}
Expand All @@ -108,7 +105,6 @@ public String getString(int index) {
return "";
}

// FIXME: This is potentially wrong
public String getStyle(int index) {
return styleChunkPool.get(index).getString();
}
Expand Down

0 comments on commit c3b2479

Please sign in to comment.