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?";
return false;
}
String updatedComment = CommentUtils.fixupAnnoations(comment, program);
String updatedComment = CommentUtils.fixupAnnotations(comment, program);
updatedComment = CommentUtils.sanitize(updatedComment);
if (commentChanged(cu.getComment(commentType), updatedComment)) {
cu.setComment(commentType, updatedComment);

View file

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

View file

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

View file

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

View file

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

View file

@ -75,7 +75,7 @@ public class AlgorithmFilter extends CheckBoxBasedAncillaryFilter<VTMatch> {
@Override
protected void createCheckBoxInfos() {
List<String> algorithmNames = getKnowAlgorithms();
List<String> algorithmNames = getKnownAlgorithms();
ItemListener listener = new ItemListener() {
@Override
@ -92,7 +92,7 @@ public class AlgorithmFilter extends CheckBoxBasedAncillaryFilter<VTMatch> {
}
}
private List<String> getKnowAlgorithms() {
private List<String> getKnownAlgorithms() {
List<String> list = new ArrayList<>();
// 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
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,21 +15,21 @@
*/
package help.validator.model;
import help.HelpBuildUtils;
import help.validator.location.DirectoryHelpModuleLocation;
import help.validator.location.HelpModuleLocation;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import help.HelpBuildUtils;
import help.validator.location.DirectoryHelpModuleLocation;
import help.validator.location.HelpModuleLocation;
public class HelpTopic implements Comparable<HelpTopic> {
private final HelpModuleLocation help;
private final Path topicFile;
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) {
@ -51,8 +50,8 @@ public class HelpTopic implements Comparable<HelpTopic> {
Path helpDir = help.getHelpLocation();
Path unknowFSRelativePath = helpDir.relativize(topicFile); // may or may not be jar paths
this.relativePath = HelpBuildUtils.toDefaultFS(unknowFSRelativePath);
Path unknownFSRelativePath = helpDir.relativize(topicFile); // may or may not be jar paths
this.relativePath = HelpBuildUtils.toDefaultFS(unknownFSRelativePath);
loadHelpFiles(topicFile);
}
@ -104,7 +103,7 @@ public class HelpTopic implements Comparable<HelpTopic> {
if (topicFile.getFileSystem() != FileSystems.getDefault()) {
return Collections.emptyList();
}
List<HREF> list = new ArrayList<HREF>();
List<HREF> list = new ArrayList<>();
for (HelpFile helpFile : helpFiles.values()) {
list.addAll(helpFile.getAllHREFs());
}
@ -116,7 +115,7 @@ public class HelpTopic implements Comparable<HelpTopic> {
if (topicFile.getFileSystem() != FileSystems.getDefault()) {
return Collections.emptyList();
}
List<IMG> list = new ArrayList<IMG>();
List<IMG> list = new ArrayList<>();
for (HelpFile helpFile : helpFiles.values()) {
list.addAll(helpFile.getAllIMGs());
}
@ -125,7 +124,7 @@ public class HelpTopic implements Comparable<HelpTopic> {
public Collection<AnchorDefinition> getAllAnchorDefinitions() {
// 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()) {
list.addAll(helpFile.getAllAnchorDefinitions());
}