Skip to content

Commit

Permalink
Merge pull request #117 from sigurdm/fix_encoding_bugs
Browse files Browse the repository at this point in the history
Fix problems in CodedBufferWriter
  • Loading branch information
sigurdm committed Jul 27, 2018
2 parents 9a76d97 + ff89e23 commit fd55da7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.9.1

* Fix problem with encoding negative enum values.
* Fix problem with encoding byte arrays.

## 0.9.0+1

* Dart SDK upper constraint raised to declare compatability with Dart 2.0 stable.
Expand Down
5 changes: 3 additions & 2 deletions lib/src/protobuf/coded_buffer_writer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ class CodedBufferWriter {
_writeVarint32(value ? 1 : 0);
break;
case PbFieldType._BYTES_BIT:
_writeBytesNoTag(value);
_writeBytesNoTag(
value is TypedData ? value : new Uint8List.fromList(value));
break;
case PbFieldType._STRING_BIT:
_writeBytesNoTag(_utf8.encode(value));
Expand All @@ -329,7 +330,7 @@ class CodedBufferWriter {
_writeFloat(value);
break;
case PbFieldType._ENUM_BIT:
_writeVarint32(value.value);
_writeVarint32(value.value & 0xffffffff);
break;
case PbFieldType._GROUP_BIT:
value.writeToCodedBufferWriter(this);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: protobuf
version: 0.9.0+1
version: 0.9.1
author: Dart Team <misc@dartlang.org>
description: Runtime library for protocol buffers support.
homepage: https://github.com/dart-lang/protobuf
Expand Down

0 comments on commit fd55da7

Please sign in to comment.