From e449e534545e4a8a30902ea3b72ec28832416715 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 13 Nov 2022 20:08:10 +0000 Subject: [PATCH] Convert local variable or field into constant. --- DVD/PFI.cs | 4 ++-- PCMCIA/CIS.cs | 2 +- SCSI/Modes/01_MMC.cs | 26 ++++++++++++++------------ SCSI/Modes/07_MMC.cs | 26 ++++++++++++++------------ 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/DVD/PFI.cs b/DVD/PFI.cs index e3a68dd9c..d07c60c49 100644 --- a/DVD/PFI.cs +++ b/DVD/PFI.cs @@ -484,7 +484,7 @@ public static class PFI _ => $"unknown size identifier {decoded.DiscSize}" }; - var categorySentence = "Disc is a {0} {1} version {2}"; + const string categorySentence = "Disc is a {0} {1} version {2}"; switch(decoded.DiskCategory) { @@ -669,7 +669,7 @@ public static class PFI if(decoded.RecordedBookType != decoded.DiskCategory) { - var bookTypeSentence = "Disc book type is {0}"; + const string bookTypeSentence = "Disc book type is {0}"; switch(decoded.RecordedBookType) { diff --git a/PCMCIA/CIS.cs b/PCMCIA/CIS.cs index 3bc974021..76b2051f2 100644 --- a/PCMCIA/CIS.cs +++ b/PCMCIA/CIS.cs @@ -222,7 +222,7 @@ public static class CIS var buffer = new List(); List strings = null; var firstString = false; - var secondString = false; + const bool secondString = false; var tuple = new Level1VersionTuple { diff --git a/SCSI/Modes/01_MMC.cs b/SCSI/Modes/01_MMC.cs index 81a1adb6f..c7bbb85b1 100644 --- a/SCSI/Modes/01_MMC.cs +++ b/SCSI/Modes/01_MMC.cs @@ -128,20 +128,22 @@ public static partial class Modes if(page.ReadRetryCount > 0) sb.AppendFormat("\tDrive will repeat read operations {0} times", page.ReadRetryCount).AppendLine(); - var AllUsed = "\tAll available recovery procedures will be used.\n"; - var CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; - var RetriesUsed = "\tOnly retries are used.\n"; - var RecoveredNotReported = "\tRecovered errors will not be reported.\n"; - var RecoveredReported = "\tRecovered errors will be reported.\n"; - var RecoveredAbort = "\tRecovered errors will be reported and aborted with CHECK CONDITION.\n"; - var UnrecECCAbort = "\tUnrecovered ECC errors will return CHECK CONDITION."; - var UnrecCIRCAbort = "\tUnrecovered CIRC errors will return CHECK CONDITION."; - var UnrecECCNotAbort = "\tUnrecovered ECC errors will not abort the transfer."; - var UnrecCIRCNotAbort = "\tUnrecovered CIRC errors will not abort the transfer."; + const string AllUsed = "\tAll available recovery procedures will be used.\n"; + const string CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; + const string RetriesUsed = "\tOnly retries are used.\n"; + const string RecoveredNotReported = "\tRecovered errors will not be reported.\n"; + const string RecoveredReported = "\tRecovered errors will be reported.\n"; + const string RecoveredAbort = "\tRecovered errors will be reported and aborted with CHECK CONDITION.\n"; + const string UnrecECCAbort = "\tUnrecovered ECC errors will return CHECK CONDITION."; + const string UnrecCIRCAbort = "\tUnrecovered CIRC errors will return CHECK CONDITION."; + const string UnrecECCNotAbort = "\tUnrecovered ECC errors will not abort the transfer."; + const string UnrecCIRCNotAbort = "\tUnrecovered CIRC errors will not abort the transfer."; - var UnrecECCAbortData = "\tUnrecovered ECC errors will return CHECK CONDITION and the uncorrected data."; + const string UnrecECCAbortData = + "\tUnrecovered ECC errors will return CHECK CONDITION and the uncorrected data."; - var UnrecCIRCAbortData = "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; + const string UnrecCIRCAbortData = + "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; switch(page.Parameter) { diff --git a/SCSI/Modes/07_MMC.cs b/SCSI/Modes/07_MMC.cs index 198ba83e7..61a450704 100644 --- a/SCSI/Modes/07_MMC.cs +++ b/SCSI/Modes/07_MMC.cs @@ -93,20 +93,22 @@ public static partial class Modes if(page.VerifyRetryCount > 0) sb.AppendFormat("\tDrive will repeat verify operations {0} times", page.VerifyRetryCount).AppendLine(); - var AllUsed = "\tAll available recovery procedures will be used.\n"; - var CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; - var RetriesUsed = "\tOnly retries are used.\n"; - var RecoveredNotReported = "\tRecovered errors will not be reported.\n"; - var RecoveredReported = "\tRecovered errors will be reported.\n"; - var RecoveredAbort = "\tRecovered errors will be reported and aborted with CHECK CONDITION.\n"; - var UnrecECCAbort = "\tUnrecovered ECC errors will return CHECK CONDITION."; - var UnrecCIRCAbort = "\tUnrecovered CIRC errors will return CHECK CONDITION."; - var UnrecECCNotAbort = "\tUnrecovered ECC errors will not abort the transfer."; - var UnrecCIRCNotAbort = "\tUnrecovered CIRC errors will not abort the transfer."; + const string AllUsed = "\tAll available recovery procedures will be used.\n"; + const string CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; + const string RetriesUsed = "\tOnly retries are used.\n"; + const string RecoveredNotReported = "\tRecovered errors will not be reported.\n"; + const string RecoveredReported = "\tRecovered errors will be reported.\n"; + const string RecoveredAbort = "\tRecovered errors will be reported and aborted with CHECK CONDITION.\n"; + const string UnrecECCAbort = "\tUnrecovered ECC errors will return CHECK CONDITION."; + const string UnrecCIRCAbort = "\tUnrecovered CIRC errors will return CHECK CONDITION."; + const string UnrecECCNotAbort = "\tUnrecovered ECC errors will not abort the transfer."; + const string UnrecCIRCNotAbort = "\tUnrecovered CIRC errors will not abort the transfer."; - var UnrecECCAbortData = "\tUnrecovered ECC errors will return CHECK CONDITION and the uncorrected data."; + const string UnrecECCAbortData = + "\tUnrecovered ECC errors will return CHECK CONDITION and the uncorrected data."; - var UnrecCIRCAbortData = "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; + const string UnrecCIRCAbortData = + "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; switch(page.Parameter) {