GP-0: Fixing deprecated comment API warnings

This commit is contained in:
Ryan Kurtz 2025-06-02 09:54:19 -04:00
parent 5772ac2ab8
commit 684177702e
120 changed files with 1595 additions and 1641 deletions

View file

@ -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.
@ -18,11 +18,8 @@
//@category Update
import ghidra.app.script.GhidraScript;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressIterator;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.listing.CodeUnit;
import ghidra.program.model.listing.Listing;
import ghidra.program.model.address.*;
import ghidra.program.model.listing.*;
public class DeleteExitCommentsScript extends GhidraScript {
@ -38,13 +35,13 @@ public class DeleteExitCommentsScript extends GhidraScript {
set = currentSelection;
}
int updateCount=0;
AddressIterator iter = listing.getCommentAddressIterator(CodeUnit.POST_COMMENT, set, true);
AddressIterator iter = listing.getCommentAddressIterator(CommentType.POST, set, true);
while (iter.hasNext()) {
Address addr = iter.next();
CodeUnit cu = listing.getCodeUnitAt(addr);
String[] comment = cu.getCommentAsArray(CodeUnit.POST_COMMENT);
String[] comment = cu.getCommentAsArray(CommentType.POST);
if (comment.length == 1 && comment[0].endsWith(EXIT_COMMENT)) {
cu.setComment(CodeUnit.POST_COMMENT, null);
cu.setComment(CommentType.POST, null);
++updateCount;
}
}