Spelling fixes

This commit is contained in:
dragonmacher 2023-03-17 20:02:12 -04:00
parent faf73e8ecb
commit 8cd2c5d58a
7 changed files with 36 additions and 37 deletions

View file

@ -75,7 +75,7 @@ public class SetCommentCmd implements Command {
" Is this address valid?"; " Is this address valid?";
return false; return false;
} }
String updatedComment = CommentUtils.fixupAnnoations(comment, program); String updatedComment = CommentUtils.fixupAnnotations(comment, program);
updatedComment = CommentUtils.sanitize(updatedComment); updatedComment = CommentUtils.sanitize(updatedComment);
if (commentChanged(cu.getComment(commentType), updatedComment)) { if (commentChanged(cu.getComment(commentType), updatedComment)) {
cu.setComment(commentType, updatedComment); cu.setComment(commentType, updatedComment);

View file

@ -90,28 +90,28 @@ public class SetCommentsCmd implements Command {
if (cu != null) { if (cu != null) {
if (commentChanged(cu.getComment(CodeUnit.PRE_COMMENT), preComment)) { if (commentChanged(cu.getComment(CodeUnit.PRE_COMMENT), preComment)) {
String updatedPreComment = CommentUtils.fixupAnnoations(preComment, program); String updatedPreComment = CommentUtils.fixupAnnotations(preComment, program);
updatedPreComment = CommentUtils.sanitize(updatedPreComment); updatedPreComment = CommentUtils.sanitize(updatedPreComment);
cu.setComment(CodeUnit.PRE_COMMENT, updatedPreComment); cu.setComment(CodeUnit.PRE_COMMENT, updatedPreComment);
} }
if (commentChanged(cu.getComment(CodeUnit.POST_COMMENT), postComment)) { if (commentChanged(cu.getComment(CodeUnit.POST_COMMENT), postComment)) {
String updatedPostComment = CommentUtils.fixupAnnoations(postComment, program); String updatedPostComment = CommentUtils.fixupAnnotations(postComment, program);
updatedPostComment = CommentUtils.sanitize(updatedPostComment); updatedPostComment = CommentUtils.sanitize(updatedPostComment);
cu.setComment(CodeUnit.POST_COMMENT, updatedPostComment); cu.setComment(CodeUnit.POST_COMMENT, updatedPostComment);
} }
if (commentChanged(cu.getComment(CodeUnit.EOL_COMMENT), eolComment)) { if (commentChanged(cu.getComment(CodeUnit.EOL_COMMENT), eolComment)) {
String updatedEOLComment = CommentUtils.fixupAnnoations(eolComment, program); String updatedEOLComment = CommentUtils.fixupAnnotations(eolComment, program);
updatedEOLComment = CommentUtils.sanitize(updatedEOLComment); updatedEOLComment = CommentUtils.sanitize(updatedEOLComment);
cu.setComment(CodeUnit.EOL_COMMENT, updatedEOLComment); cu.setComment(CodeUnit.EOL_COMMENT, updatedEOLComment);
} }
if (commentChanged(cu.getComment(CodeUnit.PLATE_COMMENT), plateComment)) { if (commentChanged(cu.getComment(CodeUnit.PLATE_COMMENT), plateComment)) {
String updatedPlateComment = CommentUtils.fixupAnnoations(plateComment, program); String updatedPlateComment = CommentUtils.fixupAnnotations(plateComment, program);
updatedPlateComment = CommentUtils.sanitize(updatedPlateComment); updatedPlateComment = CommentUtils.sanitize(updatedPlateComment);
cu.setComment(CodeUnit.PLATE_COMMENT, updatedPlateComment); cu.setComment(CodeUnit.PLATE_COMMENT, updatedPlateComment);
} }
if (commentChanged(cu.getComment(CodeUnit.REPEATABLE_COMMENT), repeatableComment)) { if (commentChanged(cu.getComment(CodeUnit.REPEATABLE_COMMENT), repeatableComment)) {
String updatedRepeatableComment = String updatedRepeatableComment =
CommentUtils.fixupAnnoations(repeatableComment, program); CommentUtils.fixupAnnotations(repeatableComment, program);
updatedRepeatableComment = CommentUtils.sanitize(updatedRepeatableComment); updatedRepeatableComment = CommentUtils.sanitize(updatedRepeatableComment);
cu.setComment(CodeUnit.REPEATABLE_COMMENT, updatedRepeatableComment); cu.setComment(CodeUnit.REPEATABLE_COMMENT, updatedRepeatableComment);
} }

View file

@ -112,8 +112,8 @@ class BookmarkTableModel extends AddressBasedTableModel<BookmarkRowObject> {
} }
BookmarkType[] programTypes = bookmarkMgr.getBookmarkTypes(); BookmarkType[] programTypes = bookmarkMgr.getBookmarkTypes();
int allKnowTypesSize = programTypes.length; int allKnownTypesSize = programTypes.length;
return !types.isEmpty() && types.size() != allKnowTypesSize; return !types.isEmpty() && types.size() != allKnownTypesSize;
} }
FilterState getFilterState() { FilterState getFilterState() {

View file

@ -46,7 +46,7 @@ public class CommentUtils {
* @param program the program associated with the comment * @param program the program associated with the comment
* @return the updated string * @return the updated string
*/ */
public static String fixupAnnoations(String rawCommentText, Program program) { public static String fixupAnnotations(String rawCommentText, Program program) {
if (rawCommentText == null) { if (rawCommentText == null) {
return null; return null;

View file

@ -89,45 +89,45 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
@Test @Test
public void testSymbolAnnotationWithAddress() { public void testSymbolAnnotationWithAddress() {
String rawComment = "This is a symbol {@sym 01001014} annotation."; String rawComment = "This is a symbol {@sym 01001014} annotation.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals(rawComment, fixed); assertEquals(rawComment, fixed);
// with display string // with display string
rawComment = "This is a symbol {@sym 01001014 bob} annotation."; rawComment = "This is a symbol {@sym 01001014 bob} annotation.";
fixed = CommentUtils.fixupAnnoations(rawComment, program); fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals(rawComment, fixed); assertEquals(rawComment, fixed);
} }
@Test @Test
public void testSymbolAnnotationWithInvalidAddress() { public void testSymbolAnnotationWithInvalidAddress() {
String rawComment = "This is a symbol {@sym 999999} annotation."; String rawComment = "This is a symbol {@sym 999999} annotation.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals(rawComment, fixed); assertEquals(rawComment, fixed);
} }
@Test @Test
public void testSymbolAnnotationWithSymbol() { public void testSymbolAnnotationWithSymbol() {
String rawComment = "This is a symbol {@sym LAB_01003d2c} annotation."; String rawComment = "This is a symbol {@sym LAB_01003d2c} annotation.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("This is a symbol {@sym 01003d2c} annotation.", fixed); assertEquals("This is a symbol {@sym 01003d2c} annotation.", fixed);
// with display string // with display string
rawComment = "This is a symbol {@sym LAB_01003d2c displayText} annotation."; rawComment = "This is a symbol {@sym LAB_01003d2c displayText} annotation.";
fixed = CommentUtils.fixupAnnoations(rawComment, program); fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("This is a symbol {@sym 01003d2c displayText} annotation.", fixed); assertEquals("This is a symbol {@sym 01003d2c displayText} annotation.", fixed);
} }
@Test @Test
public void testSymbolAnnotationWithInvalidSymbol() { public void testSymbolAnnotationWithInvalidSymbol() {
String rawComment = "This is a symbol {@sym CocoPebbles} annotation."; String rawComment = "This is a symbol {@sym CocoPebbles} annotation.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("This is a symbol {@sym CocoPebbles} annotation.", fixed); assertEquals("This is a symbol {@sym CocoPebbles} annotation.", fixed);
} }
@Test @Test
public void testNoAnnotation() { public void testNoAnnotation() {
String rawComment = "This is no symbol annotation."; String rawComment = "This is no symbol annotation.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals(rawComment, fixed); assertEquals(rawComment, fixed);
} }
@ -135,7 +135,7 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
public void testMixedAnnotationNoSymbolAnnotation() { public void testMixedAnnotationNoSymbolAnnotation() {
String rawComment = "This is a symbol {@url www.noplace.com} annotation " + String rawComment = "This is a symbol {@url www.noplace.com} annotation " +
"with a {@program notepad} annotation."; "with a {@program notepad} annotation.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals(rawComment, fixed); assertEquals(rawComment, fixed);
} }
@ -143,7 +143,7 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
public void testMixedAnnotationWithSymbolAnnotation() { public void testMixedAnnotationWithSymbolAnnotation() {
String rawComment = "This is a symbol {@sym LAB_01003d2c} annotation " + String rawComment = "This is a symbol {@sym LAB_01003d2c} annotation " +
"with a {@program notepad} annotation."; "with a {@program notepad} annotation.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("This is a symbol {@sym 01003d2c} annotation " + assertEquals("This is a symbol {@sym 01003d2c} annotation " +
"with a {@program notepad} annotation.", fixed); "with a {@program notepad} annotation.", fixed);
} }
@ -151,21 +151,21 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
@Test @Test
public void testSymbolAnnotationAtBeginningOfComment() { public void testSymbolAnnotationAtBeginningOfComment() {
String rawComment = "{@sym LAB_01003d2c} annotation at the beginning."; String rawComment = "{@sym LAB_01003d2c} annotation at the beginning.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("{@sym 01003d2c} annotation at the beginning.", fixed); assertEquals("{@sym 01003d2c} annotation at the beginning.", fixed);
} }
@Test @Test
public void testSymbolAnnotation_BackToBack() { public void testSymbolAnnotation_BackToBack() {
String rawComment = "Test {@sym LAB_01003d2c}{@sym LAB_01003d2c} end."; String rawComment = "Test {@sym LAB_01003d2c}{@sym LAB_01003d2c} end.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("Test {@sym 01003d2c}{@sym 01003d2c} end.", fixed); assertEquals("Test {@sym 01003d2c}{@sym 01003d2c} end.", fixed);
} }
@Test @Test
public void testSymbolAnnotationAtEndOfComment() { public void testSymbolAnnotationAtEndOfComment() {
String rawComment = "Annotation at the end {@sym LAB_01003d2c}"; String rawComment = "Annotation at the end {@sym LAB_01003d2c}";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("Annotation at the end {@sym 01003d2c}", fixed); assertEquals("Annotation at the end {@sym 01003d2c}", fixed);
} }
@ -173,7 +173,7 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
public void testSymbolAnnotationAtBeginningAndEndOfComment() { public void testSymbolAnnotationAtBeginningAndEndOfComment() {
String rawComment = String rawComment =
"{@sym LAB_01003d2c} annotation at the beginning and end {@sym LAB_01003d5b}"; "{@sym LAB_01003d2c} annotation at the beginning and end {@sym LAB_01003d5b}";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("{@sym 01003d2c} annotation at the " + "beginning and end {@sym 01003d5b}", assertEquals("{@sym 01003d2c} annotation at the " + "beginning and end {@sym 01003d5b}",
fixed); fixed);
} }
@ -183,7 +183,7 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
String rawComment = String rawComment =
"{@sym LAB_01003d2c} annotation at the beginning, middle {@sym LAB_01003d28} and " + "{@sym LAB_01003d2c} annotation at the beginning, middle {@sym LAB_01003d28} and " +
"end {@sym LAB_01003d5b}"; "end {@sym LAB_01003d5b}";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("{@sym 01003d2c} annotation at the beginning, middle {@sym 01003d28} and " + assertEquals("{@sym 01003d2c} annotation at the beginning, middle {@sym 01003d28} and " +
"end {@sym 01003d5b}", fixed); "end {@sym 01003d5b}", fixed);
} }
@ -192,7 +192,7 @@ public class AnnotationTest extends AbstractGhidraHeadedIntegrationTest {
public void testSymbolAnnotationWithValidAndInvalidSymbol() { public void testSymbolAnnotationWithValidAndInvalidSymbol() {
String rawComment = "This is a symbol {@sym LAB_01003d2c} annotation " + String rawComment = "This is a symbol {@sym LAB_01003d2c} annotation " +
"with a {@sym FruityPebbles} annotation."; "with a {@sym FruityPebbles} annotation.";
String fixed = CommentUtils.fixupAnnoations(rawComment, program); String fixed = CommentUtils.fixupAnnotations(rawComment, program);
assertEquals("This is a symbol {@sym 01003d2c} annotation " + assertEquals("This is a symbol {@sym 01003d2c} annotation " +
"with a {@sym FruityPebbles} annotation.", fixed); "with a {@sym FruityPebbles} annotation.", fixed);
} }

View file

@ -75,7 +75,7 @@ public class AlgorithmFilter extends CheckBoxBasedAncillaryFilter<VTMatch> {
@Override @Override
protected void createCheckBoxInfos() { protected void createCheckBoxInfos() {
List<String> algorithmNames = getKnowAlgorithms(); List<String> algorithmNames = getKnownAlgorithms();
ItemListener listener = new ItemListener() { ItemListener listener = new ItemListener() {
@Override @Override
@ -92,7 +92,7 @@ public class AlgorithmFilter extends CheckBoxBasedAncillaryFilter<VTMatch> {
} }
} }
private List<String> getKnowAlgorithms() { private List<String> getKnownAlgorithms() {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
// add the manual match correlator, which doesn't have a factory, since it is only through an action. // add the manual match correlator, which doesn't have a factory, since it is only through an action.

View file

@ -1,6 +1,5 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,21 +15,21 @@
*/ */
package help.validator.model; package help.validator.model;
import help.HelpBuildUtils;
import help.validator.location.DirectoryHelpModuleLocation;
import help.validator.location.HelpModuleLocation;
import java.io.IOException; import java.io.IOException;
import java.nio.file.*; import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.BasicFileAttributes;
import java.util.*; import java.util.*;
import help.HelpBuildUtils;
import help.validator.location.DirectoryHelpModuleLocation;
import help.validator.location.HelpModuleLocation;
public class HelpTopic implements Comparable<HelpTopic> { public class HelpTopic implements Comparable<HelpTopic> {
private final HelpModuleLocation help; private final HelpModuleLocation help;
private final Path topicFile; private final Path topicFile;
private final Path relativePath; private final Path relativePath;
private Map<Path, HelpFile> helpFiles = new LinkedHashMap<Path, HelpFile>(); private Map<Path, HelpFile> helpFiles = new LinkedHashMap<>();
public static HelpTopic fromHTMLFile(Path topicFile) { public static HelpTopic fromHTMLFile(Path topicFile) {
@ -51,8 +50,8 @@ public class HelpTopic implements Comparable<HelpTopic> {
Path helpDir = help.getHelpLocation(); Path helpDir = help.getHelpLocation();
Path unknowFSRelativePath = helpDir.relativize(topicFile); // may or may not be jar paths Path unknownFSRelativePath = helpDir.relativize(topicFile); // may or may not be jar paths
this.relativePath = HelpBuildUtils.toDefaultFS(unknowFSRelativePath); this.relativePath = HelpBuildUtils.toDefaultFS(unknownFSRelativePath);
loadHelpFiles(topicFile); loadHelpFiles(topicFile);
} }
@ -104,7 +103,7 @@ public class HelpTopic implements Comparable<HelpTopic> {
if (topicFile.getFileSystem() != FileSystems.getDefault()) { if (topicFile.getFileSystem() != FileSystems.getDefault()) {
return Collections.emptyList(); return Collections.emptyList();
} }
List<HREF> list = new ArrayList<HREF>(); List<HREF> list = new ArrayList<>();
for (HelpFile helpFile : helpFiles.values()) { for (HelpFile helpFile : helpFiles.values()) {
list.addAll(helpFile.getAllHREFs()); list.addAll(helpFile.getAllHREFs());
} }
@ -116,7 +115,7 @@ public class HelpTopic implements Comparable<HelpTopic> {
if (topicFile.getFileSystem() != FileSystems.getDefault()) { if (topicFile.getFileSystem() != FileSystems.getDefault()) {
return Collections.emptyList(); return Collections.emptyList();
} }
List<IMG> list = new ArrayList<IMG>(); List<IMG> list = new ArrayList<>();
for (HelpFile helpFile : helpFiles.values()) { for (HelpFile helpFile : helpFiles.values()) {
list.addAll(helpFile.getAllIMGs()); list.addAll(helpFile.getAllIMGs());
} }
@ -125,7 +124,7 @@ public class HelpTopic implements Comparable<HelpTopic> {
public Collection<AnchorDefinition> getAllAnchorDefinitions() { public Collection<AnchorDefinition> getAllAnchorDefinitions() {
// The current module may refer to anchors in pre-built modules. // The current module may refer to anchors in pre-built modules.
List<AnchorDefinition> list = new ArrayList<AnchorDefinition>(); List<AnchorDefinition> list = new ArrayList<>();
for (HelpFile helpFile : helpFiles.values()) { for (HelpFile helpFile : helpFiles.values()) {
list.addAll(helpFile.getAllAnchorDefinitions()); list.addAll(helpFile.getAllAnchorDefinitions());
} }