Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-4318: Cleanup

Ryan Kurtz73e85ad54a70
diff --git a/Ghidra/Features/Base/src/main/help/help/topics/ClipboardPlugin/Clipboard.htm b/Ghidra/Features/Base/src/main/help/help/topics/ClipboardPlugin/Clipboard.htm
index d1c72b34c4..df8fcc01a6 100644
--- a/Ghidra/Features/Base/src/main/help/help/topics/ClipboardPlugin/Clipboard.htm
+++ b/Ghidra/Features/Base/src/main/help/help/topics/ClipboardPlugin/Clipboard.htm
@@ -184,7 +184,7 @@
<LI><B>Byte Source Offset</B> - Copies the byte source offset from the start of the file for
each address in the current selection. If the address is not backed by a file,
- <CODE>%3CNO_OFFSET%3E</CODE> is copied.</LI>
+ <CODE>&lt;NO_OFFSET&gt;</CODE> is copied.</LI>
<LI><B>GhidraURL</B> <A name="GhidraURL"></A> - Creates a GhidraURL for the address under the
cursor then copies that URL to the clipboard.</LI>
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/CodeBrowserClipboardProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/CodeBrowserClipboardProvider.java
index 425376d38b..e88f2d9095 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/CodeBrowserClipboardProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/CodeBrowserClipboardProvider.java
@@ -390,27 +390,22 @@ public class CodeBrowserClipboardProvider extends ByteCopier
return createStringTransferable(StringUtils.join(strings, "\n"));
}
- private Transferable copyByteSourceOffset(TaskMonitor monitor) {
+ private Transferable copyByteSourceOffset(TaskMonitor monitor) {
AddressSetView addrs = getSelectedAddresses();
Memory currentMemory = currentProgram.getMemory();
List<String> strings = new ArrayList<>();
- AddressIterator addresses = addrs.getAddresses(true);
+ AddressIterator addresses = addrs.getAddresses(true);
while (addresses.hasNext() && !monitor.isCancelled()) {
- AddressSourceInfo addressSourceInfo = currentMemory.getAddressSourceInfo(addresses.next());
+ AddressSourceInfo addressSourceInfo =
+ currentMemory.getAddressSourceInfo(addresses.next());
if (addressSourceInfo != null) {
- long fileOffset = addressSourceInfo.getFileOffset();
- String fileOffsetString;
-
- if (fileOffset == -1) {
- fileOffsetString = "<NO_OFFSET>";
- } else {
- fileOffsetString = String.format("%x", addressSourceInfo.getFileOffset());
- }
-
+ long fileOffset = addressSourceInfo.getFileOffset();
+ String fileOffsetString =
+ fileOffset != -1 ? "%x".formatted(fileOffset) : "<NO_OFFSET>";
strings.add(fileOffsetString);
}
}
- return createStringTransferable(StringUtils.join(strings, "\n"));
+ return createStringTransferable(String.join("\n", strings));
}
protected Transferable copyCode(TaskMonitor monitor) {