Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-3274 tweaked list types, fixed whitespace

dev747368d7710625bea2
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/LoaderRelocationHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/LoaderRelocationHeader.java
index 028f828290..67ec95cd73 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/LoaderRelocationHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/LoaderRelocationHeader.java
@@ -15,14 +15,14 @@
*/
package ghidra.app.util.bin.format.pef;
-import ghidra.app.util.bin.*;
-import ghidra.program.model.data.DataType;
-import ghidra.util.exception.DuplicateNameException;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import ghidra.app.util.bin.*;
+import ghidra.program.model.data.DataType;
+import ghidra.util.exception.DuplicateNameException;
+
/**
* See Apple's -- PEFBinaryFormat.h
* <pre>
@@ -42,7 +42,7 @@ public class LoaderRelocationHeader implements StructConverter {
private int relocCount;
private int firstRelocOffset;
- private ArrayList<Relocation> _relocations = new ArrayList<Relocation>();
+ private List<Relocation> _relocations = new ArrayList<Relocation>();
LoaderRelocationHeader(BinaryReader reader, LoaderInfoHeader loader) throws IOException {
sectionIndex = reader.readNextShort();
@@ -99,10 +99,11 @@ public class LoaderRelocationHeader implements StructConverter {
return firstRelocOffset;
}
- public ArrayList<Relocation> getRelocations() {
+ public List<Relocation> getRelocations() {
return _relocations;
}
+ @Override
public DataType toDataType() throws DuplicateNameException, IOException {
return StructConverterUtil.toDataType(getClass());
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/RelocLgSetOrBySection.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/RelocLgSetOrBySection.java
index 4a3a6b107f..a7870ed06c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/RelocLgSetOrBySection.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/RelocLgSetOrBySection.java
@@ -15,15 +15,14 @@
*/
package ghidra.app.util.bin.format.pef;
+import java.io.IOException;
+
import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.model.listing.Program;
import ghidra.program.model.mem.MemoryBlock;
-import ghidra.program.model.symbol.*;
import ghidra.util.task.TaskMonitor;
-import java.io.IOException;
-
/**
* See Apple's -- PEFBinaryFormat.h
*/
@@ -79,7 +78,7 @@ public class RelocLgSetOrBySection extends Relocation {
return index;
}
- @Override
+ @Override
public String toString() {
switch (subopcode) {
case kPEFRelocLgBySection: return "RelocLgBySection";
@@ -90,7 +89,7 @@ public class RelocLgSetOrBySection extends Relocation {
}
@Override
- public void apply(ImportStateCache importState, RelocationState relocState,
+ public void apply(ImportStateCache importState, RelocationState relocState,
ContainerHeader header, Program program, MessageLog log, TaskMonitor monitor) {
switch (subopcode) {
@@ -98,7 +97,7 @@ public class RelocLgSetOrBySection extends Relocation {
SectionHeader sect = header.getSections().get(index);
MemoryBlock block = importState.getMemoryBlockForSection(sect);
relocState.relocateMemoryAt(relocState.getRelocationAddress(),
- (int)block.getStart().getOffset(), log);
+ (int) block.getStart().getOffset(), log);
break;
}
case kPEFRelocLgSetSectC: {
@@ -117,6 +116,6 @@ public class RelocLgSetOrBySection extends Relocation {
log.appendMsg("Unsupported RelocLgSetOrBySection subopcode: " + subopcode);
break;
}
- }
+ }
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/Relocation.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/Relocation.java
index ec2e08b5c5..1e8924c69b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/Relocation.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/Relocation.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/SectionHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/SectionHeader.java
index a45bc6a209..858d4e287d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/SectionHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pef/SectionHeader.java
@@ -15,15 +15,15 @@
*/
package ghidra.app.util.bin.format.pef;
+import java.io.IOException;
+import java.io.InputStream;
+
import ghidra.app.util.bin.*;
import ghidra.program.model.data.DataType;
import ghidra.util.Msg;
import ghidra.util.exception.DuplicateNameException;
import ghidra.util.task.TaskMonitor;
-import java.io.IOException;
-import java.io.InputStream;
-
/**
* See Apple's -- PEFBinaryFormat
* <pre>
@@ -97,22 +97,24 @@ public class SectionHeader implements StructConverter {
}
return _name;
}
- /**
- * Returns an input stream to underlying bytes of this section.
- * @return an input stream to underlying bytes of this section
- * @throws IOException if an i/o error occurs.
- */
- public InputStream getData() throws IOException {
- return _reader.getByteProvider().getInputStream(containerOffset);
- }
- /**
- * Unpack the data in a packed section.
- * Calling this method is only valid on a packed section.
- * @param monitor the task monitor
- * @return the unpacked data
- * @throws IOException if an i/o error occurs or the section is not packed.
- */
- public byte [] getUnpackedData(TaskMonitor monitor) throws IOException {
+
+ /**
+ * Returns an input stream to underlying bytes of this section.
+ * @return an input stream to underlying bytes of this section
+ * @throws IOException if an i/o error occurs.
+ */
+ public InputStream getData() throws IOException {
+ return _reader.getByteProvider().getInputStream(containerOffset);
+ }
+
+ /**
+ * Unpack the data in a packed section.
+ * Calling this method is only valid on a packed section.
+ * @param monitor the task monitor
+ * @return the unpacked data
+ * @throws IOException if an i/o error occurs or the section is not packed.
+ */
+ public byte[] getUnpackedData(TaskMonitor monitor) throws IOException {
if (getSectionKind() != SectionKind.PackedData) {
throw new IOException("Attempt to unpack a section that is not packed.");
}
@@ -214,7 +216,7 @@ public class SectionHeader implements StructConverter {
}
return data;
}
- }
+ }
private int unpackNextValue(InputStream input) throws IOException {
int unpacked = 0;
@@ -310,6 +312,7 @@ public class SectionHeader implements StructConverter {
return "Name="+_name+" Kind="+getSectionKind()+" Share="+getShareKind();
}
+ @Override
public DataType toDataType() throws DuplicateNameException, IOException {
return StructConverterUtil.toDataType(getClass());
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PefLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PefLoader.java
index dd71504fb1..649d6eda78 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PefLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PefLoader.java
@@ -328,7 +328,7 @@ public class PefLoader extends AbstractProgramWrapperLoader {
}
RelocationState state =
new RelocationState(header, relocationHeader, program, importState);
- ArrayList<Relocation> relocations = relocationHeader.getRelocations();
+ List<Relocation> relocations = relocationHeader.getRelocations();
int relocationIndex = 0;
int numRepeats = 0;
int jumpToIdx = -1;