summaryrefslogtreecommitdiff
path: root/Lib/java
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2012-09-07 06:07:20 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2012-09-07 06:07:20 +0000
commit593c708a78230bdb2fdfe2bd0ed59e39aa14423b (patch)
tree38ac7cdab1248783eed6859f6caae7ee7b4ab5fa /Lib/java
parent2c74c90430fe83529c68de84daacf01c949e5f36 (diff)
downloadswig-593c708a78230bdb2fdfe2bd0ed59e39aa14423b.tar.gz
Fix (char *STRING, size_t LENGTH) typemaps to accept NULL string
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13736 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/java')
-rw-r--r--Lib/java/java.swg9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/java/java.swg b/Lib/java/java.swg
index 794b58d88..6126a55e5 100644
--- a/Lib/java/java.swg
+++ b/Lib/java/java.swg
@@ -1301,11 +1301,16 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
%typemap(javain) (char *STRING, size_t LENGTH) "$javainput"
%typemap(freearg) (char *STRING, size_t LENGTH) ""
%typemap(in) (char *STRING, size_t LENGTH) {
+ if ($input) {
$1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0);
- $2 = (size_t) JCALL1(GetArrayLength, jenv, $input);
+ $2 = (size_t) JCALL1(GetArrayLength, jenv, $input);
+ } else {
+ $1 = 0;
+ $2 = 0;
+ }
}
%typemap(argout) (char *STRING, size_t LENGTH) {
- JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
+ if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
}
%typemap(directorin, descriptor="[B") (char *STRING, size_t LENGTH) {
jbyteArray jb = (jenv)->NewByteArray($2);