From 7a2717c69bb22a2ebbe7a8674764612dea5a5b15 Mon Sep 17 00:00:00 2001 From: Tim Strazzere Date: Thu, 21 Apr 2016 15:20:34 -0700 Subject: [PATCH] Fix 'unknown' field in chunks. 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. --- src/main/java/android/content/res/chunk/types/EndTag.java | 6 +++--- .../java/android/content/res/chunk/types/NameSpace.java | 8 ++++---- .../java/android/content/res/chunk/types/StartTag.java | 6 +++--- .../java/android/content/res/chunk/types/TextTag.java | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/android/content/res/chunk/types/EndTag.java b/src/main/java/android/content/res/chunk/types/EndTag.java index 51a8646..2eebdcb 100644 --- a/src/main/java/android/content/res/chunk/types/EndTag.java +++ b/src/main/java/android/content/res/chunk/types/EndTag.java @@ -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; @@ -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(); } @@ -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(); diff --git a/src/main/java/android/content/res/chunk/types/NameSpace.java b/src/main/java/android/content/res/chunk/types/NameSpace.java index 6ca5e48..3fbca86 100644 --- a/src/main/java/android/content/res/chunk/types/NameSpace.java +++ b/src/main/java/android/content/res/chunk/types/NameSpace.java @@ -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; @@ -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(); } @@ -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(); @@ -114,4 +114,4 @@ public byte[] toBytes() { .put(body) .array(); } -} \ No newline at end of file +} diff --git a/src/main/java/android/content/res/chunk/types/StartTag.java b/src/main/java/android/content/res/chunk/types/StartTag.java index 7e0608c..1ef40b1 100644 --- a/src/main/java/android/content/res/chunk/types/StartTag.java +++ b/src/main/java/android/content/res/chunk/types/StartTag.java @@ -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; @@ -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(); @@ -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) diff --git a/src/main/java/android/content/res/chunk/types/TextTag.java b/src/main/java/android/content/res/chunk/types/TextTag.java index 9715386..0c0f55c 100644 --- a/src/main/java/android/content/res/chunk/types/TextTag.java +++ b/src/main/java/android/content/res/chunk/types/TextTag.java @@ -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; @@ -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(); @@ -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)