Skip to content

Commit

Permalink
chore: renames
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Feb 2, 2025
1 parent 3110146 commit 675771e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import android.util.TypedValue;
import brut.androlib.Config;
import brut.androlib.apk.ApkInfo;
import brut.androlib.exceptions.AndrolibException;
import brut.androlib.res.data.*;
import brut.androlib.res.data.arsc.*;
Expand Down Expand Up @@ -304,7 +303,7 @@ private ResType readTableType() throws AndrolibException, IOException {

ResConfigFlags flags = readConfigFlags();

mIn.mark(mHeader.chunkSize + mHeader.headerSize);
mIn.mark(mHeader.chunkSize);
mHeader.checkForUnreadHeader(mIn);

boolean isOffset16 = (typeFlags & TABLE_TYPE_FLAG_OFFSET16) != 0;
Expand Down Expand Up @@ -341,8 +340,7 @@ private ResType readTableType() throws AndrolibException, IOException {

// #3428 - In some applications the res entries are padded for alignment, but in #3778 it made
// sense to align to the start of the entries to handle all cases.
mIn.jump(entriesStartAligned);

mIn.jumpTo(entriesStartAligned);
for (int i : entryOffsetMap.keySet()) {
mResId = (mResId & 0xffff0000) | i;
int offset = entryOffsetMap.get(i);
Expand All @@ -352,7 +350,7 @@ private ResType readTableType() throws AndrolibException, IOException {
}

// As seen in some recent APKs - there are more entries reported than can fit in the chunk.
if (mIn.position() == mHeader.endPosition) {
if (mIn.position() >= mHeader.endPosition) {
int remainingEntries = entryCount - i;
LOGGER.warning(String.format("End of chunk hit. Skipping remaining entries (%d) in type: %s",
remainingEntries, mTypeSpec.getName()
Expand All @@ -365,11 +363,11 @@ private ResType readTableType() throws AndrolibException, IOException {
if (entryStart < mIn.position()) {
mIn.reset();
}
mIn.jump(entryStart);
mIn.jumpTo(entryStart);

EntryData entryData = readEntryData();
if (entryData != null) {
readEntry(entryData);
parseEntryData(entryData);
} else {
mMissingResSpecMap.put(mResId, typeId);
}
Expand Down Expand Up @@ -430,7 +428,7 @@ private EntryData readEntryData() throws AndrolibException, IOException {
return entryData;
}

private void readEntry(EntryData entryData) throws AndrolibException {
private void parseEntryData(EntryData entryData) throws AndrolibException {
int specNamesId = entryData.specNamesId;
ResValue value = entryData.value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private ExtDataInputStream(DataInput delegate, CountingInputStream countIn) {
mCountIn = countIn;
}

public void jump(long expectedPosition) throws IOException {
public void jumpTo(long expectedPosition) throws IOException {
long position = this.position();
if (position > expectedPosition) {
throw new IOException(String.format("Jumping backwards from %d to %d", position, expectedPosition));
Expand Down

0 comments on commit 675771e

Please sign in to comment.