Skip to content

Commit 4b3909f

Browse files
committed
Java: Fix swig mapping for functions returning uint32_t
1 parent b1e8acd commit 4b3909f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/swig_java/swig_gasdk.i

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,16 @@ LOCALFUNC jbyteArray create_array(JNIEnv *jenv, const unsigned char* p, size_t l
382382
$1 = uint32_cast(jenv, $input);
383383
}
384384

385+
/* uint32_t output pointer arguments are returned as the function return value */
386+
%typemap(in,noblock=1,numinputs=0) uint32_t* (uint32_t val32_out = 0) {
387+
$1 = ($1_ltype)&val32_out;
388+
}
389+
%typemap(argout,noblock=1) (uint32_t*) {
390+
if (!(*jenv)->ExceptionOccurred(jenv)) {
391+
$result = *$1;
392+
}
393+
}
394+
385395
/* uint64_t input arguments are taken as longs and cast unchecked. This means
386396
* callers need to take care with treating negative values correctly */
387397
%typemap(in) uint64_t {

0 commit comments

Comments
 (0)