You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2012/10/05 02:38:11 UTC
svn commit: r1394338 -
/thrift/trunk/lib/csharp/src/Protocol/TBinaryProtocol.cs
Author: jfarrell
Date: Fri Oct 5 00:38:11 2012
New Revision: 1394338
URL: http://svn.apache.org/viewvc?rev=1394338&view=rev
Log:
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.
Modified:
thrift/trunk/lib/csharp/src/Protocol/TBinaryProtocol.cs
Modified: thrift/trunk/lib/csharp/src/Protocol/TBinaryProtocol.cs
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/csharp/src/Protocol/TBinaryProtocol.cs?rev=1394338&r1=1394337&r2=1394338&view=diff
==============================================================================
--- thrift/trunk/lib/csharp/src/Protocol/TBinaryProtocol.cs (original)
+++ thrift/trunk/lib/csharp/src/Protocol/TBinaryProtocol.cs Fri Oct 5 00:38:11 2012
@@ -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()
{