Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-3141: Code cleanup and certify

Ryan Kurtz7728c7b55e81
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfData.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfData.java
index 5432199284..0b0e827e19 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfData.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfData.java
@@ -42,7 +42,8 @@ public abstract class OmfData extends OmfRecord implements Comparable<OmfData> {
/**
* Compare datablocks by data offset
- * @return -1 for lower address, 0 for same adress, 1 for higher address
+ * @return a value less than 0 for lower address, 0 for same address, or greater than 0 for
+ * higher address
*/
@Override
public int compareTo(OmfData o) {
@@ -52,7 +53,7 @@ public abstract class OmfData extends OmfRecord implements Comparable<OmfData> {
/**
* @return the length of this data in bytes
*/
- abstract public int getLength();
+ public abstract int getLength();
/**
* Create a byte array holding the data represented by this object. The length
@@ -61,10 +62,10 @@ public abstract class OmfData extends OmfRecord implements Comparable<OmfData> {
* @return allocated and filled byte array
* @throws IOException for problems accessing data through the reader
*/
- abstract public byte[] getByteArray(BinaryReader reader) throws IOException;
+ public abstract byte[] getByteArray(BinaryReader reader) throws IOException;
/**
* @return true if this is a block entirely of zeroes
*/
- abstract public boolean isAllZeroes();
+ public abstract boolean isAllZeroes();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfEnumeratedData.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfEnumeratedData.java
index 13abdcbd63..d045464425 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfEnumeratedData.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfEnumeratedData.java
@@ -34,18 +34,11 @@ public class OmfEnumeratedData extends OmfData {
readCheckSumByte(reader);
}
- /**
- * @return The length of the block
- */
@Override
public int getLength() {
return streamLength;
}
- /**
- * @param The inputfile to read from
- * @return The array of bytes
- */
@Override
public byte[] getByteArray(BinaryReader reader) throws IOException {
reader.setPointerIndex(streamOffset);
@@ -53,10 +46,6 @@ public class OmfEnumeratedData extends OmfData {
return buffer;
}
- /**
- * Assume that all zeros are done with OmfIteratedData
- * @return True if the block is all zeroes
- */
@Override
public boolean isAllZeroes() {
return false;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfFixupRecord.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfFixupRecord.java
index 7575942dfc..1b19702861 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfFixupRecord.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfFixupRecord.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfIteratedData.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfIteratedData.java
index df5f2b9720..0ebd4bf539 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfIteratedData.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfIteratedData.java
@@ -41,9 +41,6 @@ public class OmfIteratedData extends OmfData {
blocklist.toArray(datablock);
}
- /**
- * @return true if the block is all zeros
- */
@Override
public boolean isAllZeroes() {
for (int i = 0; i < datablock.length; ++i) {
@@ -54,9 +51,6 @@ public class OmfIteratedData extends OmfData {
return true;
}
- /**
- * @return the length of the block after expansion
- */
@Override
public int getLength() {
int length = 0;
@@ -66,10 +60,6 @@ public class OmfIteratedData extends OmfData {
return length;
}
- /**
- * @param reader The file to read from
- * @return The block created from the read data
- */
@Override
public byte[] getByteArray(BinaryReader reader) throws IOException {
int length = getLength();
@@ -86,7 +76,6 @@ public class OmfIteratedData extends OmfData {
/**
* Contain the definition of one part of a datablock with possible recursion
- *
*/
public static class DataBlock {
private int repeatCount;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfModuleEnd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfModuleEnd.java
index 743c3c9cd7..55de5ead15 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfModuleEnd.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfModuleEnd.java
@@ -1,5 +1,4 @@
/* ###
-,
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfRecord.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfRecord.java
index 596b276d04..f2d79f6291 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfRecord.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/omf/OmfRecord.java
@@ -247,6 +247,6 @@ public abstract class OmfRecord {
@Override
public String toString() {
return String.format("name: %s, type: 0x%x, offset: 0x%x, length: 0x%x",
- getRecordName(recordType & (byte)0xfe), recordType, recordOffset, recordLength);
+ getRecordName(recordType & (byte) 0xfe), recordType, recordOffset, recordLength);
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/OmfLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/OmfLoader.java
index 95a286d26f..cf3a038746 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/OmfLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/OmfLoader.java
@@ -148,7 +148,7 @@ public class OmfLoader extends AbstractProgramWrapperLoader {
* Log a (hopefully) descriptive error, if we can't process a specific relocation
* @param program is the Program
* @param log will receive the error message
- * @param state is the relocation record that could not be processed
+ * @param type the relocation type
*/
private void relocationError(Program program, MessageLog log, Address addr, int type) {
String message;
@@ -174,7 +174,6 @@ public class OmfLoader extends AbstractProgramWrapperLoader {
private void processRelocations(OmfFileHeader header, Program program, TaskMonitor monitor,
MessageLog log) {
Language language = program.getLanguage();
-// OmfFixupRecord.Subrecord[] frameThreads = new Subrecord[4];
OmfFixupRecord.Subrecord[] targetThreads = new Subrecord[4];
ArrayList<OmfGroupRecord> groups = header.getGroups();
long targetAddr; // Address of item being referred to