Fix SF#2564192
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11110 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
648fa408b4
commit
6574067b72
3 changed files with 12 additions and 1 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
Version 1.3.39 (in progress)
|
Version 1.3.39 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2009-02-04: talby
|
||||||
|
[Perl] Fix SF#2564192 reported by David Kolovratnk.
|
||||||
|
SWIG_AsCharPtrAndSize() now handles "get" magic.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 4;
|
use Test::More tests => 5;
|
||||||
BEGIN { use_ok('char_strings') }
|
BEGIN { use_ok('char_strings') }
|
||||||
require_ok('char_strings');
|
require_ok('char_strings');
|
||||||
|
|
||||||
|
|
@ -10,3 +10,6 @@ is(char_strings::CharPingPong($val1), "100", 'cstr1');
|
||||||
my $val2 = "greetings";
|
my $val2 = "greetings";
|
||||||
is(char_strings::CharPingPong($val2), "greetings", 'cstr2');
|
is(char_strings::CharPingPong($val2), "greetings", 'cstr2');
|
||||||
|
|
||||||
|
# SF#2564192
|
||||||
|
"this is a test" =~ /(\w+)$/;
|
||||||
|
is(char_strings::CharPingPong($1), "test", "handles Magical");
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
|
SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
|
||||||
{
|
{
|
||||||
|
if (SvMAGICAL(obj)) {
|
||||||
|
SV *tmp = sv_newmortal();
|
||||||
|
SvSetSV(tmp, obj);
|
||||||
|
obj = tmp;
|
||||||
|
}
|
||||||
if (SvPOK(obj)) {
|
if (SvPOK(obj)) {
|
||||||
STRLEN len = 0;
|
STRLEN len = 0;
|
||||||
char *cstr = SvPV(obj, len);
|
char *cstr = SvPV(obj, len);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue