mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-22 15:04:43 +00:00
Replace Span<T>.Fill(0) with Span<T>.Clear()
This commit is contained in:
@@ -196,7 +196,7 @@ namespace SharpCompress.Common.Tar.Headers
|
||||
{
|
||||
name.CopyTo(buffer);
|
||||
int i = Math.Min(length, name.Length);
|
||||
buffer.Slice(i, length - i).Fill(0);
|
||||
buffer.Slice(i, length - i).Clear();
|
||||
}
|
||||
|
||||
private static void WriteStringBytes(string name, byte[] buffer, int offset, int length)
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
|
||||
private void RestartModelRare()
|
||||
{
|
||||
new Span<int>(_charMask).Fill(0);
|
||||
new Span<int>(_charMask).Clear();
|
||||
SubAlloc.InitSubAllocator();
|
||||
_initRl = -(_maxOrder < 12 ? _maxOrder : 12) - 1;
|
||||
int addr = SubAlloc.AllocContext();
|
||||
@@ -228,7 +228,7 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
private void ClearMask()
|
||||
{
|
||||
_escCount = 1;
|
||||
new Span<int>(_charMask).Fill(0);
|
||||
new Span<int>(_charMask).Clear();
|
||||
}
|
||||
|
||||
internal bool DecodeInit(IRarUnpack unpackRead, int escChar)
|
||||
|
||||
@@ -360,7 +360,7 @@ namespace SharpCompress.Compressors.PPMd.H
|
||||
public virtual void InitSubAllocator()
|
||||
{
|
||||
int i, k;
|
||||
new Span<byte>(_heap, _freeListPos, SizeOfFreeList()).Fill(0);
|
||||
new Span<byte>(_heap, _freeListPos, SizeOfFreeList()).Clear();
|
||||
|
||||
_pText = _heapStart;
|
||||
|
||||
|
||||
@@ -729,13 +729,13 @@ namespace SharpCompress.Compressors.Rar.UnpackV1
|
||||
if (!solid)
|
||||
{
|
||||
tablesRead = false;
|
||||
new Span<int>(oldDist).Fill(0); // memset(oldDist,0,sizeof(OldDist));
|
||||
new Span<int>(oldDist).Clear(); // memset(oldDist,0,sizeof(OldDist));
|
||||
|
||||
oldDistPtr = 0;
|
||||
lastDist = 0;
|
||||
lastLength = 0;
|
||||
|
||||
new Span<byte>(unpOldTable).Fill(0); // memset(UnpOldTable,0,sizeof(UnpOldTable));
|
||||
new Span<byte>(unpOldTable).Clear(); // memset(UnpOldTable,0,sizeof(UnpOldTable));
|
||||
|
||||
unpPtr = 0;
|
||||
wrPtr = 0;
|
||||
@@ -837,7 +837,7 @@ WriteBorder=Math.Min(MaxWinSize,UNPACK_MAX_WRITE)&MaxWinMask;
|
||||
|
||||
if ((bitField & 0x4000) == 0)
|
||||
{
|
||||
new Span<byte>(unpOldTable).Fill(0); // memset(UnpOldTable,0,sizeof(UnpOldTable));
|
||||
new Span<byte>(unpOldTable).Clear(); // memset(UnpOldTable,0,sizeof(UnpOldTable));
|
||||
}
|
||||
AddBits(2);
|
||||
|
||||
@@ -1109,7 +1109,7 @@ WriteBorder=Math.Min(MaxWinSize,UNPACK_MAX_WRITE)&MaxWinMask;
|
||||
oldFilterLengths[FiltPos] = StackFilter.BlockLength;
|
||||
|
||||
// memset(StackFilter->Prg.InitR,0,sizeof(StackFilter->Prg.InitR));
|
||||
new Span<int>(StackFilter.Program.InitR).Fill(0);
|
||||
new Span<int>(StackFilter.Program.InitR).Clear();
|
||||
StackFilter.Program.InitR[3] = RarVM.VM_GLOBALMEMADDR; // StackFilter->Prg.InitR[3]=VM_GLOBALMEMADDR;
|
||||
StackFilter.Program.InitR[4] = StackFilter.BlockLength;
|
||||
|
||||
|
||||
@@ -652,9 +652,9 @@ namespace SharpCompress.Compressors.Rar.UnpackV1
|
||||
ChSetC[I] = ((~I + 1) & 0xff) << 8;
|
||||
}
|
||||
|
||||
new Span<int>(NToPl).Fill(0); // memset(NToPl,0,sizeof(NToPl));
|
||||
new Span<int>(NToPlB).Fill(0); // memset(NToPlB,0,sizeof(NToPlB));
|
||||
new Span<int>(NToPlC).Fill(0); // memset(NToPlC,0,sizeof(NToPlC));
|
||||
new Span<int>(NToPl).Clear(); // memset(NToPl,0,sizeof(NToPl));
|
||||
new Span<int>(NToPlB).Clear(); // memset(NToPlB,0,sizeof(NToPlB));
|
||||
new Span<int>(NToPlC).Clear(); // memset(NToPlC,0,sizeof(NToPlC));
|
||||
corrHuff(ChSetB, NToPlB);
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ namespace SharpCompress.Compressors.Rar.UnpackV1
|
||||
// & ~0xff) | I;
|
||||
}
|
||||
}
|
||||
new Span<int>(NumToPlace).Fill(0); // memset(NumToPlace,0,sizeof(NToPl));
|
||||
new Span<int>(NumToPlace).Clear(); // memset(NumToPlace,0,sizeof(NToPl));
|
||||
for (I = 6; I >= 0; I--)
|
||||
{
|
||||
NumToPlace[I] = (7 - I) * 32;
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace SharpCompress.Compressors.Rar.UnpackV1
|
||||
if (0 == (BitField & 0x4000))
|
||||
{
|
||||
// memset(UnpOldTable20,0,sizeof(UnpOldTable20));
|
||||
new Span<byte>(UnpOldTable20).Fill(0);
|
||||
new Span<byte>(UnpOldTable20).Clear();
|
||||
}
|
||||
AddBits(2);
|
||||
|
||||
@@ -371,7 +371,7 @@ namespace SharpCompress.Compressors.Rar.UnpackV1
|
||||
AudV[3] = new AudioVariables();
|
||||
|
||||
// memset(UnpOldTable20,0,sizeof(UnpOldTable20));
|
||||
new Span<byte>(UnpOldTable20).Fill(0);
|
||||
new Span<byte>(UnpOldTable20).Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace SharpCompress.Compressors.Rar.UnpackV1
|
||||
int i;
|
||||
long M, N;
|
||||
|
||||
new Span<int>(dec.DecodeNum).Fill(0); // memset(Dec->DecodeNum,0,Size*sizeof(*Dec->DecodeNum));
|
||||
new Span<int>(dec.DecodeNum).Clear(); // memset(Dec->DecodeNum,0,Size*sizeof(*Dec->DecodeNum));
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
|
||||
@@ -546,9 +546,9 @@ internal static class Unpack15Local {
|
||||
ChSetA[I]=(ushort)I;
|
||||
ChSetC[I]=(ushort)(((~I+1) & 0xff)<<8);
|
||||
}
|
||||
new Span<byte>(NToPl).Fill(0);
|
||||
new Span<byte>(NToPlB).Fill(0);
|
||||
new Span<byte>(NToPlC).Fill(0);
|
||||
new Span<byte>(NToPl).Clear();
|
||||
new Span<byte>(NToPlB).Clear();
|
||||
new Span<byte>(NToPlC).Clear();
|
||||
CorrHuff(ChSetB,NToPlB);
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ internal static class Unpack15Local {
|
||||
for (I=7;I>=0;I--)
|
||||
for (J=0;J<32;J++)
|
||||
CharSet[J]=(ushort)((CharSet[J] & ~0xff) | I);
|
||||
new Span<byte>(NumToPlace, 0, NToPl.Length).Fill(0);
|
||||
new Span<byte>(NumToPlace, 0, NToPl.Length).Clear();
|
||||
for (I=6;I>=0;I--)
|
||||
NumToPlace[I]=(byte)((7-I)*32);
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ internal static class Unpack20Local {
|
||||
|
||||
if ((BitField & 0x4000) != 0)
|
||||
{
|
||||
new Span<byte>(UnpOldTable20).Fill(0);
|
||||
new Span<byte>(UnpOldTable20).Clear();
|
||||
}
|
||||
|
||||
Inp.addbits(2);
|
||||
@@ -363,7 +363,7 @@ internal static class Unpack20Local {
|
||||
|
||||
//memset(AudV,0,sizeof(AudV));
|
||||
AudV = new AudioVariables[4];
|
||||
new Span<byte>(UnpOldTable20).Fill(0);
|
||||
new Span<byte>(UnpOldTable20).Clear();
|
||||
//memset(MD,0,sizeof(MD));
|
||||
MD = new DecodeTable[4];
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public Unpack(/* ComprDataIO *DataIO */)
|
||||
{
|
||||
if (!Solid)
|
||||
{
|
||||
new Span<uint>(OldDist).Fill(0);
|
||||
new Span<uint>(OldDist).Clear();
|
||||
OldDistPtr=0;
|
||||
LastDist=LastLength=0;
|
||||
// memset(Window,0,MaxWinSize);
|
||||
@@ -270,7 +270,7 @@ public Unpack(/* ComprDataIO *DataIO */)
|
||||
|
||||
// Set the entire DecodeNum to zero.
|
||||
//memset(Dec->DecodeNum,0,Size*sizeof(*Dec->DecodeNum));
|
||||
new Span<ushort>(Dec.DecodeNum).Fill(0);
|
||||
new Span<ushort>(Dec.DecodeNum).Clear();
|
||||
|
||||
// Initialize not really used entry for zero length code.
|
||||
Dec.DecodePos[0]=0;
|
||||
|
||||
Reference in New Issue
Block a user