refactor: better naming for resolver warning parameters

Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
oSumAtrIX 2022-04-15 08:51:56 +02:00
parent 5ca5a1c29e
commit c8b68e36e0
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 7 additions and 7 deletions

View File

@ -92,14 +92,14 @@ interface PatternScanMethod {
/** /**
* Represents a resolver warning. * Represents a resolver warning.
* @param expected The opcode the signature expected it to be. * @param correctOpcode The opcode the signature expected it to be.
* @param current The current opcode in the pattern. Always different from [expected]. * @param wrongOpcode The opcode the signature currently has.
* @param instructionIndex The index of the opcode relative to the instruction list. * @param instructionIndex The index of the opcode relative to the instruction list.
* @param patternIndex The index of the opcode relative to the pattern list from the signature. * @param patternIndex The index of the opcode relative to the pattern list from the signature.
*/ */
data class Warning( data class Warning(
val expected: Opcode, val correctOpcode: Opcode,
val current: Opcode, val wrongOpcode: Opcode,
val instructionIndex: Int, val instructionIndex: Int,
val patternIndex: Int, val patternIndex: Int,
) )

View File

@ -127,15 +127,15 @@ internal class SignatureResolver(
) = buildList { ) = buildList {
val pattern = signature.opcodes!! val pattern = signature.opcodes!!
for ((patternIndex, originalIndex) in (scanResult.startIndex until scanResult.endIndex).withIndex()) { for ((patternIndex, originalIndex) in (scanResult.startIndex until scanResult.endIndex).withIndex()) {
val originalOpcode = instructions.elementAt(originalIndex).opcode val correctOpcode = instructions.elementAt(originalIndex).opcode
val patternOpcode = pattern.elementAt(patternIndex) val patternOpcode = pattern.elementAt(patternIndex)
if ( if (
patternOpcode != null && // unknown opcode patternOpcode != null && // unknown opcode
originalOpcode != patternOpcode correctOpcode != patternOpcode
) { ) {
this.add( this.add(
PatternScanMethod.Fuzzy.Warning( PatternScanMethod.Fuzzy.Warning(
originalOpcode, patternOpcode, correctOpcode, patternOpcode,
originalIndex, patternIndex, originalIndex, patternIndex,
) )
) )