Lucene.Net.Core.Util.ArrayUtil: Added CLSCompliant(false) attribute to Grow and Shrink overloads that accept jagged arrays. Changed (unused) GetHashCode(sbyte[], int, int) method to GetHashCode(byte[], int, int) to make it CLS compliant.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/29e65313 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/29e65313 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/29e65313 Branch: refs/heads/api-work Commit: 29e65313d965dba5a89ecdbb3b7aa63f97b6c439 Parents: 0c711c8 Author: Shad Storhaug <[email protected]> Authored: Sun Feb 5 19:02:54 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sun Feb 5 19:02:54 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Util/ArrayUtil.cs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/29e65313/src/Lucene.Net.Core/Util/ArrayUtil.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/ArrayUtil.cs b/src/Lucene.Net.Core/Util/ArrayUtil.cs index 1ca217c..2df630e 100644 --- a/src/Lucene.Net.Core/Util/ArrayUtil.cs +++ b/src/Lucene.Net.Core/Util/ArrayUtil.cs @@ -414,7 +414,8 @@ namespace Lucene.Net.Util } } - public static sbyte[] Grow(sbyte[] array, int minSize) // LUCENENET TODO: remove this overload, mark it non-CLS compliant, or mark internal + [CLSCompliant(false)] + public static sbyte[] Grow(sbyte[] array, int minSize) { Debug.Assert(minSize >= 0, "size must be positive (got " + minSize + "): likely integer overflow?"); if (array.Length < minSize) @@ -537,7 +538,8 @@ namespace Lucene.Net.Util } } - public static int[][] Grow(int[][] array, int minSize) // LUCENENET TODO: CLS compliance issue + [CLSCompliant(false)] + public static int[][] Grow(int[][] array, int minSize) { Debug.Assert(minSize >= 0, "size must be positive (got " + minSize + "): likely integer overflow?"); if (array.Length < minSize) @@ -552,12 +554,14 @@ namespace Lucene.Net.Util } } - public static int[][] Grow(int[][] array) // LUCENENET TODO: CLS compliance issue + [CLSCompliant(false)] + public static int[][] Grow(int[][] array) { return Grow(array, 1 + array.Length); } - public static int[][] Shrink(int[][] array, int targetSize) // LUCENENET TODO: CLS compliance issue + [CLSCompliant(false)] + public static int[][] Shrink(int[][] array, int targetSize) { Debug.Assert(targetSize >= 0, "size must be positive (got " + targetSize + "): likely integer overflow?"); int newSize = GetShrinkSize(array.Length, targetSize, RamUsageEstimator.NUM_BYTES_OBJECT_REF); @@ -573,7 +577,8 @@ namespace Lucene.Net.Util } } - public static float[][] Grow(float[][] array, int minSize) // LUCENENET TODO: CLS compliance issue + [CLSCompliant(false)] + public static float[][] Grow(float[][] array, int minSize) { Debug.Assert(minSize >= 0, "size must be positive (got " + minSize + "): likely integer overflow?"); if (array.Length < minSize) @@ -588,12 +593,14 @@ namespace Lucene.Net.Util } } - public static float[][] Grow(float[][] array) // LUCENENET TODO: CLS compliance issue + [CLSCompliant(false)] + public static float[][] Grow(float[][] array) { return Grow(array, 1 + array.Length); } - public static float[][] Shrink(float[][] array, int targetSize) // LUCENENET TODO: CLS compliance issue + [CLSCompliant(false)] + public static float[][] Shrink(float[][] array, int targetSize) { Debug.Assert(targetSize >= 0, "size must be positive (got " + targetSize + "): likely integer overflow?"); int newSize = GetShrinkSize(array.Length, targetSize, RamUsageEstimator.NUM_BYTES_OBJECT_REF); @@ -627,7 +634,7 @@ namespace Lucene.Net.Util /// Returns hash of bytes in range start (inclusive) to /// end (inclusive) /// </summary> - public static int GetHashCode(sbyte[] array, int start, int end) // LUCENENET TODO: chnage to byte ? + public static int GetHashCode(byte[] array, int start, int end) { int code = 0; for (int i = end - 1; i >= start; i--)
