Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1614)

Unified Diff: mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl

Issue 484983003: Mojo: Fix warnings when generating code for empty struct in java. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Follow review. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/interfaces/bindings/tests/test_structs.mojom ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl b/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
index 623fa094777e354080b5233bd513f20cd451a58b..c878e026644537dcabae9854db51fddd732812ed 100644
--- a/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
@@ -78,7 +78,11 @@ if (decoder{{level+1}} == null) {
return null;
}
{{struct|name}} result = new {{struct|name}}();
+{% if not struct.bytes %}
+ decoder0.readDataHeader();
+{% else %}
DataHeader mainDataHeader = decoder0.readDataHeader();
+{% endif %}
{% for byte in struct.bytes %}
{% for packed_field in byte.packed_fields %}
if (mainDataHeader.numFields > {{packed_field.ordinal}}) {
@@ -91,7 +95,11 @@ if (decoder{{level+1}} == null) {
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
+{% if not struct.bytes %}
+ encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
+{% else %}
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
+{% endif %}
{% for byte in struct.bytes %}
{% for packed_field in byte.packed_fields %}
{{encode(packed_field.field|name, packed_field.field.kind, 8+packed_field.offset, packed_field.bit)|indent(8)}}
« no previous file with comments | « mojo/public/interfaces/bindings/tests/test_structs.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698