Skip to content

Commit

Permalink
Fix 'unknown' field in chunks.
Browse files Browse the repository at this point in the history
Thank you @CunningLogic for annoying about what this was,
forcing me to grok more AOSP code to find out it was a comment
index which is never used via the normal tooling from AOSP.
  • Loading branch information
strazzere committed Apr 21, 2016
1 parent 0e3dcc9 commit 7a2717c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/main/java/android/content/res/chunk/types/EndTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class EndTag extends GenericChunk implements Chunk {

private int lineNumber;
private int unknown;
private int commentIndex;
private int namespaceUri;
private int name;

Expand All @@ -48,7 +48,7 @@ public EndTag(ChunkType chunkType, IntReader inputReader) {
@Override
public void readHeader(IntReader inputReader) throws IOException {
lineNumber = inputReader.readInt();
unknown = inputReader.readInt();
commentIndex = inputReader.readInt();
namespaceUri = inputReader.readInt();
name = inputReader.readInt();
}
Expand Down Expand Up @@ -76,7 +76,7 @@ public byte[] toBytes() {
byte[] body = ByteBuffer.allocate(4 * 4)
.order(ByteOrder.LITTLE_ENDIAN)
.putInt(lineNumber)
.putInt(unknown)
.putInt(commentIndex)
.putInt(namespaceUri)
.putInt(name)
.array();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/android/content/res/chunk/types/NameSpace.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class NameSpace extends GenericChunk implements Chunk {

private int lineNumber;
private int unknown;
private int commentIndex;
private int prefix;
private int uri;

Expand All @@ -48,7 +48,7 @@ public NameSpace(ChunkType chunkType, IntReader inputReader) {
@Override
public void readHeader(IntReader inputReader) throws IOException {
lineNumber = inputReader.readInt();
unknown = inputReader.readInt();
commentIndex = inputReader.readInt();
prefix = inputReader.readInt();
uri = inputReader.readInt();
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public byte[] toBytes() {
byte[] body = ByteBuffer.allocate(4 * 4)
.order(ByteOrder.LITTLE_ENDIAN)
.putInt(lineNumber)
.putInt(unknown)
.putInt(commentIndex)
.putInt(prefix)
.putInt(uri)
.array();
Expand All @@ -114,4 +114,4 @@ public byte[] toBytes() {
.put(body)
.array();
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/android/content/res/chunk/types/StartTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class StartTag extends GenericChunk implements Chunk {

private int lineNumber;
private int unknown;
private int commentIndex;
private int namespaceUri;
private int name;
private int flags;
Expand All @@ -54,7 +54,7 @@ public StartTag(ChunkType chunkType, IntReader inputReader) {
@Override
public void readHeader(IntReader inputReader) throws IOException {
lineNumber = inputReader.readInt();
unknown = inputReader.readInt();
commentIndex = inputReader.readInt();
namespaceUri = inputReader.readInt();
name = inputReader.readInt();
flags = inputReader.readInt();
Expand Down Expand Up @@ -136,7 +136,7 @@ public byte[] toBytes() {
byte[] staticBody = ByteBuffer.allocate(7 * 4)
.order(ByteOrder.LITTLE_ENDIAN)
.putInt(lineNumber)
.putInt(unknown)
.putInt(commentIndex)
.putInt(namespaceUri)
.putInt(name)
.putInt(flags)
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/android/content/res/chunk/types/TextTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class TextTag extends GenericChunk implements Chunk {

private int lineNumber;
private int unknown;
private int commentIndex;

private int name;
private int unknown2;
Expand All @@ -50,7 +50,7 @@ public TextTag(ChunkType chunkType, IntReader inputReader) {
@Override
public void readHeader(IntReader inputReader) throws IOException {
lineNumber = inputReader.readInt();
unknown = inputReader.readInt();
commentIndex = inputReader.readInt();
name = inputReader.readInt();
unknown2 = inputReader.readInt();
unknown3 = inputReader.readInt();
Expand Down Expand Up @@ -84,7 +84,7 @@ public byte[] toBytes() {
byte[] body = ByteBuffer.allocate(5 * 4)
.order(ByteOrder.LITTLE_ENDIAN)
.putInt(lineNumber)
.putInt(unknown)
.putInt(commentIndex)
.putInt(name)
.putInt(unknown2)
.putInt(unknown3)
Expand Down

0 comments on commit 7a2717c

Please sign in to comment.