[libvirt] [libvirt-java] [PATCH 10/65] Fix wrapping of native size_t data type

Daniel P. Berrange berrange at redhat.com
Fri Feb 21 10:37:36 UTC 2014


On Thu, Feb 13, 2014 at 04:22:18PM +0100, Claudio Bley wrote:
> Libvirt function parameters having type (pointer to) size_t were
> wrapped via JNA using int, long or even NativeLong. Alas, none of
> these is actually correct as the size of size_t may be the same as the
> size of either (unsigned) int, long or even long long on different
> platforms.
> 
> JNA provides the size of a native size_t to us, so using this
> information we define and use class SizeT and class SizeTByReference for
> wrapping a native size_t and size_t*, respectively.
> 
> Signed-off-by: Claudio Bley <cbley at av-test.de>
> ---
>  src/main/java/org/libvirt/Domain.java              |    5 +-
>  src/main/java/org/libvirt/Secret.java              |   10 ++--
>  src/main/java/org/libvirt/Stream.java              |    7 ++-
>  src/main/java/org/libvirt/jna/Libvirt.java         |   14 +++---
>  src/main/java/org/libvirt/jna/SizeT.java           |   19 ++++++++
>  .../java/org/libvirt/jna/SizeTByReference.java     |   50 ++++++++++++++++++++
>  6 files changed, 87 insertions(+), 18 deletions(-)
>  create mode 100644 src/main/java/org/libvirt/jna/SizeT.java
>  create mode 100644 src/main/java/org/libvirt/jna/SizeTByReference.java

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list