diff options
author | Darren Krahn <dkrahn@google.com> | 2016-05-27 18:32:44 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-05-27 18:32:44 +0000 |
commit | 8c5f3147449e55820ca2ae6b4f37cce8d46ecab7 (patch) | |
tree | 7153082e193471f49293a513d40163e2b2eaa856 | |
parent | 32bc9e3f587b593892683b8f130f278bcbb59c9a (diff) | |
parent | 1d7ce51f7e3aabac3469795055289e5c2bc7d45b (diff) | |
download | tpm-8c5f3147449e55820ca2ae6b4f37cce8d46ecab7.tar.gz |
Multiple fixes for the proto_print code generator. am: c3fcde6097
am: 1d7ce51f7e
* commit '1d7ce51f7e3aabac3469795055289e5c2bc7d45b':
Multiple fixes for the proto_print code generator.
Change-Id: If4ec8fdf3bf7c8256a73845d2d8c04f1d54ce4e4
-rwxr-xr-x | attestation/common/proto_print.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/attestation/common/proto_print.py b/attestation/common/proto_print.py index 63cffe6..bfe0d9b 100755 --- a/attestation/common/proto_print.py +++ b/attestation/common/proto_print.py @@ -123,7 +123,7 @@ def ParseProto(input_file): current_message_stack = [] current_enum = None package_re = re.compile(r'package\s+(\w+);') - import_re = re.compile(r'import\s+"(\w+).proto";') + import_re = re.compile(r'import\s+"([\w]*/)*(\w+).proto";') message_re = re.compile(r'message\s+(\w+)\s*{') field_re = re.compile(r'(optional|required|repeated)\s+(\w+)\s+(\w+)\s*=') enum_re = re.compile(r'enum\s+(\w+)\s*{') @@ -174,7 +174,7 @@ def ParseProto(input_file): # Look for an import statement. match = import_re.search(line) if match: - imports.append(match.group(1)) + imports.append(match.group(2)) return package, imports, messages, enums @@ -352,6 +352,9 @@ std::string GetProtoDebugStringWithIndent(const %(name)s& value, repeated_field = """ output += indent + " %(name)s: {"; for (int i = 0; i < value.%(name)s_size(); ++i) { + if (i > 0) { + base::StringAppendF(&output, ", "); + } base::StringAppendF(&output, %(format)s); } output += "}\\n";""" @@ -360,8 +363,8 @@ std::string GetProtoDebugStringWithIndent(const %(name)s& value, formats = {'bool': '"%%s", %(value)s ? "true" : "false"', 'int32': '"%%d", %(value)s', 'int64': '"%%ld", %(value)s', - 'uint32': '"%%u", %(value)s', - 'uint64': '"%%lu", %(value)s', + 'uint32': '"%%u (0x%%08X)", %(value)s, %(value)s', + 'uint64': '"%%lu (0x%%016X)", %(value)s, %(value)s', 'string': '"%%s", %(value)s.c_str()', 'bytes': """"%%s", base::HexEncode(%(value)s.data(), %(value)s.size()).c_str()"""} |