Make (char*, size_t) typemap usable for strings of other types in Java.

Notably it now works for "unsigned char*" strings.

Add a test to check that it now works in Java and also showing that it already
worked for the other languages with support for this typemap.
This commit is contained in:
Vadim Zeitlin 2015-08-06 00:10:51 +02:00
commit a1bddd56eb
7 changed files with 37 additions and 3 deletions

View file

@ -5,12 +5,16 @@ A test case for testing non null terminated char pointers.
%module char_binary
%apply (char *STRING, size_t LENGTH) { (const char *str, size_t len) }
%apply (char *STRING, size_t LENGTH) { (const unsigned char *str, size_t len) }
%inline %{
struct Test {
size_t strlen(const char *str, size_t len) {
return len;
}
size_t ustrlen(const unsigned char *str, size_t len) {
return len;
}
};
typedef char namet[5];