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
This commit is contained in:
parent
2c74c90430
commit
593c708a78
4 changed files with 28 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue