lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [44/45] lucenenet git commit: Fixed compile warnings "bitwise or operator used on sign extended operand"
Date Sun, 30 Apr 2017 21:56:23 GMT
Fixed compile warnings "bitwise or operator used on sign extended operand"


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

Branch: refs/heads/master
Commit: a6a209cbe91c0b8080563403e84e596f4dd4ee09
Parents: 7af8942
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon May 1 04:33:01 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon May 1 04:48:41 2017 +0700

----------------------------------------------------------------------
 .../Codecs/Lucene40/Lucene40FieldInfosWriter.cs                  | 4 ++--
 .../Codecs/Lucene42/Lucene42FieldInfosWriter.cs                  | 4 ++--
 src/Lucene.Net.Tests/Index/TestStressIndexing2.cs                | 4 ++--
 src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs                    | 4 ++--
 .../Codecs/Compressing/CompressingStoredFieldsWriter.cs          | 2 +-
 src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosWriter.cs       | 4 ++--
 src/Lucene.Net/Util/NumericUtils.cs                              | 2 +-
 src/Lucene.Net/Util/Packed/BulkOperationPacked.cs                | 4 ++--
 src/Lucene.Net/Util/Packed/DirectPackedReader.cs                 | 2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/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 bcefd88..908ee7d 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
@@ -95,8 +95,8 @@ namespace Lucene.Net.Codecs.Lucene40
                     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);
-                    var val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
-                    output.WriteByte((byte)val);
+                    var val = (byte)(0xff & ((nrm << 4) | (byte)dv));
+                    output.WriteByte(val);
                     output.WriteStringStringMap(fi.Attributes);
                 }
                 success = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/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 d50a008..f8a3d07 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
@@ -95,8 +95,8 @@ namespace Lucene.Net.Codecs.Lucene42
                     var dv = DocValuesByte(fi.DocValuesType);
                     var nrm = DocValuesByte(fi.NormType);
                     Debug.Assert((dv & (~0xF)) == 0 && (nrm & (~0x0F)) ==
0);
-                    var val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
-                    output.WriteByte((byte)val);
+                    var val = (byte)(0xff & ((nrm << 4) | (byte)dv));
+                    output.WriteByte(val);
                     output.WriteStringStringMap(fi.Attributes);
                 }
                 success = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
index 17fc7a3..04fa523 100644
--- a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
+++ b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
@@ -594,7 +594,7 @@ namespace Lucene.Net.Index
                     {
                         int d = docs1.DocID;
                         int f = docs1.Freq;
-                        info1[len1] = (((long)d) << 32) | f;
+                        info1[len1] = (((long)d) << 32) | (uint)f;
                         len1++;
                     }
                     if (len1 > 0)
@@ -636,7 +636,7 @@ namespace Lucene.Net.Index
                     {
                         int d = r2r1[docs2.DocID];
                         int f = docs2.Freq;
-                        info2[len2] = (((long)d) << 32) | f;
+                        info2[len2] = (((long)d) << 32) | (uint)f;
                         len2++;
                     }
                     if (len2 > 0)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs b/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs
index d026e76..4b5df96 100644
--- a/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs
+++ b/src/Lucene.Net/Codecs/BlockTreeTermsWriter.cs
@@ -371,7 +371,7 @@ namespace Lucene.Net.Codecs
         internal static long EncodeOutput(long fp, bool hasTerms, bool isFloor)
         {
             Debug.Assert(fp < (1L << 62));
-            return (fp << 2) | (hasTerms ? OUTPUT_FLAG_HAS_TERMS : 0) | (isFloor ?
OUTPUT_FLAG_IS_FLOOR : 0);
+            return (fp << 2) | (uint)(hasTerms ? OUTPUT_FLAG_HAS_TERMS : 0) | (uint)(isFloor
? OUTPUT_FLAG_IS_FLOOR : 0);
         }
 
         private class PendingEntry
@@ -454,7 +454,7 @@ namespace Lucene.Net.Codecs
                         //}
                         scratchBytes.WriteByte((byte)(sbyte)sub.FloorLeadByte);
                         Debug.Assert(sub.Fp > Fp);
-                        scratchBytes.WriteVInt64((sub.Fp - Fp) << 1 | (sub.HasTerms
? 1 : 0));
+                        scratchBytes.WriteVInt64((sub.Fp - Fp) << 1 | (uint)(sub.HasTerms
? 1 : 0));
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs b/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs
index 98336fa..4f8f949 100644
--- a/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs
+++ b/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs
@@ -347,7 +347,7 @@ namespace Lucene.Net.Codecs.Compressing
                 }
             }
 
-            long infoAndBits = (((long)info.Number) << TYPE_BITS) | bits;
+            long infoAndBits = (((long)info.Number) << TYPE_BITS) | (uint)bits;
             bufferedDocs.WriteVInt64(infoAndBits);
 
             if (bytes != null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosWriter.cs b/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
index b1732da..a2fcf85 100644
--- a/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
+++ b/src/Lucene.Net/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
@@ -93,8 +93,8 @@ namespace Lucene.Net.Codecs.Lucene46
                     var dv = DocValuesByte(fi.DocValuesType);
                     var nrm = DocValuesByte(fi.NormType);
                     Debug.Assert((dv & (~0xF)) == 0 && (nrm & (~0x0F)) ==
0);
-                    var val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
-                    output.WriteByte((byte)val);
+                    var val = (byte)(0xff & ((nrm << 4) | (byte)dv));
+                    output.WriteByte(val);
                     output.WriteInt64(fi.DocValuesGen);
                     output.WriteStringStringMap(fi.Attributes);
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/src/Lucene.Net/Util/NumericUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Util/NumericUtils.cs b/src/Lucene.Net/Util/NumericUtils.cs
index 8f1bb66..5cc67fd 100644
--- a/src/Lucene.Net/Util/NumericUtils.cs
+++ b/src/Lucene.Net/Util/NumericUtils.cs
@@ -288,7 +288,7 @@ namespace Lucene.Net.Util
                 {
                     throw new System.FormatException("Invalid prefixCoded numerical value
representation (byte " + (b & 0xff).ToString("x") + " at position " + (i - val.Offset)
+ " is invalid)");
                 }
-                sortableBits |= (sbyte)b;
+                sortableBits |= b;
             }
             return (int)((sortableBits << GetPrefixCodedInt32Shift(val)) ^ 0x80000000);
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs b/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs
index 1a627f5..32330fe 100644
--- a/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs
+++ b/src/Lucene.Net/Util/Packed/BulkOperationPacked.cs
@@ -240,7 +240,7 @@ namespace Lucene.Net.Util.Packed
                 } // bitsLeft < 0
                 else
                 {
-                    nextBlock |= (int)((uint)(values[valuesOffset] & 0xFFFFFFFFL) >>
-bitsLeft);
+                    nextBlock |= ((uint)(values[valuesOffset] & 0xFFFFFFFFL) >>
-bitsLeft);
                     blocks[blocksOffset++] = nextBlock;
                     nextBlock = (values[valuesOffset++] & ((1L << -bitsLeft) -
1)) << (64 + bitsLeft);
                     bitsLeft += 64;
@@ -266,7 +266,7 @@ namespace Lucene.Net.Util.Packed
                 {
                     // flush as many blocks as possible
                     int bits = bitsPerValue - bitsLeft;
-                    blocks[blocksOffset++] = (byte)(nextBlock | ((long)((ulong)v >>
bits)));
+                    blocks[blocksOffset++] = (byte)((uint)nextBlock | ((long)((ulong)v >>
bits)));
                     while (bits >= 8)
                     {
                         bits -= 8;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6a209cb/src/Lucene.Net/Util/Packed/DirectPackedReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Util/Packed/DirectPackedReader.cs b/src/Lucene.Net/Util/Packed/DirectPackedReader.cs
index e66ccdc..e4c79f1 100644
--- a/src/Lucene.Net/Util/Packed/DirectPackedReader.cs
+++ b/src/Lucene.Net/Util/Packed/DirectPackedReader.cs
@@ -97,7 +97,7 @@ namespace Lucene.Net.Util.Packed
                     case 9:
                         // We must be very careful not to shift out relevant bits. So we
account for right shift
                         // we would normally do on return here, and reset it.
-                        rawValue = (@in.ReadInt64() << (8 - shiftRightBits)) | ((int)((uint)(@in.ReadByte()
& 0xFFL) >> shiftRightBits));
+                        rawValue = (@in.ReadInt64() << (8 - shiftRightBits)) | (((uint)(@in.ReadByte()
& 0xFFL) >> shiftRightBits));
                         shiftRightBits = 0;
                         break;
 


Mime
View raw message