public ELFSection getSectionByIndex(int i) { // if this cast fails, our sectionIndexToElementIndex logic is wrong return (ELFSection) elements.get(elements.sectionIndexToElementIndex(i - 1)); // NOTE: two levels of translation here: ELF (1-based) shndx to section index (0-based) to // element index }
Section getSection(int sectionIndex) { int elementIndex = sectionIndexToElementIndex(sectionIndex); if (elementIndex == -1) { return null; } Element found = get(elementIndex); assert found instanceof Section; return (Section) found; }
public PECoffSection getSectionByIndex(int i) { // if this cast fails, our sectionIndexToElementIndex logic is wrong return (PECoffSection) elements.get(elements.sectionIndexToElementIndex(i - 1)); // NOTE: two levels of translation here: PECoff (1-based) shndx to section index (0-based) // to // element index }
while (get(ei) != s) { ++ei;