You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ra...@apache.org on 2015/03/27 00:06:43 UTC

thrift git commit: THRIFT-3048: Repair node i64 compact interface Client: Node lib Patch: Will Demaine

Repository: thrift
Updated Branches:
  refs/heads/master 41ad4342c -> cada37008


THRIFT-3048: Repair node i64 compact interface
Client: Node lib
Patch: Will Demaine

Github Pull Request:

This closes #403
commit 11d0a661985cabe63c1dc1b47576bb2b2d6c2e54
Author: Willyham <wi...@uber.com>
Date: 2015-03-20T22:28:01Z
Make TCompactProtocol always return an object for i64


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

Branch: refs/heads/master
Commit: cada37008ce6e609fe6312596d3ced760e5cd60c
Parents: 41ad434
Author: Randy Abernethy <ra...@apache.org>
Authored: Thu Mar 26 16:03:08 2015 -0700
Committer: Randy Abernethy <ra...@apache.org>
Committed: Thu Mar 26 16:03:08 2015 -0700

----------------------------------------------------------------------
 lib/nodejs/lib/thrift/compact_protocol.js | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/cada3700/lib/nodejs/lib/thrift/compact_protocol.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/lib/thrift/compact_protocol.js b/lib/nodejs/lib/thrift/compact_protocol.js
index 45d62f4..8aee808 100644
--- a/lib/nodejs/lib/thrift/compact_protocol.js
+++ b/lib/nodejs/lib/thrift/compact_protocol.js
@@ -780,7 +780,7 @@ TCompactProtocol.prototype.readString = function() {
  * if there is another byte to follow. This can read up to 5 bytes.
  */
 TCompactProtocol.prototype.readVarint32 = function() {
-  return this.readVarint64();
+  return this.readVarint64().toNumber();
 };
 
 /**
@@ -811,8 +811,7 @@ TCompactProtocol.prototype.readVarint64 = function() {
       throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.INVALID_DATA, "Variable-length int over 10 bytes.");
     }
   }
-  var i64 = new Int64(hi, lo);
-  return i64.toNumber();
+  return new Int64(hi, lo);
 };
 
 /**
@@ -826,9 +825,8 @@ TCompactProtocol.prototype.zigzagToI32 = function(n) {
  * Convert from zigzag long to long.
  */
 TCompactProtocol.prototype.zigzagToI64 = function(n) {
-  var zz = new Int64(n);
-  var hi = zz.buffer.readUInt32BE(0, true);
-  var lo = zz.buffer.readUInt32BE(4, true);
+  var hi = n.buffer.readUInt32BE(0, true);
+  var lo = n.buffer.readUInt32BE(4, true);
 
   var neg = new Int64(hi & 0, lo & 1);
   neg._2scomp();
@@ -838,8 +836,7 @@ TCompactProtocol.prototype.zigzagToI64 = function(n) {
   var hi_lo = (hi << 31);
   hi = (hi >>> 1) ^ (hi_neg);
   lo = ((lo >>> 1) | hi_lo) ^ (lo_neg);
-  var i64 = new Int64(hi, lo);
-  return i64.toNumber();
+  return new Int64(hi, lo);
 };
 
 TCompactProtocol.prototype.skip = function(type) {