more fixes/tests for empty strings

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9083 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-05-04 04:45:41 +00:00
commit eb5053c631
6 changed files with 80 additions and 3 deletions

View file

@ -43,8 +43,8 @@ SWIGINTERNINLINE SV *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
SV *obj = sv_newmortal();
if (size && carray) {
if (carray[size - 1] == 0) {
if (carray) {
if (size && (carray[size - 1] == 0)) {
sv_setpv(obj, carray);
} else {
char *tmp = %new_array(size + 1, char);

View file

@ -43,7 +43,7 @@ SWIG_From_dec(String)(const String& s)
if (s.size()) {
return SWIG_FromCharPtrAndSize(s.data(), s.size());
} else {
return SWIG_FromCharPtrAndSize(s.c_str(), 1);
return SWIG_FromCharPtrAndSize(s.c_str(), 0);
}
}
}