Lines Matching refs:offset

29  * referred to by an offset somewhere else in the file - RawDexObjects) and Offsets.
49 * A map from the original offset in the input DEX file to
51 * the actual item, and later on the new offset for the item when
72 * A table of all offsets that we could not write out an updated offset for
74 * to allow specific patching of each offset's location as at that point
113 * Lookup an Item by the offset it had in the input DEX file.
114 * @param offset The offset in the input DEX file.
117 public RawDexObject getItemByOffset(int offset) {
118 return offsettableMap.get(offset).getItem();
135 * As Items read in Offsets, they call this function with the offset they originally
137 * @param originalOffset The original offset read from the input DEX file.
141 Offset offset = new Offset(false);
142 offset.setOriginalOffset(originalOffset);
143 needsAssociationTable.add(offset);
144 return offset;
152 Offset offset = new Offset(true);
153 offset.setOriginalOffset(originalOffset);
154 needsAssociationTable.add(offset);
155 return offset;
162 for (Offset offset : needsAssociationTable) {
163 if (offset.getOriginalOffset() == 0 && !(offset.pointsAtHeader())) {
164 offset.setPointsAtNull();
166 offset.pointTo(offsettableMap.get(offset.getOriginalOffset()));
167 if (!offset.pointsToSomething()) {
168 Log.error(String.format("Couldn't find original offset 0x%x!",
169 offset.getOriginalOffset()));
179 * This should allow the tracking of new offset locations.
195 * As Items are written out, any writing out of an offset must call this function, passing
196 * in the relevant offset. This function will write out the offset, if the associated
200 * @param offset The offset received from getNewOffset().
202 * @param useUleb128 Whether or not the offset should be written in UINT or ULEB128 form.
204 public void tryToWriteOffset(Offset offset, DexRandomAccessFile file, boolean useUleb128)
206 if (!offset.isNewOffset() && (!offset.pointsToSomething())) {
215 if (offset.readyForWriting()) {
217 file.writeUleb128(offset.getNewPositionOfItem());
219 file.writeUInt(offset.getNewPositionOfItem());
222 offset.setOutputLocation((int) file.getFilePointer());
224 file.writeLargestUleb128(offset.getOriginalOffset());
225 offset.setUsesUleb128();
227 file.writeUInt(offset.getOriginalOffset());
229 needsUpdateTable.add(offset);
244 for (Offset offset : needsUpdateTable) {
245 file.seek(offset.getOutputLocation());
246 if (offset.usesUleb128()) {
247 file.writeLargestUleb128(offset.getNewPositionOfItem());
249 file.writeUInt(offset.getNewPositionOfItem());
291 private void updateHeaderOffsetIfValid(Offset offset, Offsettable previousFirst,
293 if (offset.pointsToThisOffsettable(previousFirst)) {
294 offset.pointToNew(newFirst);
296 Log.errorAndQuit("Header " + offsetName + " offset not pointing at first element?");
303 typeListMapItem.offset = new Offset(false);
304 typeListMapItem.offset.pointToNew(typeListOffsettable);
329 fieldMapItem.offset = new Offset(false);
330 fieldMapItem.offset.pointToNew(fieldOffsettable);
389 if (mapItem.offset.pointsToThisOffsettable(prevFirstOffsettable)) {
390 Log.info("Updating offset in MapItem (type: " + mapItem.type + ") after "
392 mapItem.offset.pointToNew(newFirstOffsettable);