Fix for handling strings with zero bytes from Stephen Hutsal.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9387 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-10-03 08:59:19 +00:00
commit 4e9e588769
2 changed files with 5 additions and 1 deletions

View file

@ -19,7 +19,8 @@ double SwigSvToNumber(SV* sv) {
}
std::string SwigSvToString(SV* sv) {
STRLEN len;
return SvPV(sv,len);
char *ptr = SvPV(sv, len);
return std::string(ptr, len);
}
void SwigSvFromString(SV* sv, const std::string& s) {
sv_setpvn(sv,s.data(),s.size());