Index: lib/protobuf.dart |
diff --git a/lib/protobuf.dart b/lib/protobuf.dart |
index f1e55cd21534cb6604e5d7a8a2d2a4e76460a555..d74c9c8b813b52e8f66dd75c7d847f5c3363906c 100644 |
--- a/lib/protobuf.dart |
+++ b/lib/protobuf.dart |
@@ -26,6 +26,15 @@ part 'src/protobuf/unknown_field_set.dart'; |
part 'src/protobuf/utils.dart'; |
part 'src/protobuf/wire_format.dart'; |
+// TODO(sra): Remove this method when clients upgrade to protoc 0.3.5 |
Int64 makeLongInt(int n) => new Int64(n); |
+// TODO(sra): Use Int64.parse() when available - see http://dartbug.com/21915. |
+Int64 parseLongInt(String text) { |
+ if (text.startsWith('0x')) return Int64.parseHex(text.substring(2)); |
+ if (text.startsWith('+0x')) return Int64.parseHex(text.substring(3)); |
+ if (text.startsWith('-0x')) return -Int64.parseHex(text.substring(3)); |
+ return Int64.parseInt(text); |
+} |
+ |
const _UTF8 = const Utf8Codec(allowMalformed: true); |