mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 20:22:44 +00:00
Merge remote-tracking branch 'origin/GP-4166_dev747368_fix_any_unicodescript_in_list' into patch
This commit is contained in:
commit
14615b508e
@ -29,9 +29,9 @@ public class CharacterScriptUtils {
|
||||
|
||||
/**
|
||||
* The {@link UnicodeScript} value that represents the "ANY" choice. This is a bit of a hack
|
||||
* and re-uses the INHERITED enum value for this purpose.
|
||||
* and re-uses the enum value for this purpose.
|
||||
*/
|
||||
public static final UnicodeScript ANY_SCRIPT_ALIAS = UnicodeScript.INHERITED;
|
||||
public static final UnicodeScript ANY_SCRIPT_ALIAS = UnicodeScript.UNKNOWN;
|
||||
|
||||
/**
|
||||
* Premade examples of characters from each specified script, using info from
|
||||
|
@ -1063,7 +1063,11 @@ public class EncodedStringsDialog extends DialogComponentProvider {
|
||||
|
||||
private ComboBoxModel<UnicodeScript> getScriptListModel(EncodedStringsFilterStats stats) {
|
||||
List<UnicodeScript> scripts = new ArrayList<>(stats.foundScriptCounts.keySet());
|
||||
Collections.sort(scripts, (us1, us2) -> us1.name().compareTo(us2.name()));
|
||||
Collections.sort(scripts, (us1, us2) -> {
|
||||
int us1Count = stats.foundScriptCounts.get(us1);
|
||||
int us2Count = stats.foundScriptCounts.get(us2);
|
||||
return Integer.compare(us2Count, us1Count); // descending
|
||||
});
|
||||
scripts.add(0, CharacterScriptUtils.ANY_SCRIPT_ALIAS);
|
||||
|
||||
return new DefaultComboBoxModel<>(new Vector<>(scripts));
|
||||
|
@ -48,7 +48,12 @@ public record StringInfo(
|
||||
s.codePoints().forEach(codePoint -> {
|
||||
try {
|
||||
UnicodeScript script = Character.UnicodeScript.of(codePoint);
|
||||
scripts.add(script);
|
||||
if (script == UnicodeScript.UNKNOWN) {
|
||||
features.add(StringInfoFeature.CODEC_ERROR); // TODO: are we mis-using this enum to signal bad character?
|
||||
}
|
||||
else {
|
||||
scripts.add(script);
|
||||
}
|
||||
|
||||
if (codePoint == StringUtilities.UNICODE_REPLACEMENT) {
|
||||
features.add(StringInfoFeature.CODEC_ERROR);
|
||||
|
Loading…
Reference in New Issue
Block a user