Fix OCAML typemap warnings wrapping C code

Fixes:
Lib/ocaml/typemaps.i:366: Warning 453: Can't apply (SWIGTYPE &). No typemaps are defined.
Lib/ocaml/typemaps.i:367: Warning 453: Can't apply (SWIGTYPE &&). No typemaps are defined.
Lib/ocaml/typemaps.i:372: Warning 453: Can't apply (SWIGTYPE &). No typemaps are defined.
This commit is contained in:
William S Fulton 2019-01-11 19:31:37 +00:00
commit d6cd52f586

View file

@ -27,7 +27,16 @@
$result = caml_val_ptr($1,$descriptor); $result = caml_val_ptr($1,$descriptor);
} }
#ifdef __cplusplus %typemap(in) char *& (char *temp) {
/* %typemap(in) char *& */
temp = (char*)caml_val_ptr($1,$descriptor);
$1 = &temp;
}
%typemap(argout) char *& {
/* %typemap(argout) char *& */
swig_result = caml_list_append(swig_result,caml_val_string_len(*$1, strlen(*$1)));
}
%typemap(in) SWIGTYPE & { %typemap(in) SWIGTYPE & {
/* %typemap(in) SWIGTYPE & */ /* %typemap(in) SWIGTYPE & */
@ -105,6 +114,8 @@
$1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ; $1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ;
} }
#ifdef __cplusplus
%typemap(out) SWIGTYPE { %typemap(out) SWIGTYPE {
/* %typemap(out) SWIGTYPE */ /* %typemap(out) SWIGTYPE */
$&1_ltype temp = new $ltype((const $1_ltype &) $1); $&1_ltype temp = new $ltype((const $1_ltype &) $1);
@ -116,23 +127,8 @@
} }
} }
%typemap(in) char *& (char *temp) {
/* %typemap(in) char *& */
temp = (char*)caml_val_ptr($1,$descriptor);
$1 = &temp;
}
%typemap(argout) char *& {
/* %typemap(argout) char *& */
swig_result = caml_list_append(swig_result,caml_val_string_len(*$1, strlen(*$1)));
}
#else #else
%typemap(in) SWIGTYPE {
$1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ;
}
%typemap(out) SWIGTYPE { %typemap(out) SWIGTYPE {
/* %typemap(out) SWIGTYPE */ /* %typemap(out) SWIGTYPE */
void *temp = calloc(1,sizeof($ltype)); void *temp = calloc(1,sizeof($ltype));
@ -145,9 +141,6 @@
} }
} }
%apply SWIGTYPE { const SWIGTYPE & };
%apply SWIGTYPE { const SWIGTYPE && };
#endif #endif
/* The SIMPLE_MAP macro below defines the whole set of typemaps needed /* The SIMPLE_MAP macro below defines the whole set of typemaps needed