diff --git a/CSJ2K/Icc/Tags/ICCTextDescriptionType.cs b/CSJ2K/Icc/Tags/ICCTextDescriptionType.cs
index 78543b12..c29157a3 100644
--- a/CSJ2K/Icc/Tags/ICCTextDescriptionType.cs
+++ b/CSJ2K/Icc/Tags/ICCTextDescriptionType.cs
@@ -56,7 +56,7 @@ namespace CSJ2K.Icc.Tags
offset += ICCProfile.int_size;
ascii = new byte[size - 1];
- Array.Copy(data, offset, ascii, 0, size - 1);
+ Buffer.BlockCopy(data, offset, ascii, 0, size - 1);
}
/// Return the string rep of this tag.
diff --git a/CSJ2K/Icc/Tags/ICCTextType.cs b/CSJ2K/Icc/Tags/ICCTextType.cs
index 4fcb7142..9dcb8b8e 100644
--- a/CSJ2K/Icc/Tags/ICCTextType.cs
+++ b/CSJ2K/Icc/Tags/ICCTextType.cs
@@ -50,7 +50,7 @@ namespace CSJ2K.Icc.Tags
while (data[offset + size] != 0)
++size;
ascii = new byte[size];
- Array.Copy(data, offset, ascii, 0, size);
+ Buffer.BlockCopy(data, offset, ascii, 0, size);
}
/// Return the string rep of this tag.
diff --git a/CSJ2K/Util/SupportClass.cs b/CSJ2K/Util/SupportClass.cs
index 611dc672..a199e0d9 100644
--- a/CSJ2K/Util/SupportClass.cs
+++ b/CSJ2K/Util/SupportClass.cs
@@ -581,7 +581,7 @@ internal class SupportClass
{
if (count < readLimit)
readLimit = count;
- System.Array.Copy(this.buffer, this.position, array, index, readLimit);
+ Buffer.BlockCopy(this.buffer, this.position, array, index, readLimit);
count -= readLimit;
index += readLimit;
this.position += readLimit;
@@ -1510,7 +1510,7 @@ internal class SupportClass
{
if (count < readLimit)
readLimit = count;
- System.Array.Copy(this.buffer, this.position, array, index, readLimit);
+ Buffer.BlockCopy(this.buffer, this.position, array, index, readLimit);
count -= readLimit;
index += readLimit;
this.position += readLimit;
diff --git a/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs b/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs
index 7e67929b..c89d8472 100644
--- a/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs
+++ b/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs
@@ -183,7 +183,7 @@ namespace CSJ2K.j2k.codestream.writer
// We are at end of 'buf' => extend it
byte[] oldbuf = buf;
buf = new byte[oldbuf.Length + SZ_INCR];
- Array.Copy(oldbuf, 0, buf, 0, oldbuf.Length);
+ System.Buffer.BlockCopy(oldbuf, 0, buf, 0, oldbuf.Length);
}
}
}
@@ -213,7 +213,7 @@ namespace CSJ2K.j2k.codestream.writer
// Not enough place, extend it
byte[] oldbuf = buf;
buf = new byte[oldbuf.Length + SZ_INCR];
- Array.Copy(oldbuf, 0, buf, 0, oldbuf.Length);
+ System.Buffer.BlockCopy(oldbuf, 0, buf, 0, oldbuf.Length);
// SZ_INCR is always 6 or more, so it is enough to hold all the
// new bits plus the ones to come after
}
@@ -297,7 +297,7 @@ namespace CSJ2K.j2k.codestream.writer
{
data = new byte[(avbits == 8)?curbyte:curbyte + 1];
}
- Array.Copy(buf, 0, data, 0, (avbits == 8)?curbyte:curbyte + 1);
+ System.Buffer.BlockCopy(buf, 0, data, 0, (avbits == 8) ? curbyte : curbyte + 1);
return data;
}
diff --git a/CSJ2K/j2k/codestream/writer/PktEncoder.cs b/CSJ2K/j2k/codestream/writer/PktEncoder.cs
index 3861977e..c41166b3 100644
--- a/CSJ2K/j2k/codestream/writer/PktEncoder.cs
+++ b/CSJ2K/j2k/codestream/writer/PktEncoder.cs
@@ -1258,12 +1258,12 @@ namespace CSJ2K.j2k.codestream.writer
if (cur_prevtIdxs[b] < 0)
{
cblen = cur_cbs[b].truncRates[cur_cbs[b].truncIdxs[cur_tIndx[b]]];
- Array.Copy(cur_cbs[b].data, 0, lbbuf, lblen, cblen);
+ Buffer.BlockCopy(cur_cbs[b].data, 0, lbbuf, lblen, cblen);
}
else
{
cblen = cur_cbs[b].truncRates[cur_cbs[b].truncIdxs[cur_tIndx[b]]] - cur_cbs[b].truncRates[cur_cbs[b].truncIdxs[cur_prevtIdxs[b]]];
- Array.Copy(cur_cbs[b].data, cur_cbs[b].truncRates[cur_cbs[b].truncIdxs[cur_prevtIdxs[b]]], lbbuf, lblen, cblen);
+ Buffer.BlockCopy(cur_cbs[b].data, cur_cbs[b].truncRates[cur_cbs[b].truncIdxs[cur_prevtIdxs[b]]], lbbuf, lblen, cblen);
}
lblen += cblen;
@@ -1368,9 +1368,9 @@ namespace CSJ2K.j2k.codestream.writer
for (int s = minsbi; s < maxsbi; s++)
{
// Save 'lblock'
- Array.Copy(lblock_t_c[r][s], 0, bak_lblock_t_c[r][s], 0, lblock_t_c[r][s].Length);
+ Buffer.BlockCopy(lblock_t_c[r][s], 0, bak_lblock_t_c[r][s], 0, lblock_t_c[r][s].Length);
// Save 'prevtIdxs'
- Array.Copy(prevtIdxs_t_c_r[s], 0, bak_prevtIdxs_t_c_r[s], 0, prevtIdxs_t_c_r[s].Length);
+ Buffer.BlockCopy(prevtIdxs_t_c_r[s], 0, bak_prevtIdxs_t_c_r[s], 0, prevtIdxs_t_c_r[s].Length);
} // End loop on subbands
// Loop on precincts
@@ -1447,9 +1447,9 @@ namespace CSJ2K.j2k.codestream.writer
for (int s = minsbi; s < maxsbi; s++)
{
// Restore 'lblock'
- Array.Copy(bak_lblock_t_c[r][s], 0, lblock_t_c[r][s], 0, lblock_t_c[r][s].Length);
+ Buffer.BlockCopy(bak_lblock_t_c[r][s], 0, lblock_t_c[r][s], 0, lblock_t_c[r][s].Length);
// Restore 'prevtIdxs'
- Array.Copy(bak_prevtIdxs_t_c_r[s], 0, prevtIdxs_t_c_r[s], 0, prevtIdxs_t_c_r[s].Length);
+ Buffer.BlockCopy(bak_prevtIdxs_t_c_r[s], 0, prevtIdxs_t_c_r[s], 0, prevtIdxs_t_c_r[s].Length);
} // End loop on subbands
// Loop on precincts
diff --git a/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs b/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs
index 11acfdd4..4180028b 100644
--- a/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs
+++ b/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs
@@ -515,8 +515,8 @@ namespace CSJ2K.j2k.codestream.writer
// Copy the arrays
for (k = treeV.Length - 1; k >= 0; k--)
{
- Array.Copy(treeV[k], 0, treeVbak[k], 0, treeV[k].Length);
- Array.Copy(treeS[k], 0, treeSbak[k], 0, treeS[k].Length);
+ Buffer.BlockCopy(treeV[k], 0, treeVbak[k], 0, treeV[k].Length);
+ Buffer.BlockCopy(treeS[k], 0, treeSbak[k], 0, treeS[k].Length);
}
// Set saved state
@@ -544,8 +544,8 @@ namespace CSJ2K.j2k.codestream.writer
// Copy the arrays
for (k = lvls - 1; k >= 0; k--)
{
- Array.Copy(treeVbak[k], 0, treeV[k], 0, treeV[k].Length);
- Array.Copy(treeSbak[k], 0, treeS[k], 0, treeS[k].Length);
+ Buffer.BlockCopy(treeVbak[k], 0, treeV[k], 0, treeV[k].Length);
+ Buffer.BlockCopy(treeSbak[k], 0, treeS[k], 0, treeS[k].Length);
}
}
diff --git a/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs b/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs
index 5f68fabd..7141639d 100644
--- a/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs
+++ b/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs
@@ -196,7 +196,7 @@ namespace CSJ2K.j2k.entropy.decoder
if (count + len <= buf.Length)
{
// Enough place in 'buf'
- Array.Copy(data, off, buf, count, len);
+ Buffer.BlockCopy(data, off, buf, count, len);
count += len;
}
else
@@ -205,7 +205,7 @@ namespace CSJ2K.j2k.entropy.decoder
{
// Enough place in 'buf' if we move input data
// Move buffer
- Array.Copy(buf, pos, buf, 0, count - pos);
+ Buffer.BlockCopy(buf, pos, buf, 0, count - pos);
}
else
{
@@ -213,12 +213,12 @@ namespace CSJ2K.j2k.entropy.decoder
byte[] oldbuf = buf;
buf = new byte[count - pos + len];
// Copy buffer
- Array.Copy(oldbuf, count, buf, 0, count - pos);
+ Buffer.BlockCopy(oldbuf, count, buf, 0, count - pos);
}
count -= pos;
pos = 0;
// Copy new data
- Array.Copy(data, off, buf, count, len);
+ Buffer.BlockCopy(data, off, buf, count, len);
count += len;
}
}
diff --git a/CSJ2K/j2k/entropy/decoder/MQDecoder.cs b/CSJ2K/j2k/entropy/decoder/MQDecoder.cs
index 69d9001c..9147cbbc 100644
--- a/CSJ2K/j2k/entropy/decoder/MQDecoder.cs
+++ b/CSJ2K/j2k/entropy/decoder/MQDecoder.cs
@@ -756,7 +756,7 @@ namespace CSJ2K.j2k.entropy.decoder
///
public void resetCtxts()
{
- Array.Copy(initStates, 0, I, 0, I.Length);
+ Buffer.BlockCopy(initStates, 0, I, 0, I.Length);
ArrayUtil.intArraySet(mPS, 0);
}
diff --git a/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs b/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs
index 1b5bc3cf..53cce5e0 100644
--- a/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs
+++ b/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs
@@ -113,7 +113,7 @@ namespace CSJ2K.j2k.entropy.encoder
// Resize buffer
byte[] tmpbuf = buf;
buf = new byte[buf.Length + BUF_INC];
- Array.Copy(tmpbuf, 0, buf, 0, count);
+ Buffer.BlockCopy(tmpbuf, 0, buf, 0, count);
}
buf[count++] = (byte) b;
}
@@ -137,7 +137,7 @@ namespace CSJ2K.j2k.entropy.encoder
public virtual void toByteArray(int off, int len, byte[] outbuf, int outoff)
{
// Copy the data
- Array.Copy(buf, off, outbuf, outoff, len);
+ Buffer.BlockCopy(buf, off, outbuf, outoff, len);
}
/// Returns the number of valid bytes in the output buffer (count class
diff --git a/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs b/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs
index 09f9732b..fda0519c 100644
--- a/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs
+++ b/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs
@@ -334,13 +334,13 @@ ploop: ;
if (termp != null)
{
isTermPass = new bool[n];
- Array.Copy(termp, 0, isTermPass, 0, n);
+ Buffer.BlockCopy(termp, 0, isTermPass, 0, n);
}
else
{
isTermPass = null;
}
- Array.Copy(rates, 0, truncRates, 0, n);
+ Buffer.BlockCopy(rates, 0, truncRates, 0, n);
for (k = first_pnt, p = - 1, i = 0; k < n; k++)
{
if (rates[k] > 0)
diff --git a/CSJ2K/j2k/entropy/encoder/LayersInfo.cs b/CSJ2K/j2k/entropy/encoder/LayersInfo.cs
index b99e5ec7..58e5d371 100644
--- a/CSJ2K/j2k/entropy/encoder/LayersInfo.cs
+++ b/CSJ2K/j2k/entropy/encoder/LayersInfo.cs
@@ -236,8 +236,8 @@ namespace CSJ2K.j2k.entropy.encoder
// both arrays always have same size
optbrate = new float[optbrate.Length + SZ_INCR];
extralyrs = new int[extralyrs.Length + SZ_INCR];
- Array.Copy(tbr, 0, optbrate, 0, nopt);
- Array.Copy(tel, 0, extralyrs, 0, nopt);
+ Buffer.BlockCopy(tbr, 0, optbrate, 0, nopt);
+ Buffer.BlockCopy(tel, 0, extralyrs, 0, nopt);
}
// Add new optimization point
optbrate[nopt] = brate;
diff --git a/CSJ2K/j2k/entropy/encoder/MQCoder.cs b/CSJ2K/j2k/entropy/encoder/MQCoder.cs
index 520d87ce..e3c7700c 100644
--- a/CSJ2K/j2k/entropy/encoder/MQCoder.cs
+++ b/CSJ2K/j2k/entropy/encoder/MQCoder.cs
@@ -1323,7 +1323,7 @@ namespace CSJ2K.j2k.entropy.encoder
///
public void resetCtxts()
{
- Array.Copy(initStates, 0, I, 0, I.Length);
+ Buffer.BlockCopy(initStates, 0, I, 0, I.Length);
ArrayUtil.intArraySet(mPS, 0);
}
diff --git a/CSJ2K/j2k/image/DataBlkFloat.cs b/CSJ2K/j2k/image/DataBlkFloat.cs
index a3aed3cc..f762bf67 100644
--- a/CSJ2K/j2k/image/DataBlkFloat.cs
+++ b/CSJ2K/j2k/image/DataBlkFloat.cs
@@ -188,7 +188,7 @@ namespace CSJ2K.j2k.image
this.scanw = this.w;
this.data = new float[this.w * this.h];
for (int i = 0; i < this.h; i++)
- Array.Copy(src.data, i * src.scanw, this.data, i * this.scanw, this.w);
+ Buffer.BlockCopy(src.data, i * src.scanw, this.data, i * this.scanw, this.w);
}
/// Returns a string of informations about the DataBlkInt.
diff --git a/CSJ2K/j2k/image/DataBlkInt.cs b/CSJ2K/j2k/image/DataBlkInt.cs
index b785f2c7..22a1f3c6 100644
--- a/CSJ2K/j2k/image/DataBlkInt.cs
+++ b/CSJ2K/j2k/image/DataBlkInt.cs
@@ -189,7 +189,7 @@ namespace CSJ2K.j2k.image
this.scanw = this.w;
this.data_array = new int[this.w * this.h];
for (int i = 0; i < this.h; i++)
- Array.Copy(src.data_array, i * src.scanw, this.data_array, i * this.scanw, this.w);
+ Buffer.BlockCopy(src.data_array, i * src.scanw, this.data_array, i * this.scanw, this.w);
}
/// Returns a string of informations about the DataBlkInt.
diff --git a/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs b/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs
index 00af357f..89c73eb4 100644
--- a/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs
+++ b/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs
@@ -246,14 +246,14 @@ namespace CSJ2K.j2k.image.forwcomptransf
switch (ttype)
{
- case NONE:
- Array.Copy(ntdepth, 0, tdepth, 0, ntdepth.Length);
+ case NONE:
+ Buffer.BlockCopy(ntdepth, 0, tdepth, 0, ntdepth.Length);
break;
case FORW_RCT:
if (ntdepth.Length > 3)
{
- Array.Copy(ntdepth, 3, tdepth, 3, ntdepth.Length - 3);
+ Buffer.BlockCopy(ntdepth, 3, tdepth, 3, ntdepth.Length - 3);
}
// The formulas are:
// tdepth[0] = ceil(log2(2^(ntdepth[0])+2^ntdepth[1]+
@@ -271,7 +271,7 @@ namespace CSJ2K.j2k.image.forwcomptransf
case FORW_ICT:
if (ntdepth.Length > 3)
{
- Array.Copy(ntdepth, 3, tdepth, 3, ntdepth.Length - 3);
+ Buffer.BlockCopy(ntdepth, 3, tdepth, 3, ntdepth.Length - 3);
}
// The MathUtil.log2(x) function calculates floor(log2(x)), so we
// use 'MathUtil.log2(2*x-1)+1', which calculates ceil(log2(x))
diff --git a/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs b/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs
index dd88510a..489e250e 100644
--- a/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs
+++ b/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs
@@ -292,14 +292,14 @@ namespace CSJ2K.j2k.image.invcomptransf
switch (ttype)
{
- case NONE:
- Array.Copy(utdepth, 0, tdepth, 0, utdepth.Length);
+ case NONE:
+ Buffer.BlockCopy(utdepth, 0, tdepth, 0, utdepth.Length);
break;
case INV_RCT:
if (utdepth.Length > 3)
{
- Array.Copy(utdepth, 3, tdepth, 3, utdepth.Length - 3);
+ Buffer.BlockCopy(utdepth, 3, tdepth, 3, utdepth.Length - 3);
}
// The formulas are:
// tdepth[0] = ceil(log2(2^(utdepth[0])+2^utdepth[1]+
@@ -317,7 +317,7 @@ namespace CSJ2K.j2k.image.invcomptransf
case INV_ICT:
if (utdepth.Length > 3)
{
- Array.Copy(utdepth, 3, tdepth, 3, utdepth.Length - 3);
+ Buffer.BlockCopy(utdepth, 3, tdepth, 3, utdepth.Length - 3);
}
// The MathUtil.log2(x) function calculates floor(log2(x)), so we
// use 'MathUtil.log2(2*x-1)+1', which calculates ceil(log2(x))
diff --git a/CSJ2K/j2k/io/BufferedRandomAccessFile.cs b/CSJ2K/j2k/io/BufferedRandomAccessFile.cs
index b97d7150..d9436c2a 100644
--- a/CSJ2K/j2k/io/BufferedRandomAccessFile.cs
+++ b/CSJ2K/j2k/io/BufferedRandomAccessFile.cs
@@ -475,7 +475,7 @@ namespace CSJ2K.j2k.io
clen = maxByte - position;
if (clen > len)
clen = len;
- Array.Copy(byteBuffer, position, b, off, clen);
+ Buffer.BlockCopy(byteBuffer, position, b, off, clen);
position += clen;
off += clen;
len -= clen;
diff --git a/CSJ2K/j2k/util/ArrayUtil.cs b/CSJ2K/j2k/util/ArrayUtil.cs
index 2bbe89ab..01a16fdb 100644
--- a/CSJ2K/j2k/util/ArrayUtil.cs
+++ b/CSJ2K/j2k/util/ArrayUtil.cs
@@ -103,12 +103,12 @@ namespace CSJ2K.j2k.util
for (; i <= len2; i <<= 1)
{
// Copy values doubling size each time
- Array.Copy(arr, 0, arr, i, i);
+ Buffer.BlockCopy(arr, 0, arr, i, i);
}
if (i < len)
{
// Copy values to end
- Array.Copy(arr, 0, arr, i, len - i);
+ Buffer.BlockCopy(arr, 0, arr, i, len - i);
}
}
}
@@ -155,12 +155,12 @@ namespace CSJ2K.j2k.util
for (; i <= len2; i <<= 1)
{
// Copy values doubling size each time
- Array.Copy(arr, 0, arr, i, i);
+ Buffer.BlockCopy(arr, 0, arr, i, i);
}
if (i < len)
{
// Copy values to end
- Array.Copy(arr, 0, arr, i, len - i);
+ Buffer.BlockCopy(arr, 0, arr, i, len - i);
}
}
}
diff --git a/CSJ2K/j2k/util/ISRandomAccessIO.cs b/CSJ2K/j2k/util/ISRandomAccessIO.cs
index a3b634ef..2155aefc 100644
--- a/CSJ2K/j2k/util/ISRandomAccessIO.cs
+++ b/CSJ2K/j2k/util/ISRandomAccessIO.cs
@@ -217,7 +217,7 @@ namespace CSJ2K.j2k.util
{
throw new System.IO.IOException("Out of memory to cache input data");
}
- Array.Copy(buf, 0, newbuf, 0, len);
+ Buffer.BlockCopy(buf, 0, newbuf, 0, len);
buf = newbuf;
}
@@ -410,7 +410,7 @@ namespace CSJ2K.j2k.util
if (pos + n <= len)
{
// common, fast case
- Array.Copy(buf, pos, b, off, n);
+ Buffer.BlockCopy(buf, pos, b, off, n);
pos += n;
return ;
}
@@ -423,7 +423,7 @@ namespace CSJ2K.j2k.util
{
throw new System.IO.EndOfStreamException();
}
- Array.Copy(buf, pos, b, off, n);
+ Buffer.BlockCopy(buf, pos, b, off, n);
pos += n;
}