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)
|
||||
{
|
||||
if(destinationArray == null) { throw new ArgumentNullException(nameof(destinationArray)); }
|
||||
if(destinationArray == null) throw new ArgumentNullException(nameof(destinationArray));
|
||||
|
||||
if(value.Length > destinationArray.Length)
|
||||
{
|
||||
throw new ArgumentException("Length of value array must not be more than length of destination");
|
||||
}
|
||||
if(value.Length > destinationArray.Length) throw new ArgumentException("Length of value array must not be more than length of destination");
|
||||
|
||||
// set the initial array value
|
||||
Array.Copy(value, destinationArray, value.Length);
|
||||
@@ -52,10 +49,7 @@ namespace DiscImageChef
|
||||
int arrayToFillHalfLength = destinationArray.Length / 2;
|
||||
int copyLength;
|
||||
|
||||
for(copyLength = value.Length; copyLength < arrayToFillHalfLength; copyLength <<= 1)
|
||||
{
|
||||
Array.Copy(destinationArray, 0, destinationArray, copyLength, copyLength);
|
||||
}
|
||||
for(copyLength = value.Length; copyLength < arrayToFillHalfLength; copyLength <<= 1) Array.Copy(destinationArray, 0, destinationArray, copyLength, copyLength);
|
||||
|
||||
Array.Copy(destinationArray, 0, destinationArray, copyLength, destinationArray.Length - copyLength);
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace DiscImageChef
|
||||
ushort preOffset = (ushort)(typeAndTimeZone & 0xFFF);
|
||||
short offset;
|
||||
|
||||
if((preOffset & 0x800) == 0x800) { offset = (short)(preOffset | 0xF000); }
|
||||
if((preOffset & 0x800) == 0x800) offset = (short)(preOffset | 0xF000);
|
||||
else offset = (short)(preOffset & 0x7FF);
|
||||
|
||||
if(offset == -2047)
|
||||
|
||||
@@ -122,16 +122,15 @@ namespace DiscImageChef
|
||||
if(numBytes == 1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -139,4 +138,3 @@ namespace DiscImageChef
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user