lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [45/45] lucenenet git commit: Removed unchecked from several places where it is not required.
Date Sun, 30 Apr 2017 21:56:24 GMT
Removed unchecked from several places where it is not required.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/159c33ba
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/159c33ba
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/159c33ba

Branch: refs/heads/master
Commit: 159c33ba2abbcfb9bf1882f672ba113ace9aa363
Parents: a6a209c
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon May 1 04:39:15 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon May 1 04:48:41 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs | 14 +++++++-------
 src/Lucene.Net/Codecs/Lucene40/BitVector.cs      |  4 ++--
 src/Lucene.Net/Index/DocTermOrds.cs              |  8 ++++----
 src/Lucene.Net/Index/TermsHashPerField.cs        |  2 +-
 src/Lucene.Net/Store/CompoundFileDirectory.cs    |  2 +-
 src/Lucene.Net/Util/BytesRefHash.cs              |  4 ++--
 src/Lucene.Net/Util/UnicodeUtil.cs               | 18 +++++++++---------
 7 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/159c33ba/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs
index a7a52a5..e34ddbe 100644
--- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs
+++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs
@@ -361,10 +361,10 @@ namespace Lucene.Net.Codecs.Lucene3x
                 scratch[1] = (sbyte)term.Bytes[pos + 1];
                 scratch[2] = (sbyte)term.Bytes[pos + 2];
 
-                term.Bytes[pos] = unchecked((byte)0xf0);
-                term.Bytes[pos + 1] = unchecked((byte)0x90);
-                term.Bytes[pos + 2] = unchecked((byte)0x80);
-                term.Bytes[pos + 3] = unchecked((byte)0x80);
+                term.Bytes[pos] = 0xf0;
+                term.Bytes[pos + 1] = 0x90;
+                term.Bytes[pos + 2] = 0x80;
+                term.Bytes[pos + 3] = 0x80;
                 term.Length = 4 + pos;
 
                 if (DEBUG_SURROGATES)
@@ -505,7 +505,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                 if (prevTerm.Length > newSuffixStart && IsNonBMPChar(prevTerm.Bytes,
newSuffixStart) && IsHighBMPChar(scratchTerm.Bytes, newSuffixStart))
                 {
                     // Seek type 2 -- put 0xFF at this position:
-                    scratchTerm.Bytes[newSuffixStart] = unchecked((byte)0xff);
+                    scratchTerm.Bytes[newSuffixStart] = 0xff;
                     scratchTerm.Length = newSuffixStart + 1;
 
                     if (DEBUG_SURROGATES)
@@ -692,8 +692,8 @@ namespace Lucene.Net.Codecs.Lucene3x
                         scratch[2] = (sbyte)scratchTerm.Bytes[upTo + 2];
 
                         scratchTerm.Bytes[upTo] = (byte)UTF8_HIGH_BMP_LEAD;
-                        scratchTerm.Bytes[upTo + 1] = unchecked((byte)0x80);
-                        scratchTerm.Bytes[upTo + 2] = unchecked((byte)0x80);
+                        scratchTerm.Bytes[upTo + 1] = 0x80;
+                        scratchTerm.Bytes[upTo + 2] = 0x80;
                         scratchTerm.Length = upTo + 3;
 
                         if (DEBUG_SURROGATES)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/159c33ba/src/Lucene.Net/Codecs/Lucene40/BitVector.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Lucene40/BitVector.cs b/src/Lucene.Net/Codecs/Lucene40/BitVector.cs
index 640b453..57a7e14 100644
--- a/src/Lucene.Net/Codecs/Lucene40/BitVector.cs
+++ b/src/Lucene.Net/Codecs/Lucene40/BitVector.cs
@@ -325,7 +325,7 @@ namespace Lucene.Net.Codecs.Lucene40
         /// Set all bits </summary>
         public void SetAll()
         {
-            Arrays.Fill(bits, unchecked((byte)0xff));
+            Arrays.Fill(bits, (byte)0xff);
             ClearUnusedBits();
             count = size;
         }
@@ -350,7 +350,7 @@ namespace Lucene.Net.Codecs.Lucene40
             int numCleared = Length - Count();
             for (int i = 0; i < bits.Length && numCleared > 0; i++)
             {
-                if (bits[i] != unchecked((byte)0xff))
+                if (bits[i] != 0xff)
                 {
                     output.WriteVInt32(i - last);
                     output.WriteByte(bits[i]);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/159c33ba/src/Lucene.Net/Index/DocTermOrds.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Index/DocTermOrds.cs b/src/Lucene.Net/Index/DocTermOrds.cs
index c9a1930..1805499 100644
--- a/src/Lucene.Net/Index/DocTermOrds.cs
+++ b/src/Lucene.Net/Index/DocTermOrds.cs
@@ -714,22 +714,22 @@ namespace Lucene.Net.Index
             var a = ((int)((uint)x >> (7 * 4)));
             if (a != 0)
             {
-                arr[pos++] = unchecked((sbyte)(a | 0x80));
+                arr[pos++] = (sbyte)(a | 0x80);
             }
             a = ((int)((uint)x >> (7 * 3)));
             if (a != 0)
             {
-                arr[pos++] = unchecked((sbyte)(a | 0x80));
+                arr[pos++] = (sbyte)(a | 0x80);
             }
             a = ((int)((uint)x >> (7 * 2)));
             if (a != 0)
             {
-                arr[pos++] = unchecked((sbyte)(a | 0x80));
+                arr[pos++] = (sbyte)(a | 0x80);
             }
             a = ((int)((uint)x >> (7 * 1)));
             if (a != 0)
             {
-                arr[pos++] = unchecked((sbyte)(a | 0x80));
+                arr[pos++] = (sbyte)(a | 0x80);
             }
             arr[pos++] = (sbyte)(x & 0x7f);
             return pos;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/159c33ba/src/Lucene.Net/Index/TermsHashPerField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Index/TermsHashPerField.cs b/src/Lucene.Net/Index/TermsHashPerField.cs
index 65fd5f5..77aa688 100644
--- a/src/Lucene.Net/Index/TermsHashPerField.cs
+++ b/src/Lucene.Net/Index/TermsHashPerField.cs
@@ -321,7 +321,7 @@ namespace Lucene.Net.Index
             Debug.Assert(stream < streamCount);
             while ((i & ~0x7F) != 0)
             {
-                WriteByte(stream, unchecked((sbyte)((i & 0x7f) | 0x80)));
+                WriteByte(stream, (sbyte)((i & 0x7f) | 0x80));
                 i = (int)((uint)i >> 7);
             }
             WriteByte(stream, (sbyte)i);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/159c33ba/src/Lucene.Net/Store/CompoundFileDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Store/CompoundFileDirectory.cs b/src/Lucene.Net/Store/CompoundFileDirectory.cs
index 8527b28..29ce68e 100644
--- a/src/Lucene.Net/Store/CompoundFileDirectory.cs
+++ b/src/Lucene.Net/Store/CompoundFileDirectory.cs
@@ -131,7 +131,7 @@ namespace Lucene.Net.Store
         private static readonly sbyte CODEC_MAGIC_BYTE1 = (sbyte)Number.URShift(CodecUtil.CODEC_MAGIC,
24);
         private static readonly sbyte CODEC_MAGIC_BYTE2 = (sbyte)Number.URShift(CodecUtil.CODEC_MAGIC,
16);
         private static readonly sbyte CODEC_MAGIC_BYTE3 = (sbyte)Number.URShift(CodecUtil.CODEC_MAGIC,
8);
-        private static readonly sbyte CODEC_MAGIC_BYTE4 = unchecked((sbyte)CodecUtil.CODEC_MAGIC);
+        private static readonly sbyte CODEC_MAGIC_BYTE4 = (sbyte)CodecUtil.CODEC_MAGIC;
 
         /// <summary>
         /// Helper method that reads CFS entries from an input stream </summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/159c33ba/src/Lucene.Net/Util/BytesRefHash.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Util/BytesRefHash.cs b/src/Lucene.Net/Util/BytesRefHash.cs
index 20d2250..6c8a839 100644
--- a/src/Lucene.Net/Util/BytesRefHash.cs
+++ b/src/Lucene.Net/Util/BytesRefHash.cs
@@ -347,8 +347,8 @@ namespace Lucene.Net.Util
                 else
                 {
                     // 2 byte to store length
-                    buffer[bufferUpto] = unchecked((byte)(0x80 | (length & 0x7f)));
-                    buffer[bufferUpto + 1] = unchecked((byte)((length >> 7) & 0xff));
+                    buffer[bufferUpto] = (byte)(0x80 | (length & 0x7f));
+                    buffer[bufferUpto + 1] = (byte)((length >> 7) & 0xff);
                     pool.ByteUpto += length + 2;
                     System.Buffer.BlockCopy(bytes.Bytes, bytes.Offset, buffer, bufferUpto
+ 2, length);
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/159c33ba/src/Lucene.Net/Util/UnicodeUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Util/UnicodeUtil.cs b/src/Lucene.Net/Util/UnicodeUtil.cs
index 1ee21c6..d4ee04d 100644
--- a/src/Lucene.Net/Util/UnicodeUtil.cs
+++ b/src/Lucene.Net/Util/UnicodeUtil.cs
@@ -181,9 +181,9 @@ namespace Lucene.Net.Util
                     }
                     // replace unpaired surrogate or out-of-order low surrogate
                     // with substitution character
-                    @out[upto++] = unchecked((byte)0xEF);
-                    @out[upto++] = unchecked((byte)0xBF);
-                    @out[upto++] = unchecked((byte)0xBD);
+                    @out[upto++] = 0xEF;
+                    @out[upto++] = 0xBF;
+                    @out[upto++] = 0xBD;
                 }
             }
             //assert matches(source, offset, length, out, upto);
@@ -248,9 +248,9 @@ namespace Lucene.Net.Util
                     }
                     // replace unpaired surrogate or out-of-order low surrogate
                     // with substitution character
-                    @out[upto++] = unchecked((byte)0xEF);
-                    @out[upto++] = unchecked((byte)0xBF);
-                    @out[upto++] = unchecked((byte)0xBD);
+                    @out[upto++] = 0xEF;
+                    @out[upto++] = 0xBF;
+                    @out[upto++] = 0xBD;
                 }
             }
             //assert matches(s, offset, length, out, upto);
@@ -316,9 +316,9 @@ namespace Lucene.Net.Util
                     }
                     // replace unpaired surrogate or out-of-order low surrogate
                     // with substitution character
-                    @out[upto++] = unchecked((byte)0xEF);
-                    @out[upto++] = unchecked((byte)0xBF);
-                    @out[upto++] = unchecked((byte)0xBD);
+                    @out[upto++] = 0xEF;
+                    @out[upto++] = 0xBF;
+                    @out[upto++] = 0xBD;
                 }
             }
             //assert matches(s, offset, length, out, upto);


Mime
View raw message