Skip to content

Commit 73e85ad

Browse files
committed
GP-4318: Cleanup
1 parent b8f1894 commit 73e85ad

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

Ghidra/Features/Base/src/main/help/help/topics/ClipboardPlugin/Clipboard.htm

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ <H3>Listing</H3>
184184

185185
<LI><B>Byte Source Offset</B> - Copies the byte source offset from the start of the file for
186186
each address in the current selection. If the address is not backed by a file,
187-
<CODE>%3CNO_OFFSET%3E</CODE> is copied.</LI>
187+
<CODE>&lt;NO_OFFSET&gt;</CODE> is copied.</LI>
188188

189189
<LI><B>GhidraURL</B> <A name="GhidraURL"></A> - Creates a GhidraURL for the address under the
190190
cursor then copies that URL to the clipboard.</LI>

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/CodeBrowserClipboardProvider.java

+8-13
Original file line numberDiff line numberDiff line change
@@ -390,27 +390,22 @@ else if (delta > 0) {
390390
return createStringTransferable(StringUtils.join(strings, "\n"));
391391
}
392392

393-
private Transferable copyByteSourceOffset(TaskMonitor monitor) {
393+
private Transferable copyByteSourceOffset(TaskMonitor monitor) {
394394
AddressSetView addrs = getSelectedAddresses();
395395
Memory currentMemory = currentProgram.getMemory();
396396
List<String> strings = new ArrayList<>();
397-
AddressIterator addresses = addrs.getAddresses(true);
397+
AddressIterator addresses = addrs.getAddresses(true);
398398
while (addresses.hasNext() && !monitor.isCancelled()) {
399-
AddressSourceInfo addressSourceInfo = currentMemory.getAddressSourceInfo(addresses.next());
399+
AddressSourceInfo addressSourceInfo =
400+
currentMemory.getAddressSourceInfo(addresses.next());
400401
if (addressSourceInfo != null) {
401-
long fileOffset = addressSourceInfo.getFileOffset();
402-
String fileOffsetString;
403-
404-
if (fileOffset == -1) {
405-
fileOffsetString = "<NO_OFFSET>";
406-
} else {
407-
fileOffsetString = String.format("%x", addressSourceInfo.getFileOffset());
408-
}
409-
402+
long fileOffset = addressSourceInfo.getFileOffset();
403+
String fileOffsetString =
404+
fileOffset != -1 ? "%x".formatted(fileOffset) : "<NO_OFFSET>";
410405
strings.add(fileOffsetString);
411406
}
412407
}
413-
return createStringTransferable(StringUtils.join(strings, "\n"));
408+
return createStringTransferable(String.join("\n", strings));
414409
}
415410

416411
protected Transferable copyCode(TaskMonitor monitor) {

0 commit comments

Comments
 (0)