From 62949e02e3d8ee8dafd3f640e51d462cb8bd049d Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 3 Oct 2006 08:59:19 +0000 Subject: [PATCH] Fix for handling strings with zero bytes from Stephen Hutsal. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9387 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/CHANGES.current | 3 +++ SWIG/Lib/perl5/std_common.i | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/SWIG/CHANGES.current b/SWIG/CHANGES.current index 9811978bb..bf1de87f3 100644 --- a/SWIG/CHANGES.current +++ b/SWIG/CHANGES.current @@ -1,6 +1,9 @@ Version 1.3.30 (in progress) ============================ +10/03/2006: olly + [Perl] Fix for handling strings with zero bytes from Stephen Hutsal. + 09/30/2006: efuzzyone [CFFI] Bitfield support and vararg support due to Arthur Smyles. C expression to Lisp conversion, thanks to Arthur Smyles for the initial diff --git a/SWIG/Lib/perl5/std_common.i b/SWIG/Lib/perl5/std_common.i index b3e0b9b31..bc25b353f 100644 --- a/SWIG/Lib/perl5/std_common.i +++ b/SWIG/Lib/perl5/std_common.i @@ -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());