[Refactor] Fix indentation issues.

This commit is contained in:
2025-11-24 19:38:40 +00:00
parent 5774885431
commit 8331fba1e4
43 changed files with 1700 additions and 1751 deletions

View File

@@ -800,8 +800,7 @@ public static class Identify
if(IdentifyDeviceResponse.Length != 512)
{
AaruLogging.Debug(MODULE_NAME,
Localization.IDENTIFY_response_is_different_than_512_bytes_not_decoding);
AaruLogging.Debug(MODULE_NAME, Localization.IDENTIFY_response_is_different_than_512_bytes_not_decoding);
return null;
}
@@ -833,8 +832,8 @@ public static class Identify
ataId.WWN = DescrambleWWN(ataId.WWN);
ataId.WWNExtension = DescrambleWWN(ataId.WWNExtension);
byte[] buf = new byte[512];
nint ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512);
var buf = new byte[512];
nint ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512);
System.Runtime.InteropServices.Marshal.StructureToPtr(ataId, ptr, false);
System.Runtime.InteropServices.Marshal.Copy(ptr, buf, 0, 512);
System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr);
@@ -858,7 +857,7 @@ public static class Identify
static ulong DescrambleWWN(ulong WWN)
{
byte[] qwb = BitConverter.GetBytes(WWN);
byte[] qword = new byte[8];
var qword = new byte[8];
qword[7] = qwb[1];
qword[6] = qwb[0];
@@ -876,7 +875,7 @@ public static class Identify
{
byte[] outbuf = buffer[offset + length - 1] != 0x00 ? new byte[length + 1] : new byte[length];
for(int i = 0; i < length; i += 2)
for(var i = 0; i < length; i += 2)
{
outbuf[i] = buffer[offset + i + 1];
outbuf[i + 1] = buffer[offset + i];
@@ -889,9 +888,9 @@ public static class Identify
static byte[] ScrambleATAString(string str, int length)
{
byte[] buf = new byte[length];
var buf = new byte[length];
for(int i = 0; i < length; i++) buf[i] = 0x20;
for(var i = 0; i < length; i++) buf[i] = 0x20;
if(str is null) return buf;
@@ -899,13 +898,13 @@ public static class Identify
if(bytes.Length % 2 != 0)
{
byte[] tmp = new byte[bytes.Length + 1];
var tmp = new byte[bytes.Length + 1];
tmp[^1] = 0x20;
Array.Copy(bytes, 0, tmp, 0, bytes.Length);
bytes = tmp;
}
for(int i = 0; i < bytes.Length; i += 2)
for(var i = 0; i < bytes.Length; i += 2)
{
buf[i] = bytes[i + 1];
buf[i + 1] = bytes[i];

View File

@@ -38,7 +38,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Aaru.Logging;
namespace Aaru.CommonTypes.Structs.Devices.SCSI;
@@ -276,8 +275,8 @@ public struct Inquiry
if(SCSIInquiryResponse.Length < 36 && SCSIInquiryResponse.Length != 5)
{
AaruLogging.Debug(MODULE_NAME,
Localization.INQUIRY_response_is_0_bytes_less_than_minimum_of_36_bytes,
SCSIInquiryResponse.Length);
Localization.INQUIRY_response_is_0_bytes_less_than_minimum_of_36_bytes,
SCSIInquiryResponse.Length);
return null;
}
@@ -286,10 +285,9 @@ public struct Inquiry
SCSIInquiryResponse.Length != SCSIInquiryResponse[4])
{
AaruLogging.Debug(MODULE_NAME,
Localization
.INQUIRY_response_length_0_bytes_is_different_than_specified_in_length_field,
SCSIInquiryResponse.Length,
SCSIInquiryResponse[4] + 4);
Localization.INQUIRY_response_length_0_bytes_is_different_than_specified_in_length_field,
SCSIInquiryResponse.Length,
SCSIInquiryResponse[4] + 4);
return null;
}
@@ -477,7 +475,7 @@ public struct Inquiry
decoded.VersionDescriptors = new ushort[descriptorsNo];
for(int i = 0; i < descriptorsNo; i++)
for(var i = 0; i < descriptorsNo; i++)
decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + i * 2);
}
@@ -528,8 +526,8 @@ public struct Inquiry
Inquiry decoded = inq.Value;
byte[] buffer = new byte[512];
byte length = 0;
var buffer = new byte[512];
byte length = 0;
buffer[0] = (byte)(decoded.PeripheralQualifier << 5);
buffer[0] += decoded.PeripheralDeviceType;
@@ -729,7 +727,7 @@ public struct Inquiry
{
length = (byte)(58 + decoded.VersionDescriptors.Length * 2);
for(int i = 0; i < decoded.VersionDescriptors.Length; i++)
for(var i = 0; i < decoded.VersionDescriptors.Length; i++)
Array.Copy(BitConverter.GetBytes(decoded.VersionDescriptors[i]), 0, buffer, 56 + i * 2, 2);
}
@@ -758,7 +756,7 @@ public struct Inquiry
}
buffer[4] = length;
byte[] dest = new byte[length];
var dest = new byte[length];
Array.Copy(buffer, 0, dest, 0, length);
return dest;