diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 4738f51f8ace7819c032d750d8700d1aeeb84aaf..0772fd6719b1315fa42f0259c8559490fc8711f3 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -36,3 +36,5 @@ Maven packaging: Non-Google patch contributors: Kevin Ko <kevin.s.ko@gmail.com> + Johan Euphrosine <proppy@aminche.com> + Ulrich Kunitz <kune@deine-taler.de> diff --git a/python/google/protobuf/internal/output_stream.py b/python/google/protobuf/internal/output_stream.py index 767e97259e514c293598e0ecd1b7b3c47220ac1b..ccb91225eb696cbd315cd00e7e3e1b8e8ee04630 100755 --- a/python/google/protobuf/internal/output_stream.py +++ b/python/google/protobuf/internal/output_stream.py @@ -101,11 +101,10 @@ class OutputStream(object): while True: bits = unsigned_value & 0x7f unsigned_value >>= 7 - if unsigned_value: - bits |= 0x80 - self._buffer.append(bits) if not unsigned_value: + self._buffer.append(bits) break + self._buffer.append(0x80|bits) def ToString(self): """Returns a string containing the bytes in our internal buffer.""" diff --git a/python/google/protobuf/internal/wire_format.py b/python/google/protobuf/internal/wire_format.py index 69aa4abffc1f4a80b3288413a0361c2ad5319800..ea219e27aa61e61971584106f59fa23dc995eaad 100755 --- a/python/google/protobuf/internal/wire_format.py +++ b/python/google/protobuf/internal/wire_format.py @@ -87,7 +87,7 @@ def ZigZagEncode(value): """ if value >= 0: return value << 1 - return ((value << 1) ^ (~0)) | 0x1 + return (value << 1) ^ (~0) def ZigZagDecode(value):