jna/jna-stringarray-return.patch
2008-10-15 05:08:44 +00:00

27 lines
1.1 KiB
Diff

diff -ur jna-3.0.4-svn729/src/com/sun/jna/Function.java jna-3.0.4-svn729.orig/src/com/sun/jna/Function.java
--- jna-3.0.4-svn729/src/com/sun/jna/Function.java 2008-10-14 19:47:44.000000000 -0400
+++ jna-3.0.4-svn729.orig/src/com/sun/jna/Function.java 2008-10-14 19:48:00.000000000 -0400
@@ -314,6 +314,20 @@
String s = invokeString(callingConvention, args, true);
result = s != null ? new WString(s) : null;
}
+ else if (returnType == String[].class) {
+ Pointer tmp = invokePointer(callingConvention, args);
+ if (tmp != null)
+ result = tmp.getStringArray(0);
+ else
+ result = null;
+ }
+ else if (returnType == WString[].class) {
+ Pointer tmp = invokePointer(callingConvention, args);
+ if (tmp != null)
+ result = tmp.getStringArray(0, true);
+ else
+ result = null;
+ }
else if (Pointer.class.isAssignableFrom(returnType)) {
result = invokePointer(callingConvention, args);
}
Only in jna-3.0.4-svn729.orig/src/com/sun/jna: Function.java~
Only in jna-3.0.4-svn729/src/com/sun/jna: Function.java.nativemapped-array