THRIFT-3841 Dart compact protocol incorrectly serializes/deserialized doubles
Client: Dart
Patch: Brian Shannan <brian.shannan@workiva.com>
This closes #3841
diff --git a/lib/dart/lib/src/protocol/t_compact_protocol.dart b/lib/dart/lib/src/protocol/t_compact_protocol.dart
index c5dc515..72d7641 100644
--- a/lib/dart/lib/src/protocol/t_compact_protocol.dart
+++ b/lib/dart/lib/src/protocol/t_compact_protocol.dart
@@ -187,7 +187,7 @@
void writeDouble(double d) {
if (d == null) d = 0.0;
- tempBD.setFloat64(0, d);
+ tempBD.setFloat64(0, d, Endianness.LITTLE_ENDIAN);
transport.write(tempBD.buffer.asUint8List(), 0, 8);
}
@@ -364,7 +364,7 @@
double readDouble() {
transport.readAll(tempList, 0, 8);
- return tempList.buffer.asByteData().getFloat64(0);
+ return tempList.buffer.asByteData().getFloat64(0, Endianness.LITTLE_ENDIAN);
}
String readString() {
diff --git a/lib/dart/lib/thrift.dart b/lib/dart/lib/thrift.dart
index 27eb546..ca23fb3 100644
--- a/lib/dart/lib/thrift.dart
+++ b/lib/dart/lib/thrift.dart
@@ -21,6 +21,7 @@
import 'dart:collection';
import 'dart:convert' show Utf8Codec;
import 'dart:typed_data' show ByteData;
+import 'dart:typed_data' show Endianness;
import 'dart:typed_data' show Uint8List;
import 'package:crypto/crypto.dart' show CryptoUtils;