mirror of
https://github.com/aaru-dps/Aaru.Helpers.git
synced 2025-12-16 19:24:35 +00:00
REFACTOR: Use preferred braces style.
This commit is contained in:
12
ArrayFill.cs
12
ArrayFill.cs
@@ -39,12 +39,9 @@ namespace DiscImageChef
|
|||||||
|
|
||||||
public static void ArrayFill<T>(T[] destinationArray, T[] value)
|
public static void ArrayFill<T>(T[] destinationArray, T[] value)
|
||||||
{
|
{
|
||||||
if(destinationArray == null) { throw new ArgumentNullException(nameof(destinationArray)); }
|
if(destinationArray == null) throw new ArgumentNullException(nameof(destinationArray));
|
||||||
|
|
||||||
if(value.Length > destinationArray.Length)
|
if(value.Length > destinationArray.Length) throw new ArgumentException("Length of value array must not be more than length of destination");
|
||||||
{
|
|
||||||
throw new ArgumentException("Length of value array must not be more than length of destination");
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the initial array value
|
// set the initial array value
|
||||||
Array.Copy(value, destinationArray, value.Length);
|
Array.Copy(value, destinationArray, value.Length);
|
||||||
@@ -52,10 +49,7 @@ namespace DiscImageChef
|
|||||||
int arrayToFillHalfLength = destinationArray.Length / 2;
|
int arrayToFillHalfLength = destinationArray.Length / 2;
|
||||||
int copyLength;
|
int copyLength;
|
||||||
|
|
||||||
for(copyLength = value.Length; copyLength < arrayToFillHalfLength; copyLength <<= 1)
|
for(copyLength = value.Length; copyLength < arrayToFillHalfLength; copyLength <<= 1) Array.Copy(destinationArray, 0, destinationArray, copyLength, copyLength);
|
||||||
{
|
|
||||||
Array.Copy(destinationArray, 0, destinationArray, copyLength, copyLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
Array.Copy(destinationArray, 0, destinationArray, copyLength, destinationArray.Length - copyLength);
|
Array.Copy(destinationArray, 0, destinationArray, copyLength, destinationArray.Length - copyLength);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ namespace DiscImageChef
|
|||||||
ushort preOffset = (ushort)(typeAndTimeZone & 0xFFF);
|
ushort preOffset = (ushort)(typeAndTimeZone & 0xFFF);
|
||||||
short offset;
|
short offset;
|
||||||
|
|
||||||
if((preOffset & 0x800) == 0x800) { offset = (short)(preOffset | 0xF000); }
|
if((preOffset & 0x800) == 0x800) offset = (short)(preOffset | 0xF000);
|
||||||
else offset = (short)(preOffset & 0x7FF);
|
else offset = (short)(preOffset & 0x7FF);
|
||||||
|
|
||||||
if(offset == -2047)
|
if(offset == -2047)
|
||||||
|
|||||||
@@ -122,21 +122,19 @@ namespace DiscImageChef
|
|||||||
if(numBytes == 1)
|
if(numBytes == 1)
|
||||||
{
|
{
|
||||||
num2 = BaseStream.ReadByte();
|
num2 = BaseStream.ReadByte();
|
||||||
if(num2 == -1) { throw new EndOfStreamException("Attempted to read past the end of the stream."); }
|
if(num2 == -1) throw new EndOfStreamException("Attempted to read past the end of the stream.");
|
||||||
|
|
||||||
buffer[0] = (byte)num2;
|
buffer[0] = (byte)num2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
num2 = BaseStream.Read(buffer, offset, numBytes - offset);
|
num2 = BaseStream.Read(buffer, offset, numBytes - offset);
|
||||||
if(num2 == 0) { throw new EndOfStreamException("Attempted to read past the end of the stream."); }
|
if(num2 == 0) throw new EndOfStreamException("Attempted to read past the end of the stream.");
|
||||||
|
|
||||||
offset += num2;
|
offset += num2;
|
||||||
}
|
}
|
||||||
while(offset < numBytes);
|
while(offset < numBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user