Using the wrong accessors (somehow - I have no idea how) caused other
fields in the struct to contain incorrect values.
---
generator/java.ml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/generator/java.ml b/generator/java.ml
index cce1758..e9c5949 100644
--- a/generator/java.ml
+++ b/generator/java.ml
@@ -1146,13 +1146,13 @@ and generate_java_struct_return typ jtyp cols =
pr " (*env)->SetLongField (env, jr, fl, r->%s);\n" name;
| name, (FUInt32|FInt32) ->
pr " fl = (*env)->GetFieldID (env, cl, \"%s\",
\"I\");\n" name;
- pr " (*env)->SetLongField (env, jr, fl, r->%s);\n" name;
+ pr " (*env)->SetIntField (env, jr, fl, r->%s);\n" name;
| name, FOptPercent ->
pr " fl = (*env)->GetFieldID (env, cl, \"%s\",
\"F\");\n" name;
pr " (*env)->SetFloatField (env, jr, fl, r->%s);\n" name;
| name, FChar ->
pr " fl = (*env)->GetFieldID (env, cl, \"%s\",
\"C\");\n" name;
- pr " (*env)->SetLongField (env, jr, fl, r->%s);\n" name;
+ pr " (*env)->SetCharField (env, jr, fl, r->%s);\n" name;
) cols;
pr " free (r);\n";
pr " return jr;\n"
@@ -1201,11 +1201,11 @@ and generate_java_struct_list_return typ jtyp cols =
| FBytes|FUInt64|FInt64 ->
pr " (*env)->SetLongField (env, jfl, fl, r->val[i].%s);\n"
name;
| FUInt32|FInt32 ->
- pr " (*env)->SetLongField (env, jfl, fl, r->val[i].%s);\n"
name;
+ pr " (*env)->SetIntField (env, jfl, fl, r->val[i].%s);\n"
name;
| FOptPercent ->
pr " (*env)->SetFloatField (env, jfl, fl, r->val[i].%s);\n"
name;
| FChar ->
- pr " (*env)->SetLongField (env, jfl, fl, r->val[i].%s);\n"
name;
+ pr " (*env)->SetCharField (env, jfl, fl, r->val[i].%s);\n"
name;
) cols;
pr "\n";
pr " (*env)->SetObjectArrayElement (env, jr, i, jfl);\n";
--
1.8.5.3