code cleanup
Remove three Stream.CopyTo(Stream) variants that all did the exact same thing as the framework method Stream.CopyTo(Stream). None of them were used anywhere.
This commit is contained in:
parent
04f86c2843
commit
d13a1b54a2
|
@ -58,43 +58,6 @@ namespace BizHawk.Common.IOExtensions
|
|||
}
|
||||
}
|
||||
|
||||
public static void CopyTo(this Stream src, Stream dest)
|
||||
{
|
||||
int size = src.CanSeek ? Math.Min((int)(src.Length - src.Position), 0x2000) : 0x2000;
|
||||
byte[] buffer = new byte[size];
|
||||
int n;
|
||||
do
|
||||
{
|
||||
n = src.Read(buffer, 0, buffer.Length);
|
||||
dest.Write(buffer, 0, n);
|
||||
}
|
||||
while (n != 0);
|
||||
}
|
||||
|
||||
public static void CopyTo(this MemoryStream src, Stream dest)
|
||||
{
|
||||
dest.Write(src.GetBuffer(), (int)src.Position, (int)(src.Length - src.Position));
|
||||
}
|
||||
|
||||
public static void CopyTo(this Stream src, MemoryStream dest)
|
||||
{
|
||||
if (src.CanSeek)
|
||||
{
|
||||
int pos = (int)dest.Position;
|
||||
int length = (int)(src.Length - src.Position) + pos;
|
||||
dest.SetLength(length);
|
||||
|
||||
while (pos < length)
|
||||
{
|
||||
pos += src.Read(dest.GetBuffer(), pos, length - pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
src.CopyTo(dest);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write(this BinaryWriter bw, int[] buffer)
|
||||
{
|
||||
foreach (int b in buffer)
|
||||
|
|
Loading…
Reference in New Issue