[Pkg-libvirt-commits] [libguestfs] 06/16: java: Use correct Set*Field JNI accessors to set fields of the appropriate type.
Hilko Bengen
bengen at moszumanska.debian.org
Sun Mar 9 11:21:32 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch experimental
in repository libguestfs.
commit dff35285e491d1905d38c90d83fed98932cbc3b3
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Fri Mar 7 14:34:55 2014 +0000
java: Use correct Set*Field JNI accessors to set fields of the appropriate type.
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";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list