Fix warnings in Java OUTPUT and INOUT typemaps

This commit is contained in:
William S Fulton 2017-05-14 00:39:08 +01:00
commit a271043555
2 changed files with 33 additions and 5 deletions

View file

@ -185,7 +185,7 @@ public:
void etest() { void etest() {
bool boolarg_inout = false; bool boolarg_inout = false;
signed char signed_chararg_inout = 150; signed char signed_chararg_inout = 111;
unsigned char unsigned_chararg_inout = 150; unsigned char unsigned_chararg_inout = 150;
short shortarg_inout = 150; short shortarg_inout = 150;

View file

@ -220,14 +220,14 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
{ {
JNITYPE $1_jvalue; JNITYPE $1_jvalue;
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
$result = $1_jvalue; $result = ($*1_ltype)$1_jvalue;
} }
%typemap(directorargout, noblock=1) TYPE *OUTPUT %typemap(directorargout, noblock=1) TYPE *OUTPUT
{ {
JNITYPE $1_jvalue; JNITYPE $1_jvalue;
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
*$result = $1_jvalue; *$result = ($*1_ltype)$1_jvalue;
} }
%typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE; %typemap(typecheck) TYPE *OUTPUT = TYPECHECKTYPE;
@ -264,6 +264,21 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
$1 = &temp; $1 = &temp;
} }
%typemap(directorargout, noblock=1) bool &OUTPUT
{
jboolean $1_jvalue;
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
$result = $1_jvalue ? true : false;
}
%typemap(directorargout, noblock=1) bool *OUTPUT
{
jboolean $1_jvalue;
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
*$result = $1_jvalue ? true : false;
}
/* Convert to BigInteger - byte array holds number in 2's complement big endian format */ /* Convert to BigInteger - byte array holds number in 2's complement big endian format */
/* Use first element in BigInteger array for output */ /* Use first element in BigInteger array for output */
/* Overrides the typemap in the OUTPUT_TYPEMAP macro */ /* Overrides the typemap in the OUTPUT_TYPEMAP macro */
@ -386,13 +401,13 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
%typemap(directorargout, noblock=1) TYPE &INOUT %typemap(directorargout, noblock=1) TYPE &INOUT
{ {
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
$result = $1_jvalue; $result = ($*1_ltype)$1_jvalue;
} }
%typemap(directorargout, noblock=1) TYPE *INOUT %typemap(directorargout, noblock=1) TYPE *INOUT
{ {
JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue); JCALL4(Get##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
*$result = $1_jvalue; *$result = ($*1_ltype)$1_jvalue;
} }
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE; %typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
@ -436,6 +451,19 @@ INOUT_TYPEMAP(double, jdouble, double, Double, "[D", jdoubleArray);
JCALL3(ReleaseBooleanArrayElements, jenv, $input , (jboolean *)jbtemp$argnum, 0); JCALL3(ReleaseBooleanArrayElements, jenv, $input , (jboolean *)jbtemp$argnum, 0);
} }
%typemap(directorargout, noblock=1) bool &INOUT
{
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
$result = $1_jvalue ? true : false;
}
%typemap(directorargout, noblock=1) bool *INOUT
{
JCALL4(GetBooleanArrayRegion, jenv, $input, 0, 1, &$1_jvalue);
*$result = $1_jvalue ? true : false;
}
/* Override the typemap in the INOUT_TYPEMAP macro for unsigned long long */ /* Override the typemap in the INOUT_TYPEMAP macro for unsigned long long */
%typemap(in) unsigned long long *INOUT ($*1_ltype temp), unsigned long long &INOUT ($*1_ltype temp) { %typemap(in) unsigned long long *INOUT ($*1_ltype temp), unsigned long long &INOUT ($*1_ltype temp) {
jobject bigint; jobject bigint;