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

Github Pull Request:

This closes #403
commit 11d0a661985cabe63c1dc1b47576bb2b2d6c2e54
Author: Willyham <willyd@uber.com>
Date: 2015-03-20T22:28:01Z
Make TCompactProtocol always return an object for i64
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 @@
  * 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 @@
       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 @@
  * 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 @@
   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) {