The default out typemap for char[ANY] now returns up to a zero byte, or the end

of the array if there is no zero byte.  This is the same as Python does, and seems
more generally useful than the previous behaviour of returning the whole
contents of the array including any zero bytes.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11176 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2009-03-30 02:22:14 +00:00
commit 64843143f1
2 changed files with 13 additions and 5 deletions

View file

@ -233,9 +233,11 @@
%typemap(out) void "";
%typemap(out) char [ANY]
%{
RETVAL_STRINGL($1,$1_dim0,1);
%}
{
int len = 0;
while (len < $1_dim0 && $1[len]) ++len;
RETVAL_STRINGL($1, len, 1);
}
// This typecheck does hard checking for proper argument type. If you want
// an argument to be converted from a different PHP type, you must convert