lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [2/2] lucenenet git commit: More sbyte->byte conversion remnants
Date Fri, 02 Jan 2015 12:25:11 GMT
More sbyte->byte conversion remnants


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

Branch: refs/heads/master
Commit: ab8a94364685ee62caad14eeb0a7f347c0d891b5
Parents: b890707
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Fri Jan 2 14:02:43 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Fri Jan 2 14:02:43 2015 +0200

----------------------------------------------------------------------
 .../Codecs/BlockTreeTermsWriter.cs              |  2 +-
 .../Compressing/CompressingTermVectorsWriter.cs |  2 +-
 src/Lucene.Net.Core/Codecs/Compressing/LZ4.cs   | 10 ++---
 .../Lucene40/Lucene40SegmentInfoWriter.cs       |  2 +-
 .../Lucene40/Lucene40StoredFieldsWriter.cs      |  2 +-
 .../Lucene40/Lucene40TermVectorsWriter.cs       |  2 +-
 src/Lucene.Net.Core/Codecs/Lucene41/ForUtil.cs  |  8 ++--
 .../Codecs/Lucene42/Lucene42NormsConsumer.cs    | 20 +++++-----
 .../Lucene45/Lucene45DocValuesConsumer.cs       | 27 +++++--------
 .../Codecs/Lucene46/Lucene46FieldInfosWriter.cs | 10 ++---
 .../Lucene46/Lucene46SegmentInfoWriter.cs       |  2 +-
 src/Lucene.Net.Core/Index/SegmentInfos.cs       |  2 +-
 src/Lucene.Net.Core/Store/DataOutput.cs         | 40 +++++---------------
 src/Lucene.Net.Core/Util/Fst/FST.cs             | 30 +++++++--------
 src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs   | 16 ++++----
 .../Util/Packed/AbstractBlockPackedWriter.cs    |  4 +-
 .../Util/Packed/BlockPackedWriter.cs            |  2 +-
 .../Util/Packed/PackedDataOutput.cs             |  4 +-
 src/Lucene.Net.Core/Util/WAH8DocIdSet.cs        | 10 ++---
 .../lucene3x/PreFlexRWFieldInfosWriter.cs       |  4 +-
 .../Codecs/lucene3x/PreFlexRWNormsConsumer.cs   |  8 +++-
 .../lucene3x/PreFlexRWStoredFieldsWriter.cs     |  2 +-
 .../lucene3x/PreFlexRWTermVectorsWriter.cs      |  2 +-
 .../Codecs/lucene40/Lucene40DocValuesWriter.cs  | 10 ++---
 .../Codecs/lucene40/Lucene40FieldInfosWriter.cs |  6 +--
 .../lucene42/Lucene42DocValuesConsumer.cs       | 16 ++++----
 .../Codecs/lucene42/Lucene42FieldInfosWriter.cs | 10 ++---
 .../Index/MockIndexInput.cs                     |  6 +--
 .../Store/MockDirectoryWrapper.cs               |  4 +-
 .../core/Index/TestCompoundFile.cs              | 14 +++----
 .../core/Index/TestIndexInput.cs                |  4 +-
 .../core/Index/TestIndexWriter.cs               |  6 +--
 .../core/Index/TestIndexWriterExceptions.cs     |  2 +-
 .../core/Store/TestDirectory.cs                 |  2 +-
 .../core/Store/TestFileSwitchDirectory.cs       |  2 +-
 .../core/Store/TestHugeRamFile.cs               | 10 ++---
 .../core/Store/TestMockDirectoryWrapper.cs      |  2 +-
 .../core/Store/TestNRTCachingDirectory.cs       |  2 +-
 .../core/Store/TestRAMDirectory.cs              |  2 +-
 .../core/Util/TestPagedBytes.cs                 |  8 ++--
 40 files changed, 147 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs b/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
index f70fa8b..e339aa3 100644
--- a/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/BlockTreeTermsWriter.cs
@@ -445,7 +445,7 @@ namespace Lucene.Net.Codecs
                         //if (DEBUG) {
                         //  System.out.println("    write floorLeadByte=" + Integer.toHexString(sub.floorLeadByte&0xff));
                         //}
-                        scratchBytes.WriteByte((sbyte)sub.FloorLeadByte);
+                        scratchBytes.WriteByte((byte)(sbyte)sub.FloorLeadByte);
                         Debug.Assert(sub.Fp > Fp);
                         scratchBytes.WriteVLong((sub.Fp - Fp) << 1 | (sub.HasTerms ? 1 : 0));
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs b/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs
index 9fccb35..230e5e7 100644
--- a/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs
@@ -458,7 +458,7 @@ namespace Lucene.Net.Codecs.Compressing
             Debug.Assert(numDistinctFields > 0);
             int bitsRequired = PackedInts.BitsRequired(fieldNums.Last());
             int token = (Math.Min(numDistinctFields - 1, 0x07) << 5) | bitsRequired;
-            VectorsStream.WriteByte((sbyte)token);
+            VectorsStream.WriteByte((byte)(sbyte)token);
             if (numDistinctFields - 1 >= 0x07)
             {
                 VectorsStream.WriteVInt(numDistinctFields - 1 - 0x07);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Compressing/LZ4.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Compressing/LZ4.cs b/src/Lucene.Net.Core/Codecs/Compressing/LZ4.cs
index e473f45..612d5c8 100644
--- a/src/Lucene.Net.Core/Codecs/Compressing/LZ4.cs
+++ b/src/Lucene.Net.Core/Codecs/Compressing/LZ4.cs
@@ -167,15 +167,15 @@ namespace Lucene.Net.Codecs.Compressing
         {
             while (l >= 0xFF)
             {
-                @out.WriteByte(unchecked((sbyte)0xFF));
+                @out.WriteByte(unchecked((byte)(sbyte)0xFF));
                 l -= 0xFF;
             }
-            @out.WriteByte((sbyte)l);
+            @out.WriteByte((byte)(sbyte)l);
         }
 
         private static void EncodeLiterals(byte[] bytes, int token, int anchor, int literalLen, DataOutput @out)
         {
-            @out.WriteByte((sbyte)token);
+            @out.WriteByte((byte)(sbyte)token);
 
             // encode literal length
             if (literalLen >= 0x0F)
@@ -204,8 +204,8 @@ namespace Lucene.Net.Codecs.Compressing
             // encode match dec
             int matchDec = matchOff - matchRef;
             Debug.Assert(matchDec > 0 && matchDec < 1 << 16);
-            @out.WriteByte((sbyte)matchDec);
-            @out.WriteByte((sbyte)((int)((uint)matchDec >> 8)));
+            @out.WriteByte((byte)(sbyte)matchDec);
+            @out.WriteByte((byte)(sbyte)((int)((uint)matchDec >> 8)));
 
             // encode match len
             if (matchLen >= MIN_MATCH + 0x0F)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs
index f8167b9..d2fd1af 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40SegmentInfoWriter.cs
@@ -60,7 +60,7 @@ namespace Lucene.Net.Codecs.Lucene40
                 output.WriteString(si.Version);
                 output.WriteInt(si.DocCount);
 
-                output.WriteByte((sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
+                output.WriteByte((byte)(sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
                 output.WriteStringStringMap(si.Diagnostics);
                 output.WriteStringStringMap(CollectionsHelper.EmptyMap<string, string>());
                 output.WriteStringSet(si.Files);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs
index 1a76a6f..0a548d7 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40StoredFieldsWriter.cs
@@ -204,7 +204,7 @@ namespace Lucene.Net.Codecs.Lucene40
                 }
             }
 
-            FieldsStream.WriteByte((sbyte)bits);
+            FieldsStream.WriteByte((byte)(sbyte)bits);
 
             if (bytes != null)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsWriter.cs
index bc5dea0..7a72693 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsWriter.cs
@@ -131,7 +131,7 @@ namespace Lucene.Net.Codecs.Lucene40
             {
                 bits |= Lucene40TermVectorsReader.STORE_PAYLOAD_WITH_TERMVECTOR;
             }
-            Tvf.WriteByte(bits);
+            Tvf.WriteByte((byte)bits);
         }
 
         public override void FinishDocument()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Lucene41/ForUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene41/ForUtil.cs b/src/Lucene.Net.Core/Codecs/Lucene41/ForUtil.cs
index c64cff9..33b6b2c 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene41/ForUtil.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene41/ForUtil.cs
@@ -145,9 +145,9 @@ namespace Lucene.Net.Codecs.Lucene41
 
             for (int bpv = 1; bpv <= 32; ++bpv)
             {
-                int code = @in.ReadVInt();
-                int formatId = (int)((uint)code >> 5);
-                int bitsPerValue = (code & 31) + 1;
+                var code = @in.ReadVInt();
+                var formatId = (int)((uint)code >> 5);
+                var bitsPerValue = (code & 31) + 1;
 
                 PackedInts.Format format = PackedInts.Format.ById(formatId);
                 Debug.Assert(format.IsSupported(bitsPerValue));
@@ -169,7 +169,7 @@ namespace Lucene.Net.Codecs.Lucene41
         {
             if (IsAllEqual(data))
             {
-                @out.WriteByte((sbyte)ALL_VALUES_EQUAL);
+                @out.WriteByte((byte)(sbyte)ALL_VALUES_EQUAL);
                 @out.WriteVInt(data[0]);
                 return;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42NormsConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42NormsConsumer.cs b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42NormsConsumer.cs
index 52d52a6..cccf94f 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42NormsConsumer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42NormsConsumer.cs
@@ -79,7 +79,7 @@ namespace Lucene.Net.Codecs.Lucene42
         public override void AddNumericField(FieldInfo field, IEnumerable<long> values)
         {
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(NUMBER);
+            Meta.WriteByte((byte)NUMBER);
             Meta.WriteLong(Data.FilePointer);
             long minValue = long.MaxValue;
             long maxValue = long.MinValue;
@@ -137,18 +137,18 @@ namespace Lucene.Net.Codecs.Lucene42
                 FormatAndBits formatAndBits = PackedInts.FastestFormatAndBits(MaxDoc, bitsPerValue, AcceptableOverheadRatio);
                 if (formatAndBits.bitsPerValue == 8 && minValue >= sbyte.MinValue && maxValue <= sbyte.MaxValue)
                 {
-                    Meta.WriteByte(UNCOMPRESSED); // uncompressed
+                    Meta.WriteByte((byte)UNCOMPRESSED); // uncompressed
                     foreach (long nv in values)
                     {
-                        Data.WriteByte((sbyte)nv);
+                        Data.WriteByte((byte)(sbyte)nv);
                     }
                 }
                 else
                 {
-                    Meta.WriteByte(TABLE_COMPRESSED); // table-compressed
+                    Meta.WriteByte((byte)TABLE_COMPRESSED); // table-compressed
                     //LUCENE TO-DO, ToArray had a parameter to start
-                    long[] decode = uniqueValues.ToArray();
-                    Dictionary<long, int> encode = new Dictionary<long, int>();
+                    var decode = uniqueValues.ToArray();
+                    var encode = new Dictionary<long, int>();
                     Data.WriteVInt(decode.Length);
                     for (int i = 0; i < decode.Length; i++)
                     {
@@ -170,13 +170,13 @@ namespace Lucene.Net.Codecs.Lucene42
             }
             else if (gcd != 0 && gcd != 1)
             {
-                Meta.WriteByte(GCD_COMPRESSED);
+                Meta.WriteByte((byte)GCD_COMPRESSED);
                 Meta.WriteVInt(PackedInts.VERSION_CURRENT);
                 Data.WriteLong(minValue);
                 Data.WriteLong(gcd);
                 Data.WriteVInt(BLOCK_SIZE);
 
-                BlockPackedWriter writer = new BlockPackedWriter(Data, BLOCK_SIZE);
+                var writer = new BlockPackedWriter(Data, BLOCK_SIZE);
                 foreach (long nv in values)
                 {
                     long value = nv;
@@ -186,12 +186,12 @@ namespace Lucene.Net.Codecs.Lucene42
             }
             else
             {
-                Meta.WriteByte(DELTA_COMPRESSED); // delta-compressed
+                Meta.WriteByte((byte)DELTA_COMPRESSED); // delta-compressed
 
                 Meta.WriteVInt(PackedInts.VERSION_CURRENT);
                 Data.WriteVInt(BLOCK_SIZE);
 
-                BlockPackedWriter writer = new BlockPackedWriter(Data, BLOCK_SIZE);
+                var writer = new BlockPackedWriter(Data, BLOCK_SIZE);
                 foreach (long nv in values)
                 {
                     writer.Add(nv);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs b/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs
index 2be57cc..510297a 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs
@@ -196,7 +196,7 @@ namespace Lucene.Net.Codecs.Lucene45
                 format = DELTA_COMPRESSED;
             }
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(Lucene45DocValuesFormat.NUMERIC);
+            Meta.WriteByte((byte)Lucene45DocValuesFormat.NUMERIC);
             Meta.WriteVInt(format);
             if (missing)
             {
@@ -269,7 +269,7 @@ namespace Lucene.Net.Codecs.Lucene45
             {
                 if (count == 8)
                 {
-                    Data.WriteByte(bits);
+                    Data.WriteByte((byte)bits);
                     count = 0;
                     bits = 0;
                 }
@@ -281,7 +281,7 @@ namespace Lucene.Net.Codecs.Lucene45
             }
             if (count > 0)
             {
-                Data.WriteByte(bits);
+                Data.WriteByte((byte)bits);
             }
         }
 
@@ -289,7 +289,7 @@ namespace Lucene.Net.Codecs.Lucene45
         {
             // write the byte[] data
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(Lucene45DocValuesFormat.BINARY);
+            Meta.WriteByte((byte)Lucene45DocValuesFormat.BINARY);
             int minLength = int.MaxValue;
             int maxLength = int.MinValue;
             long startFP = Data.FilePointer;
@@ -374,7 +374,7 @@ namespace Lucene.Net.Codecs.Lucene45
             {
                 // header
                 Meta.WriteVInt(field.Number);
-                Meta.WriteByte(Lucene45DocValuesFormat.BINARY);
+                Meta.WriteByte((byte)Lucene45DocValuesFormat.BINARY);
                 Meta.WriteVInt(BINARY_PREFIX_COMPRESSED);
                 Meta.WriteLong(-1L);
                 // now write the bytes: sharing prefixes within a block
@@ -422,27 +422,20 @@ namespace Lucene.Net.Codecs.Lucene45
         public override void AddSortedField(FieldInfo field, IEnumerable<BytesRef> values, IEnumerable<long> docToOrd)
         {
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(Lucene45DocValuesFormat.SORTED);
+            Meta.WriteByte((byte)Lucene45DocValuesFormat.SORTED);
             AddTermsDict(field, values);
             AddNumericField(field, docToOrd, false);
         }
 
         private static bool IsSingleValued(IEnumerable<long> docToOrdCount)
         {
-            foreach (long ordCount in docToOrdCount)
-            {
-                if (ordCount > 1)
-                {
-                    return false;
-                }
-            }
-            return true;
+            return docToOrdCount.All(ordCount => ordCount <= 1);
         }
 
         public override void AddSortedSetField(FieldInfo field, IEnumerable<BytesRef> values, IEnumerable<long> docToOrdCount, IEnumerable<long> ords)
         {
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(Lucene45DocValuesFormat.SORTED_SET);
+            Meta.WriteByte((byte)Lucene45DocValuesFormat.SORTED_SET);
 
             if (IsSingleValued(docToOrdCount))
             {
@@ -463,7 +456,7 @@ namespace Lucene.Net.Codecs.Lucene45
 
             // write the doc -> ord count as a absolute index to the stream
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(Lucene45DocValuesFormat.NUMERIC);
+            Meta.WriteByte((byte)Lucene45DocValuesFormat.NUMERIC);
             Meta.WriteVInt(DELTA_COMPRESSED);
             Meta.WriteLong(-1L);
             Meta.WriteVInt(PackedInts.VERSION_CURRENT);
@@ -471,7 +464,7 @@ namespace Lucene.Net.Codecs.Lucene45
             Meta.WriteVLong(MaxDoc);
             Meta.WriteVInt(BLOCK_SIZE);
 
-            MonotonicBlockPackedWriter writer = new MonotonicBlockPackedWriter(Data, BLOCK_SIZE);
+            var writer = new MonotonicBlockPackedWriter(Data, BLOCK_SIZE);
             long addr = 0;
             foreach (int v in docToOrdCount)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
index 400c079..abda561 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
@@ -87,14 +87,14 @@ namespace Lucene.Net.Codecs.Lucene46
                     }
                     output.WriteString(fi.Name);
                     output.WriteVInt(fi.Number);
-                    output.WriteByte(bits);
+                    output.WriteByte((byte)bits);
 
                     // pack the DV types in one byte
-                    sbyte dv = DocValuesByte(fi.DocValuesType);
-                    sbyte nrm = DocValuesByte(fi.NormType);
+                    var dv = DocValuesByte(fi.DocValuesType);
+                    var nrm = DocValuesByte(fi.NormType);
                     Debug.Assert((dv & (~0xF)) == 0 && (nrm & (~0x0F)) == 0);
-                    sbyte val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
-                    output.WriteByte(val);
+                    var val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
+                    output.WriteByte((byte)val);
                     output.WriteLong(fi.DocValuesGen);
                     output.WriteStringStringMap(fi.Attributes());
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
index 8803384..7c305a4 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Codecs.Lucene46
                 output.WriteString(si.Version);
                 output.WriteInt(si.DocCount);
 
-                output.WriteByte((sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
+                output.WriteByte((byte)(sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
                 output.WriteStringStringMap(si.Diagnostics);
                 output.WriteStringSet(si.Files);
                 CodecUtil.WriteFooter(output);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Index/SegmentInfos.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentInfos.cs b/src/Lucene.Net.Core/Index/SegmentInfos.cs
index 06184e7..0b0fcb6 100644
--- a/src/Lucene.Net.Core/Index/SegmentInfos.cs
+++ b/src/Lucene.Net.Core/Index/SegmentInfos.cs
@@ -671,7 +671,7 @@ namespace Lucene.Net.Index
 
                 output.WriteStringStringMap(si.Attributes());
 
-                output.WriteByte((sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
+                output.WriteByte((byte)(sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
                 output.WriteStringStringMap(si.Diagnostics);
                 output.WriteStringSet(si.Files);
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Store/DataOutput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/DataOutput.cs b/src/Lucene.Net.Core/Store/DataOutput.cs
index 675b7be..a74f994 100644
--- a/src/Lucene.Net.Core/Store/DataOutput.cs
+++ b/src/Lucene.Net.Core/Store/DataOutput.cs
@@ -44,26 +44,6 @@ namespace Lucene.Net.Store
         /// <seealso cref= IndexInput#readByte() </seealso>
         public abstract void WriteByte(byte b);
 
-        public void WriteByte(sbyte b)
-        {
-            WriteByte((byte)b);
-        }
-
-        /// <summary>
-        /// Writes an array of bytes. </summary>
-        /// <param name="b"> the bytes to write </param>
-        /// <param name="length"> the number of bytes to write </param>
-        /// <seealso cref= DataInput#readBytes(byte[],int,int) </seealso>
-        public void WriteBytes(sbyte[] b, int length)
-        {
-            WriteBytes(b, 0, length);
-        }
-
-        public void WriteBytes(sbyte[] b, int offset, int length)
-        {
-            WriteBytes((byte[])(Array)b, offset, length);
-        }
-
         public void WriteBytes(byte[] b, int length)
         {
             WriteBytes(b, 0, length);
@@ -85,10 +65,10 @@ namespace Lucene.Net.Store
         /// <seealso cref= DataInput#readInt() </seealso>
         public virtual void WriteInt(int i)
         {
-            WriteByte((sbyte)(i >> 24));
-            WriteByte((sbyte)(i >> 16));
-            WriteByte((sbyte)(i >> 8));
-            WriteByte((sbyte)i);
+            WriteByte((byte)(sbyte)(i >> 24));
+            WriteByte((byte)(sbyte)(i >> 16));
+            WriteByte((byte)(sbyte)(i >> 8));
+            WriteByte((byte)(sbyte)i);
         }
 
         /// <summary>
@@ -96,8 +76,8 @@ namespace Lucene.Net.Store
         /// <seealso cref= DataInput#readShort() </seealso>
         public virtual void WriteShort(short i)
         {
-            WriteByte((sbyte)(i >> 8));
-            WriteByte((sbyte)i);
+            WriteByte((byte)(sbyte)(i >> 8));
+            WriteByte((byte)(sbyte)i);
         }
 
         /// <summary>
@@ -210,10 +190,10 @@ namespace Lucene.Net.Store
         {
             while ((i & ~0x7F) != 0)
             {
-                WriteByte(unchecked((sbyte)((i & 0x7F) | 0x80)));
+                WriteByte((byte)unchecked((sbyte)((i & 0x7F) | 0x80)));
                 i = (int)((uint)i >> 7);
             }
-            WriteByte((sbyte)i);
+            WriteByte((byte)(sbyte)i);
         }
 
         /// <summary>
@@ -240,10 +220,10 @@ namespace Lucene.Net.Store
             Debug.Assert(i >= 0L);
             while ((i & ~0x7FL) != 0L)
             {
-                WriteByte(unchecked((sbyte)((i & 0x7FL) | 0x80L)));
+                WriteByte((byte)unchecked((sbyte)((i & 0x7FL) | 0x80L)));
                 i = (long)((ulong)i >> 7);
             }
-            WriteByte((sbyte)i);
+            WriteByte((byte)(sbyte)i);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Util/Fst/FST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/FST.cs b/src/Lucene.Net.Core/Util/Fst/FST.cs
index 06a0446..17ec300 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -196,7 +196,7 @@ namespace Lucene.Net.Util.Fst
             Bytes = new BytesStore(bytesPageBits);
             // pad: ensure no node gets address 0 which is reserved to mean
             // the stop state w/ no arcs
-            Bytes.WriteByte((sbyte)0);
+            Bytes.WriteByte(0);
             NO_OUTPUT = outputs.NoOutput;
             if (willPackFST)
             {
@@ -490,21 +490,21 @@ namespace Lucene.Net.Util.Fst
             CodecUtil.WriteHeader(@out, FILE_FORMAT_NAME, VERSION_CURRENT);
             if (Packed)
             {
-                @out.WriteByte((sbyte)1);
+                @out.WriteByte(1);
             }
             else
             {
-                @out.WriteByte((sbyte)0);
+                @out.WriteByte(0);
             }
             // TODO: really we should encode this as an arc, arriving
             // to the root node, instead of special casing here:
             if (emptyOutput != null)
             {
                 // Accepts empty string
-                @out.WriteByte((sbyte)1);
+                @out.WriteByte(1);
 
                 // Serialize empty-string output:
-                RAMOutputStream ros = new RAMOutputStream();
+                var ros = new RAMOutputStream();
                 Outputs.WriteFinalOutput(emptyOutput, ros);
 
                 var emptyOutputBytes = new byte[(int)ros.FilePointer];
@@ -528,7 +528,7 @@ namespace Lucene.Net.Util.Fst
             }
             else
             {
-                @out.WriteByte((sbyte)0);
+                @out.WriteByte(0);
             }
             sbyte t;
             if (inputType == INPUT_TYPE.BYTE1)
@@ -543,7 +543,7 @@ namespace Lucene.Net.Util.Fst
             {
                 t = 2;
             }
-            @out.WriteByte(t);
+            @out.WriteByte((byte)t);
             if (Packed)
             {
                 ((PackedInts.Mutable)NodeRefToAddress).Save(@out);
@@ -614,7 +614,7 @@ namespace Lucene.Net.Util.Fst
             if (inputType == INPUT_TYPE.BYTE1)
             {
                 Debug.Assert(v <= 255, "v=" + v);
-                @out.WriteByte((sbyte)v);
+                @out.WriteByte((byte)(sbyte)v);
             }
             else if (inputType == INPUT_TYPE.BYTE2)
             {
@@ -741,7 +741,7 @@ namespace Lucene.Net.Util.Fst
                     flags += BIT_ARC_HAS_OUTPUT;
                 }
 
-                Bytes.WriteByte((sbyte)flags);
+                Bytes.WriteByte((byte)(sbyte)flags);
                 WriteLabel(Bytes, arc.Label);
 
                 // System.out.println("  write arc: label=" + (char) arc.Label + " flags=" + flags + " target=" + target.Node + " pos=" + bytes.getPosition() + " output=" + outputs.outputToString(arc.Output));
@@ -809,9 +809,9 @@ namespace Lucene.Net.Util.Fst
                 // create the header
                 // TODO: clean this up: or just rewind+reuse and deal with it
                 byte[] header = new byte[MAX_HEADER_SIZE];
-                ByteArrayDataOutput bad = new ByteArrayDataOutput(header);
+                var bad = new ByteArrayDataOutput(header);
                 // write a "false" first arc:
-                bad.WriteByte(ARCS_AS_FIXED_ARRAY);
+                bad.WriteByte((byte)ARCS_AS_FIXED_ARRAY);
                 bad.WriteVInt(nodeIn.NumArcs);
                 bad.WriteVInt(maxBytesPerArc);
                 int headerLen = bad.Position;
@@ -1786,7 +1786,7 @@ namespace Lucene.Net.Util.Fst
                 BytesStore writer = fst.Bytes;
 
                 // Skip 0 byte since 0 is reserved target:
-                writer.WriteByte((sbyte)0);
+                writer.WriteByte(0);
 
                 fst.arcWithOutputCount = 0;
                 fst.nodeCount = 0;
@@ -1841,7 +1841,7 @@ namespace Lucene.Net.Util.Fst
                             {
                                 bytesPerArc = arc.BytesPerArc;
                             }
-                            writer.WriteByte(ARCS_AS_FIXED_ARRAY);
+                            writer.WriteByte((byte)ARCS_AS_FIXED_ARRAY);
                             writer.WriteVInt(arc.NumArcs);
                             writer.WriteVInt(bytesPerArc);
                             //System.out.println("node " + node + ": " + arc.numArcs + " arcs");
@@ -1921,7 +1921,7 @@ namespace Lucene.Net.Util.Fst
 
                                 if (delta < absPtr)
                                 {
-                                    flags |= (sbyte)BIT_TARGET_DELTA;
+                                    flags |= BIT_TARGET_DELTA;
                                 }
                             }
                             else
@@ -1930,7 +1930,7 @@ namespace Lucene.Net.Util.Fst
                             }
 
                             Debug.Assert(flags != ARCS_AS_FIXED_ARRAY);
-                            writer.WriteByte(flags);
+                            writer.WriteByte((byte)(sbyte)flags);
 
                             fst.WriteLabel(writer, arc.Label);
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs b/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs
index e385989..9c8706a 100644
--- a/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs
+++ b/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs
@@ -240,15 +240,15 @@ namespace Lucene.Net.Util
                 if (NumExceptions > 0)
                 {
                     Debug.Assert(BitsPerException > 0);
-                    Data.WriteByte((sbyte)NumExceptions);
-                    Data.WriteByte((sbyte)BitsPerException);
+                    Data.WriteByte((byte)(sbyte)NumExceptions);
+                    Data.WriteByte((byte)(sbyte)BitsPerException);
                     PackedInts.Encoder encoder = PackedInts.GetEncoder(PackedInts.Format.PACKED, PackedInts.VERSION_CURRENT, BitsPerException);
                     int numIterations = (NumExceptions + encoder.ByteValueCount() - 1) / encoder.ByteValueCount();
                     encoder.Encode(Exceptions, 0, Data.Bytes, Data.Length, numIterations);
                     Data.Length += (int)PackedInts.Format.PACKED.ByteCount(PackedInts.VERSION_CURRENT, NumExceptions, BitsPerException);
                     for (int i = 0; i < NumExceptions; ++i)
                     {
-                        Data.WriteByte((sbyte)ExceptionIndices[i]);
+                        Data.WriteByte((byte)(sbyte)ExceptionIndices[i]);
                     }
                 }
             }
@@ -261,7 +261,7 @@ namespace Lucene.Net.Util
                     doc += 1 + Buffer[i];
                     while (doc >= 8)
                     {
-                        Data.WriteByte((sbyte)current);
+                        Data.WriteByte((byte)(sbyte)current);
                         current = 0;
                         doc -= 8;
                     }
@@ -269,7 +269,7 @@ namespace Lucene.Net.Util
                 }
                 if (current != 0)
                 {
-                    Data.WriteByte((sbyte)current);
+                    Data.WriteByte((byte)(sbyte)current);
                 }
             }
 
@@ -291,7 +291,7 @@ namespace Lucene.Net.Util
                     {
                         token |= HAS_EXCEPTIONS;
                     }
-                    Data.WriteByte((sbyte)token);
+                    Data.WriteByte((byte)(sbyte)token);
                     PforEncode();
                 }
                 else
@@ -299,13 +299,13 @@ namespace Lucene.Net.Util
                     // use unary
                     blockSize = unaryBlockSize;
                     int token = UNARY | (BufferSize < BLOCK_SIZE ? LAST_BLOCK : 0);
-                    Data.WriteByte((sbyte)token);
+                    Data.WriteByte((byte)(sbyte)token);
                     UnaryEncode();
                 }
 
                 if (BufferSize < BLOCK_SIZE)
                 {
-                    Data.WriteByte((sbyte)BufferSize);
+                    Data.WriteByte((byte)(sbyte)BufferSize);
                 }
 
                 ++NumBlocks;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Util/Packed/AbstractBlockPackedWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Packed/AbstractBlockPackedWriter.cs b/src/Lucene.Net.Core/Util/Packed/AbstractBlockPackedWriter.cs
index 1868b79..bea2231 100644
--- a/src/Lucene.Net.Core/Util/Packed/AbstractBlockPackedWriter.cs
+++ b/src/Lucene.Net.Core/Util/Packed/AbstractBlockPackedWriter.cs
@@ -42,10 +42,10 @@ namespace Lucene.Net.Util.Packed
             int k = 0;
             while ((i & ~0x7FL) != 0L && k++ < 8)
             {
-                @out.WriteByte(unchecked((sbyte)((i & 0x7FL) | 0x80L)));
+                @out.WriteByte(unchecked((byte)(sbyte)((i & 0x7FL) | 0x80L)));
                 i = (long)((ulong)i >> 7);
             }
-            @out.WriteByte((sbyte)i);
+            @out.WriteByte((byte)(sbyte)i);
         }
 
         protected internal DataOutput @out;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Util/Packed/BlockPackedWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Packed/BlockPackedWriter.cs b/src/Lucene.Net.Core/Util/Packed/BlockPackedWriter.cs
index f30b41a..82d51e7 100644
--- a/src/Lucene.Net.Core/Util/Packed/BlockPackedWriter.cs
+++ b/src/Lucene.Net.Core/Util/Packed/BlockPackedWriter.cs
@@ -89,7 +89,7 @@ namespace Lucene.Net.Util.Packed
             }
 
             int token = (bitsRequired << BPV_SHIFT) | (min == 0 ? MIN_VALUE_EQUALS_0 : 0);
-            @out.WriteByte((sbyte)token);
+            @out.WriteByte((byte)(sbyte)token);
 
             if (min != 0)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Util/Packed/PackedDataOutput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Packed/PackedDataOutput.cs b/src/Lucene.Net.Core/Util/Packed/PackedDataOutput.cs
index c66545a..364f01d 100644
--- a/src/Lucene.Net.Core/Util/Packed/PackedDataOutput.cs
+++ b/src/Lucene.Net.Core/Util/Packed/PackedDataOutput.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.Util.Packed
             {
                 if (RemainingBits == 0)
                 {
-                    @out.WriteByte((sbyte)Current);
+                    @out.WriteByte((byte)(sbyte)Current);
                     Current = 0L;
                     RemainingBits = 8;
                 }
@@ -71,7 +71,7 @@ namespace Lucene.Net.Util.Packed
         {
             if (RemainingBits < 8)
             {
-                @out.WriteByte((sbyte)Current);
+                @out.WriteByte((byte)(sbyte)Current);
             }
             RemainingBits = 8;
             Current = 0L;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs b/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs
index c0ef8d4..316c007 100644
--- a/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs
+++ b/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs
@@ -134,11 +134,11 @@ namespace Lucene.Net.Util
             }
             // The logic below is similar to ConjunctionScorer
             int numSets = docIdSets.Count;
-            Iterator[] iterators = new Iterator[numSets];
+            var iterators = new Iterator[numSets];
             int i = 0;
             foreach (WAH8DocIdSet set in docIdSets)
             {
-                Iterator it = (Iterator)set.GetIterator();
+                var it = (Iterator)set.GetIterator();
                 iterators[i++] = it;
             }
             Array.Sort(iterators, SERIALIZED_LENGTH_COMPARATOR);
@@ -328,7 +328,7 @@ namespace Lucene.Net.Util
                 {
                     token |= 1 << 3;
                 }
-                @out.WriteByte((sbyte)token);
+                @out.WriteByte((byte)(sbyte)token);
                 if (cleanLengthMinus2 > 0x03)
                 {
                     @out.WriteVInt((int)((uint)cleanLengthMinus2 >> 2));
@@ -396,7 +396,7 @@ namespace Lucene.Net.Util
                                 break;
 
                             case 2:
-                                DirtyWords.WriteByte((sbyte)0);
+                                DirtyWords.WriteByte(0);
                                 DirtyWords.WriteByte(word);
                                 break;
 
@@ -438,7 +438,7 @@ namespace Lucene.Net.Util
                             break;
 
                         case 2:
-                            DirtyWords.WriteByte((sbyte)0);
+                            DirtyWords.WriteByte(0);
                             DirtyWords.WriteByte(word);
                             break;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWFieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWFieldInfosWriter.cs b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWFieldInfosWriter.cs
index e33430e..f42dd00 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWFieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWFieldInfosWriter.cs
@@ -102,12 +102,12 @@ namespace Lucene.Net.Codecs.Lucene3x
                      * FI ordinal is not necessarily equivalent to the field number
                      */
                     output.WriteInt(fi.Number);
-                    output.WriteByte(bits);
+                    output.WriteByte((byte)bits);
                     if (fi.Indexed && !fi.OmitsNorms())
                     {
                         // to allow null norm types we need to indicate if norms are written
                         // only in RW case
-                        output.WriteByte((sbyte)(fi.NormType == null ? 0 : 1));
+                        output.WriteByte((byte)(sbyte)(fi.NormType == null ? 0 : 1));
                     }
                     Debug.Assert(fi.Attributes() == null); // not used or supported
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWNormsConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWNormsConsumer.cs b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWNormsConsumer.cs
index 0ab2369..3783440 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWNormsConsumer.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWNormsConsumer.cs
@@ -61,7 +61,11 @@ namespace Lucene.Net.Codecs.Lucene3x
             try
             {
                 output = directory.CreateOutput(normsFileName, context);
-                output.WriteBytes(NORMS_HEADER, 0, NORMS_HEADER.Length);
+                // output.WriteBytes(NORMS_HEADER, 0, NORMS_HEADER.Length);
+                foreach (var @sbyte in NORMS_HEADER)
+                {
+                    output.WriteByte((byte)@sbyte);
+                }
                 @out = output;
                 success = true;
             }
@@ -83,7 +87,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                 {
                     throw new System.NotSupportedException("3.x cannot index norms that won't fit in a byte, got: " + (long)n);
                 }
-                @out.WriteByte((sbyte)n);
+                @out.WriteByte((byte)(sbyte)n);
             }
             LastFieldNumber = field.Number;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWStoredFieldsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWStoredFieldsWriter.cs b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWStoredFieldsWriter.cs
index 7e046c2..9084363 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWStoredFieldsWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWStoredFieldsWriter.cs
@@ -158,7 +158,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                 }
             }
 
-            FieldsStream.WriteByte((sbyte)bits);
+            FieldsStream.WriteByte((byte)(sbyte)bits);
 
             if (bytes != null)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWTermVectorsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWTermVectorsWriter.cs b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWTermVectorsWriter.cs
index 61cd371..dd79878 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWTermVectorsWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene3x/PreFlexRWTermVectorsWriter.cs
@@ -103,7 +103,7 @@ namespace Lucene.Net.Codecs.Lucene3x
             {
                 bits |= Lucene3xTermVectorsReader.STORE_OFFSET_WITH_TERMVECTOR;
             }
-            Tvf.WriteByte(bits);
+            Tvf.WriteByte((byte)bits);
 
             Debug.Assert(FieldCount <= NumVectorFields);
             if (FieldCount == NumVectorFields)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40DocValuesWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40DocValuesWriter.cs b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40DocValuesWriter.cs
index 0261551..739cceb 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40DocValuesWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40DocValuesWriter.cs
@@ -144,7 +144,7 @@ namespace Lucene.Net.Codecs.Lucene40
             if (delta < 0)
             {
                 // writes longs
-                output.WriteByte(Lucene40DocValuesFormat.VAR_INTS_FIXED_64);
+                output.WriteByte((byte)Lucene40DocValuesFormat.VAR_INTS_FIXED_64);
                 foreach (long n in values)
                 {
                     output.WriteLong(n == null ? 0 : n);
@@ -153,7 +153,7 @@ namespace Lucene.Net.Codecs.Lucene40
             else
             {
                 // writes packed ints
-                output.WriteByte(Lucene40DocValuesFormat.VAR_INTS_PACKED);
+                output.WriteByte((byte)Lucene40DocValuesFormat.VAR_INTS_PACKED);
                 output.WriteLong(minValue);
                 output.WriteLong(0 - minValue); // default value (representation of 0)
                 PackedInts.Writer writer = PackedInts.GetWriter(output, State.SegmentInfo.DocCount, PackedInts.BitsRequired(delta), PackedInts.DEFAULT);
@@ -445,12 +445,12 @@ namespace Lucene.Net.Codecs.Lucene40
             Debug.Assert(i >= 0 && i <= short.MaxValue);
             if (i < 128)
             {
-                o.WriteByte((sbyte)i);
+                o.WriteByte((byte)(sbyte)i);
             }
             else
             {
-                o.WriteByte(unchecked((sbyte)(0x80 | (i >> 8))));
-                o.WriteByte(unchecked((sbyte)(i & 0xff)));
+                o.WriteByte((byte)unchecked((sbyte)(0x80 | (i >> 8))));
+                o.WriteByte((byte)unchecked((sbyte)(i & 0xff)));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40FieldInfosWriter.cs b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40FieldInfosWriter.cs
index 7f20adc..20c6b38 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40FieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40FieldInfosWriter.cs
@@ -89,14 +89,14 @@ namespace Lucene.Net.Codecs.Lucene40
                     }
                     output.WriteString(fi.Name);
                     output.WriteVInt(fi.Number);
-                    output.WriteByte(bits);
+                    output.WriteByte((byte)bits);
 
                     // pack the DV types in one byte
                     sbyte dv = DocValuesByte(fi.DocValuesType, fi.GetAttribute(Lucene40FieldInfosReader.LEGACY_DV_TYPE_KEY));
                     sbyte nrm = DocValuesByte(fi.NormType, fi.GetAttribute(Lucene40FieldInfosReader.LEGACY_NORM_TYPE_KEY));
                     Debug.Assert((dv & (~0xF)) == 0 && (nrm & (~0x0F)) == 0);
-                    sbyte val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
-                    output.WriteByte(val);
+                    var val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
+                    output.WriteByte((byte)val);
                     output.WriteStringStringMap(fi.Attributes());
                 }
                 success = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42DocValuesConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42DocValuesConsumer.cs b/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42DocValuesConsumer.cs
index 3ef3cbf..f59e0bf 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42DocValuesConsumer.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42DocValuesConsumer.cs
@@ -87,7 +87,7 @@ namespace Lucene.Net.Codecs.Lucene42
         internal virtual void AddNumericField(FieldInfo field, IEnumerable<long> values, bool optimizeStorage)
         {
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(Lucene42DocValuesProducer.NUMBER);
+            Meta.WriteByte((byte)Lucene42DocValuesProducer.NUMBER);
             Meta.WriteLong(Data.FilePointer);
             long minValue = long.MaxValue;
             long maxValue = long.MinValue;
@@ -145,7 +145,7 @@ namespace Lucene.Net.Codecs.Lucene42
                 FormatAndBits formatAndBits = PackedInts.FastestFormatAndBits(MaxDoc, bitsPerValue, AcceptableOverheadRatio);
                 if (formatAndBits.bitsPerValue == 8 && minValue >= sbyte.MinValue && maxValue <= sbyte.MaxValue)
                 {
-                    Meta.WriteByte(Lucene42DocValuesProducer.UNCOMPRESSED); // uncompressed
+                    Meta.WriteByte((byte)Lucene42DocValuesProducer.UNCOMPRESSED); // uncompressed
                     foreach (long nv in values)
                     {
                         Data.WriteByte(nv == null ? (byte)0 : (byte)nv);
@@ -153,9 +153,9 @@ namespace Lucene.Net.Codecs.Lucene42
                 }
                 else
                 {
-                    Meta.WriteByte(Lucene42DocValuesProducer.TABLE_COMPRESSED); // table-compressed
+                    Meta.WriteByte((byte)Lucene42DocValuesProducer.TABLE_COMPRESSED); // table-compressed
                     long[] decode = uniqueValues.ToArray(/*new long?[uniqueValues.Count]*/);
-                    Dictionary<long, int> encode = new Dictionary<long, int>();
+                    var encode = new Dictionary<long, int>();
                     Data.WriteVInt(decode.Length);
                     for (int i = 0; i < decode.Length; i++)
                     {
@@ -177,7 +177,7 @@ namespace Lucene.Net.Codecs.Lucene42
             }
             else if (gcd != 0 && gcd != 1)
             {
-                Meta.WriteByte(Lucene42DocValuesProducer.GCD_COMPRESSED);
+                Meta.WriteByte((byte)Lucene42DocValuesProducer.GCD_COMPRESSED);
                 Meta.WriteVInt(PackedInts.VERSION_CURRENT);
                 Data.WriteLong(minValue);
                 Data.WriteLong(gcd);
@@ -193,7 +193,7 @@ namespace Lucene.Net.Codecs.Lucene42
             }
             else
             {
-                Meta.WriteByte(Lucene42DocValuesProducer.DELTA_COMPRESSED); // delta-compressed
+                Meta.WriteByte((byte)Lucene42DocValuesProducer.DELTA_COMPRESSED); // delta-compressed
 
                 Meta.WriteVInt(PackedInts.VERSION_CURRENT);
                 Data.WriteVInt(Lucene42DocValuesProducer.BLOCK_SIZE);
@@ -238,7 +238,7 @@ namespace Lucene.Net.Codecs.Lucene42
         {
             // write the byte[] data
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(Lucene42DocValuesProducer.BYTES);
+            Meta.WriteByte((byte)Lucene42DocValuesProducer.BYTES);
             int minLength = int.MaxValue;
             int maxLength = int.MinValue;
             long startFP = Data.FilePointer;
@@ -285,7 +285,7 @@ namespace Lucene.Net.Codecs.Lucene42
         private void WriteFST(FieldInfo field, IEnumerable<BytesRef> values)
         {
             Meta.WriteVInt(field.Number);
-            Meta.WriteByte(Lucene42DocValuesProducer.FST);
+            Meta.WriteByte((byte)Lucene42DocValuesProducer.FST);
             Meta.WriteLong(Data.FilePointer);
             PositiveIntOutputs outputs = PositiveIntOutputs.Singleton;
             Builder<long> builder = new Builder<long>(INPUT_TYPE.BYTE1, outputs);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42FieldInfosWriter.cs b/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42FieldInfosWriter.cs
index 841d751..5ef4b6f 100644
--- a/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42FieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/lucene42/Lucene42FieldInfosWriter.cs
@@ -88,14 +88,14 @@ namespace Lucene.Net.Codecs.Lucene42
                     }
                     output.WriteString(fi.Name);
                     output.WriteVInt(fi.Number);
-                    output.WriteByte(bits);
+                    output.WriteByte((byte)bits);
 
                     // pack the DV types in one byte
-                    sbyte dv = DocValuesByte(fi.DocValuesType);
-                    sbyte nrm = DocValuesByte(fi.NormType);
+                    var dv = DocValuesByte(fi.DocValuesType);
+                    var nrm = DocValuesByte(fi.NormType);
                     Debug.Assert((dv & (~0xF)) == 0 && (nrm & (~0x0F)) == 0);
-                    sbyte val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
-                    output.WriteByte(val);
+                    var val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
+                    output.WriteByte((byte)val);
                     output.WriteStringStringMap(fi.Attributes());
                 }
                 success = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Index/MockIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/MockIndexInput.cs b/src/Lucene.Net.TestFramework/Index/MockIndexInput.cs
index b627b75..838539a 100644
--- a/src/Lucene.Net.TestFramework/Index/MockIndexInput.cs
+++ b/src/Lucene.Net.TestFramework/Index/MockIndexInput.cs
@@ -26,11 +26,11 @@ namespace Lucene.Net.Index
     /// </summary>
     public class MockIndexInput : BufferedIndexInput
     {
-        private sbyte[] Buffer;
+        private byte[] Buffer;
         private int Pointer = 0;
-        private long Length_Renamed;
+        private readonly long Length_Renamed;
 
-        public MockIndexInput(sbyte[] bytes)
+        public MockIndexInput(byte[] bytes)
             : base("MockIndexInput", BufferedIndexInput.BUFFER_SIZE)
         {
             Buffer = bytes;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
index b3a7199..b202c99 100644
--- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
@@ -321,12 +321,12 @@ namespace Lucene.Net.Store
                         action = "zeroed";
                         // Zero out file entirely
                         long length = FileLength(name);
-                        sbyte[] zeroes = new sbyte[256];
+                        var zeroes = new byte[256]; // LUCENENET TODO: Don't we want to fill the array before writing from it?
                         long upto = 0;
                         IndexOutput @out = @in.CreateOutput(name, LuceneTestCase.NewIOContext(RandomState));
                         while (upto < length)
                         {
-                            int limit = (int)Math.Min(length - upto, zeroes.Length);
+                            var limit = (int)Math.Min(length - upto, zeroes.Length);
                             @out.WriteBytes(zeroes, 0, limit);
                             upto += limit;
                         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Index/TestCompoundFile.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestCompoundFile.cs b/src/Lucene.Net.Tests/core/Index/TestCompoundFile.cs
index af06888..87a36cf 100644
--- a/src/Lucene.Net.Tests/core/Index/TestCompoundFile.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestCompoundFile.cs
@@ -64,8 +64,8 @@ namespace Lucene.Net.Index
             IndexOutput os = dir.CreateOutput(name, NewIOContext(Random()));
             for (int i = 0; i < size; i++)
             {
-                sbyte b = unchecked((sbyte)(new Random(1).NextDouble() * 256));
-                os.WriteByte(b);
+                var b = unchecked((sbyte)(new Random(1).NextDouble() * 256));
+                os.WriteByte((byte)b);
             }
             os.Dispose();
         }
@@ -80,7 +80,7 @@ namespace Lucene.Net.Index
             IndexOutput os = dir.CreateOutput(name, NewIOContext(Random()));
             for (int i = 0; i < size; i++)
             {
-                os.WriteByte(start);
+                os.WriteByte((byte)start);
                 start++;
             }
             os.Dispose();
@@ -308,7 +308,7 @@ namespace Lucene.Net.Index
             IndexOutput os = fsdir.CreateOutput(file, IOContext.DEFAULT);
             for (int i = 0; i < 2000; i++)
             {
-                os.WriteByte((sbyte)i);
+                os.WriteByte((byte)(sbyte)i);
             }
             os.Dispose();
 
@@ -619,10 +619,10 @@ namespace Lucene.Net.Index
         {
             IndexOutput os = Dir.CreateOutput("testBufferStart.txt", NewIOContext(Random()));
 
-            sbyte[] largeBuf = new sbyte[2048];
+            var largeBuf = new byte[2048];
             for (int i = 0; i < largeBuf.Length; i++)
             {
-                largeBuf[i] = unchecked((sbyte)(new Random(1).NextDouble() * 256));
+                largeBuf[i] = (byte)unchecked((sbyte)(new Random(1).NextDouble() * 256));
             }
 
             long currentPos = os.FilePointer;
@@ -813,7 +813,7 @@ namespace Lucene.Net.Index
             for (int fileIdx = 0; fileIdx < FILE_COUNT; fileIdx++)
             {
                 IndexOutput @out = d.CreateOutput("file." + fileIdx, NewIOContext(Random()));
-                @out.WriteByte((sbyte)fileIdx);
+                @out.WriteByte((byte)(sbyte)fileIdx);
                 @out.Dispose();
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Index/TestIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexInput.cs b/src/Lucene.Net.Tests/core/Index/TestIndexInput.cs
index 772dd87..ea1f79f 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexInput.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexInput.cs
@@ -34,7 +34,7 @@ namespace Lucene.Net.Index
     [TestFixture]
     public class TestIndexInput : LuceneTestCase
     {
-        internal static readonly sbyte[] READ_TEST_BYTES = new sbyte[] { unchecked((sbyte)0x80), 0x01, unchecked((sbyte)0xFF), 0x7F, unchecked((sbyte)0x80), unchecked((sbyte)0x80), 0x01, unchecked((sbyte)0x81), unchecked((sbyte)0x80), 0x01, unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), (sbyte)0x07, unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), (sbyte)0x0F, unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), (sbyte)0x07, unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), (sbyte)0x7F, 0x06, (sbyte)'L', (sbyte)'u', (sbyte)'c', (sbyte)'e', (sbyte)'n', (sbyte)'e', 0x02, unchecked((sbyte)0xC2), unchecked((sbyte)0xBF), 0x0A, (sbyte)'L', (sbyte)'u', unchecked((sbyte)0xC2), unchecked((sbyte)0xBF), (sbyte)'c', (s
 byte)'e', unchecked((sbyte)0xC2), unchecked((sbyte)0xBF), (sbyte)'n', (sbyte)'e', 0x03, unchecked((sbyte)0xE2), unchecked((sbyte)0x98), unchecked((sbyte)0xA0), 0x0C, (sbyte)'L', (sbyte)'u', unchecked((sbyte)0xE2), unchecked((sbyte)0x98), unchecked((sbyte)0xA0), (sbyte)'c', (sbyte)'e', unchecked((sbyte)0xE2), unchecked((sbyte)0x98), unchecked((sbyte)0xA0), (sbyte)'n', (sbyte)'e', 0x04, unchecked((sbyte)0xF0), unchecked((sbyte)0x9D), unchecked((sbyte)0x84), unchecked((sbyte)0x9E), 0x08, unchecked((sbyte)0xF0), unchecked((sbyte)0x9D), unchecked((sbyte)0x84), unchecked((sbyte)0x9E), unchecked((sbyte)0xF0), unchecked((sbyte)0x9D), unchecked((sbyte)0x85), unchecked((sbyte)0xA0), 0x0E, (sbyte)'L', (sbyte)'u', unchecked((sbyte)0xF0), unchecked((sbyte)0x9D), unchecked((sbyte)0x84), unchecked((sbyte)0x9E), (sbyte)'c', (sbyte)'e', unchecked((sbyte)0xF0), unchecked((sbyte)0x9D), unchecked((sbyte)0x85), unchecked((sbyte)0xA0), (sbyte)'n', (sbyte)'e', 0x01, 0x00, 0x08, (sbyte)'L', (sbyte)'u', 0x0
 0, (sbyte)'c', (sbyte)'e', 0x00, (sbyte)'n', (sbyte)'e', unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), (sbyte)0x17, (sbyte)0x01, unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), unchecked((sbyte)0xFF), (sbyte)0x01 };
+        internal static readonly byte[] READ_TEST_BYTES = new byte[] { unchecked((byte)(sbyte)0x80), 0x01, unchecked((byte)(sbyte)0xFF), 0x7F, unchecked((byte)(sbyte)0x80), unchecked((byte)(sbyte)0x80), 0x01, unchecked((byte)(sbyte)0x81), unchecked((byte)(sbyte)0x80), 0x01, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), 0x07, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), 0x0F, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), 0x07, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), (byte)0x7F, 0x06, (byte)'L', (byte)'u', (byte)'c', (byte)'e', (byte)'n', (byte)'e', 0x02, unchecked((byt
 e)(sbyte)0xC2), unchecked((byte)(sbyte)0xBF), 0x0A, (byte)'L', (byte)'u', unchecked((byte)(sbyte)0xC2), unchecked((byte)(sbyte)0xBF), (byte)(sbyte)'c', (byte)'e', unchecked((byte)(sbyte)0xC2), unchecked((byte)(sbyte)0xBF), (byte)'n', (byte)'e', 0x03, unchecked((byte)(sbyte)0xE2), unchecked((byte)(sbyte)0x98), unchecked((byte)(sbyte)0xA0), 0x0C, (byte)'L', (byte)'u', unchecked((byte)(sbyte)0xE2), unchecked((byte)(sbyte)0x98), unchecked((byte)(sbyte)0xA0), (byte)'c', (byte)'e', unchecked((byte)(sbyte)0xE2), unchecked((byte)(sbyte)0x98), unchecked((byte)(sbyte)0xA0), (byte)'n', (byte)'e', 0x04, unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x84), unchecked((byte)(sbyte)0x9E), 0x08, unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x84), unchecked((byte)(sbyte)0x9E), unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x85), unchecked((byte)(sbyte)0xA0), 0x0E, (byte)'L', (byte)'u', unch
 ecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x84), unchecked((byte)(sbyte)0x9E), (byte)'c', (byte)'e', unchecked((byte)(sbyte)0xF0), unchecked((byte)(sbyte)0x9D), unchecked((byte)(sbyte)0x85), unchecked((byte)(sbyte)0xA0), (byte)'n', (byte)'e', 0x01, 0x00, 0x08, (byte)'L', (byte)'u', 0x00, (byte)'c', (byte)'e', 0x00, (byte)'n', (byte)'e', unchecked((byte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), (byte)0x17, (byte)0x01, unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), unchecked((byte)(sbyte)0xFF), 0x01 };
 
         internal static readonly int COUNT = RANDOM_MULTIPLIER * 65536;
         internal static int[] INTS;
@@ -146,7 +146,7 @@ namespace Lucene.Net.Index
             IndexInput @is = new MockIndexInput(READ_TEST_BYTES);
             CheckReads(@is, typeof(IOException));
             @is.Dispose();
-            @is = new MockIndexInput((sbyte[])(Array)RANDOM_TEST_BYTES);
+            @is = new MockIndexInput(RANDOM_TEST_BYTES);
             CheckRandomReads(@is);
             @is.Dispose();
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
index e06d191..a81eed4 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
@@ -2250,14 +2250,14 @@ namespace Lucene.Net.Index
         public virtual void TestOtherFiles()
         {
             Directory dir = NewDirectory();
-            IndexWriter iw = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
+            var iw = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
             iw.AddDocument(new Document());
             iw.Dispose();
             try
             {
                 // Create my own random file:
                 IndexOutput @out = dir.CreateOutput("myrandomfile", NewIOContext(Random()));
-                @out.WriteByte((sbyte)42);
+                @out.WriteByte((byte)(sbyte)42);
                 @out.Dispose();
 
                 (new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())))).Dispose();
@@ -2367,7 +2367,7 @@ namespace Lucene.Net.Index
             {
                 // Create my own random file:
                 IndexOutput @out = dir.CreateOutput("_a.frq", NewIOContext(Random()));
-                @out.WriteByte((sbyte)42);
+                @out.WriteByte((byte)(sbyte)42);
                 @out.Dispose();
 
                 (new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())))).Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
index 2268432..2a4963b 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
@@ -1373,7 +1373,7 @@ namespace Lucene.Net.Index
             IndexOutput @out = dir.CreateOutput(IndexFileNames.FileNameFromGeneration(IndexFileNames.SEGMENTS, "", 1 + gen), NewIOContext(Random()));
             @out.CopyBytes(@in, @in.Length() - 1);
             byte b = @in.ReadByte();
-            @out.WriteByte((sbyte)(1 + b));
+            @out.WriteByte((byte)(sbyte)(1 + b));
             @out.Dispose();
             @in.Dispose();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
index d16dfb1..ef105c6 100644
--- a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
@@ -181,7 +181,7 @@ namespace Lucene.Net.Store
                 string fname = "foo." + i;
                 string lockname = "foo" + i + ".lck";
                 IndexOutput @out = dir.CreateOutput(fname, NewIOContext(Random()));
-                @out.WriteByte((sbyte)i);
+                @out.WriteByte((byte)(sbyte)i);
                 @out.WriteBytes(largeBuffer, largeBuffer.Length);
                 @out.Dispose();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs
index c55afba..fb71235 100644
--- a/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestFileSwitchDirectory.cs
@@ -175,7 +175,7 @@ namespace Lucene.Net.Store
             IndexOutput os = dir.CreateOutput(name, NewIOContext(Random()));
             for (int i = 0; i < size; i++)
             {
-                os.WriteByte(start);
+                os.WriteByte((byte)start);
                 start++;
             }
             os.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs b/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs
index f225f53..cd537b3 100644
--- a/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestHugeRamFile.cs
@@ -67,16 +67,16 @@ namespace Lucene.Net.Store
         {
             DenseRAMFile f = new DenseRAMFile();
             // output part
-            RAMOutputStream @out = new RAMOutputStream(f);
-            sbyte[] b1 = new sbyte[RAMOutputStream.BUFFER_SIZE];
-            sbyte[] b2 = new sbyte[RAMOutputStream.BUFFER_SIZE / 3];
+            var @out = new RAMOutputStream(f);
+            var b1 = new byte[RAMOutputStream.BUFFER_SIZE];
+            var b2 = new byte[RAMOutputStream.BUFFER_SIZE / 3];
             for (int i = 0; i < b1.Length; i++)
             {
-                b1[i] = (sbyte)(i & 0x0007F);
+                b1[i] = (byte)(sbyte)(i & 0x0007F);
             }
             for (int i = 0; i < b2.Length; i++)
             {
-                b2[i] = (sbyte)(i & 0x0003F);
+                b2[i] = (byte)(sbyte)(i & 0x0003F);
             }
             long n = 0;
             Assert.AreEqual(n, @out.Length, "output length must match");

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs b/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs
index b88b9b3..932740b 100644
--- a/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestMockDirectoryWrapper.cs
@@ -71,7 +71,7 @@ namespace Lucene.Net.Store
             // test writeBytes
             MockDirectoryWrapper dir = NewMockDirectory();
             dir.MaxSizeInBytes = 3;
-            sbyte[] bytes = new sbyte[] { 1, 2 };
+            var bytes = new byte[] { 1, 2 };
             IndexOutput @out = dir.CreateOutput("foo", IOContext.DEFAULT);
             @out.WriteBytes(bytes, bytes.Length); // first write should succeed
             // flush() to ensure the written bytes are not buffered and counted

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
index f74cb95..6d34509 100644
--- a/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestNRTCachingDirectory.cs
@@ -212,7 +212,7 @@ namespace Lucene.Net.Store
             IndexOutput os = dir.CreateOutput(name, NewIOContext(Random()));
             for (int i = 0; i < size; i++)
             {
-                os.WriteByte(start);
+                os.WriteByte((byte)start);
                 start++;
             }
             os.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Store/TestRAMDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestRAMDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestRAMDirectory.cs
index 91aef81..7fa05f4 100644
--- a/src/Lucene.Net.Tests/core/Store/TestRAMDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestRAMDirectory.cs
@@ -188,7 +188,7 @@ namespace Lucene.Net.Store
         {
             RAMDirectory dir = new RAMDirectory();
             IndexOutput o = dir.CreateOutput("out", NewIOContext(Random()));
-            sbyte[] b = new sbyte[1024];
+            var b = new byte[1024];
             o.WriteBytes(b, 0, 1024);
             o.Dispose();
             IndexInput i = dir.OpenInput("out", NewIOContext(Random()));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ab8a9436/src/Lucene.Net.Tests/core/Util/TestPagedBytes.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/TestPagedBytes.cs b/src/Lucene.Net.Tests/core/Util/TestPagedBytes.cs
index 3779756..e3bad07 100644
--- a/src/Lucene.Net.Tests/core/Util/TestPagedBytes.cs
+++ b/src/Lucene.Net.Tests/core/Util/TestPagedBytes.cs
@@ -187,14 +187,14 @@ namespace Lucene.Net.Util
             }
             int blockBits = TestUtil.NextInt(Random(), 14, 28);
             int blockSize = 1 << blockBits;
-            sbyte[] arr = new sbyte[TestUtil.NextInt(Random(), blockSize / 2, blockSize * 2)];
+            var arr = new byte[TestUtil.NextInt(Random(), blockSize / 2, blockSize * 2)];
             for (int i = 0; i < arr.Length; ++i)
             {
-                arr[i] = (sbyte)i;
+                arr[i] = (byte)(sbyte)i;
             }
             long numBytes = (1L << 31) + TestUtil.NextInt(Random(), 1, blockSize * 3);
-            PagedBytes p = new PagedBytes(blockBits);
-            IndexOutput @out = dir.CreateOutput("foo", IOContext.DEFAULT);
+            var p = new PagedBytes(blockBits);
+            var @out = dir.CreateOutput("foo", IOContext.DEFAULT);
             for (long i = 0; i < numBytes; )
             {
                 Assert.AreEqual(i, @out.FilePointer);


Mime
View raw message