MCPcopy Create free account
hub / github.com/Youlor/unpacker / readMap

Method readMap

dexfixer/src/com/android/dex/TableOfContents.java:123–148  ·  view source on GitHub ↗
(Dex.Section in)

Source from the content-addressed store, hash-verified

121 }
122
123 private void readMap(Dex.Section in) throws IOException {
124 int mapSize = in.readInt();
125 Section previous = null;
126 for (int i = 0; i < mapSize; i++) {
127 short type = in.readShort();
128 in.readShort(); // unused
129 Section section = getSection(type);
130 int size = in.readInt();
131 int offset = in.readInt();
132
133 if ((section.size != 0 && section.size != size)
134 || (section.off != -1 && section.off != offset)) {
135 throw new DexException("Unexpected map value for 0x" + Integer.toHexString(type));
136 }
137
138 section.size = size;
139 section.off = offset;
140
141 if (previous != null && previous.off > section.off) {
142 throw new DexException("Map is unsorted at " + previous + ", " + section);
143 }
144
145 previous = section;
146 }
147 Arrays.sort(sections);
148 }
149
150 public void computeSizesFromOffsets() {
151 int end = dataOff + dataSize;

Callers 1

readFromMethod · 0.95

Calls 4

getSectionMethod · 0.95
sortMethod · 0.80
readIntMethod · 0.65
readShortMethod · 0.45

Tested by

no test coverage detected