You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by me...@apache.org on 2016/04/08 04:19:40 UTC
thrift git commit: THRIFT-3780 Use fixnum Int64 to write/read binary
encoded i64 Client: Dart Patch: Steven Osborne
Repository: thrift
Updated Branches:
refs/heads/master ca714c439 -> 8b0b7e5eb
THRIFT-3780 Use fixnum Int64 to write/read binary encoded i64
Client: Dart
Patch: Steven Osborne <st...@webfilings.com>
This closes #983
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/8b0b7e5e
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/8b0b7e5e
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/8b0b7e5e
Branch: refs/heads/master
Commit: 8b0b7e5eb419eaa47294fa0a70ab96b3a9a07d0b
Parents: ca714c4
Author: Mark Erickson <me...@apache.org>
Authored: Thu Apr 7 21:12:25 2016 -0500
Committer: Mark Erickson <me...@apache.org>
Committed: Thu Apr 7 21:12:25 2016 -0500
----------------------------------------------------------------------
lib/dart/lib/src/protocol/t_binary_protocol.dart | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/8b0b7e5e/lib/dart/lib/src/protocol/t_binary_protocol.dart
----------------------------------------------------------------------
diff --git a/lib/dart/lib/src/protocol/t_binary_protocol.dart b/lib/dart/lib/src/protocol/t_binary_protocol.dart
index f73223c..a785d81 100644
--- a/lib/dart/lib/src/protocol/t_binary_protocol.dart
+++ b/lib/dart/lib/src/protocol/t_binary_protocol.dart
@@ -124,11 +124,15 @@ class TBinaryProtocol extends TProtocol {
transport.write(_i32Out.buffer.asUint8List(), 0, 4);
}
- final ByteData _i64Out = new ByteData(8);
+ final Uint8List _i64Out = new Uint8List(8);
void writeI64(int i64) {
if (i64 == null) i64 = 0;
- _i64Out.setInt64(0, i64);
- transport.write(_i64Out.buffer.asUint8List(), 0, 8);
+ var i = new Int64(i64);
+ var bts = i.toBytes();
+ for (var j = 0; j < 8; j++) {
+ _i64Out[j] = bts[8 - j - 1];
+ }
+ transport.write(_i64Out, 0, 8);
}
void writeString(String s) {
@@ -247,7 +251,8 @@ class TBinaryProtocol extends TProtocol {
final Uint8List _i64In = new Uint8List(8);
int readI64() {
transport.readAll(_i64In, 0, 8);
- return _i64In.buffer.asByteData().getInt64(0);
+ var i = new Int64.fromBytesBigEndian(_i64In);
+ return i.toInt();
}
final Uint8List _doubleIn = new Uint8List(8);