diff options
author | Jake Farrell <jfarrell@apache.org> | 2012-10-05 00:38:11 +0000 |
---|---|---|
committer | Jake Farrell <jfarrell@apache.org> | 2012-10-05 00:38:11 +0000 |
commit | 14c217d490066527fba2b8eda8e4020abbe31739 (patch) | |
tree | 57c23668ee4a7cd892e1c7f6da88757e3dc0b7d5 | |
parent | 093f5cef5304ffa02c90aa21c30c8faa88587000 (diff) | |
download | thrift-14c217d490066527fba2b8eda8e4020abbe31739.tar.gz |
Thrift-1709:Warning "Bitwise-or operator used on a sign-extended operand; consider casting to a smaller unsigned type first" in TBinaryProtocol.cs at ReadInt64()
Client: csharp
Patch: Jens Geyer
Fixes warning at the byte shift operations due to a missing cast at the bitwise-or.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1394338 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | lib/csharp/src/Protocol/TBinaryProtocol.cs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/csharp/src/Protocol/TBinaryProtocol.cs b/lib/csharp/src/Protocol/TBinaryProtocol.cs index e6b69d65b..53daa1d98 100644 --- a/lib/csharp/src/Protocol/TBinaryProtocol.cs +++ b/lib/csharp/src/Protocol/TBinaryProtocol.cs @@ -347,9 +347,16 @@ namespace Thrift.Protocol public override long ReadI64() { ReadAll(i64in, 0, 8); - return (long)(((long)(i64in[0] & 0xff) << 56) | ((long)(i64in[1] & 0xff) << 48) | ((long)(i64in[2] & 0xff) << 40) | ((long)(i64in[3] & 0xff) << 32) | - ((long)(i64in[4] & 0xff) << 24) | ((long)(i64in[5] & 0xff) << 16) | ((long)(i64in[6] & 0xff) << 8) | ((long)(i64in[7] & 0xff))); - } + return (long)( + (ulong)((ulong)(i64in[0] & 0xff) << 56) | + (ulong)((ulong)(i64in[1] & 0xff) << 48) | + (ulong)((ulong)(i64in[2] & 0xff) << 40) | + (ulong)((ulong)(i64in[3] & 0xff) << 32) | + (ulong)((ulong)(i64in[4] & 0xff) << 24) | + (ulong)((ulong)(i64in[5] & 0xff) << 16) | + (ulong)((ulong)(i64in[6] & 0xff) << 8) | + (ulong)((ulong)(i64in[7] & 0xff))); + } public override double ReadDouble() { |