Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/5000

Change subject: misc: Fix the indentation in DecodeVarint in util/protolib.py.
......................................................................

misc: Fix the indentation in DecodeVarint in util/protolib.py.

The DecodeVarint was, as a comment describes, lifted from
google.protobuf.internal.decoder. Unfortunately, the relative indentation of
some lines was changed, changing what scope they fell under. This changed the
behavior of the function, breaking it for multibyte and negative values.

This change restores the correct indentation and fixes the function's
behavior.

Change-Id: If645649506b0fe5a617b37a8202c9ca1c57aaf15
---
M util/protolib.py
1 file changed, 4 insertions(+), 4 deletions(-)



diff --git a/util/protolib.py b/util/protolib.py
index 47ac876..c8c6d0c 100644
--- a/util/protolib.py
+++ b/util/protolib.py
@@ -123,10 +123,10 @@
                 result |= ~mask
             else:
                 result &= mask
-                return (result, pos)
-            shift += 7
-            if shift >= 64:
-                raise IOError('Too many bytes when decoding varint.')
+            return (result, pos)
+        shift += 7
+        if shift >= 64:
+            raise IOError('Too many bytes when decoding varint.')

 def decodeMessage(in_file, message):
     """

--
To view, visit https://gem5-review.googlesource.com/5000
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If645649506b0fe5a617b37a8202c9ca1c57aaf15
Gerrit-Change-Number: 5000
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to