From: SourceForge.net <no...@so...> - 2007-09-17 20:38:36
|
Patches item #1737640, was opened at 2007-06-15 08:38 Message generated for change (Comment added) made by olly You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=301645&aid=1737640&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Duplicate Priority: 5 Private: No Submitted By: cholland (chollandde) Assigned to: Nobody/Anonymous (nobody) Summary: [perl] perlstrings.swg use sv_setpvn() to handle binary data Initial Comment: Hi, binary data cannot be used in perlstrings.swg SWIG_FromCharPtrAndSize(). I believe the block if (carray[size - 1] == 0) { sv_setpv(obj, carray); } else { char *tmp = %new_array(size + 1, char); memcpy(tmp, carray, size); tmp[size] = 0; sv_setpv(obj, tmp); %delete_array(tmp); } should be substituted by sv_setpvn(obj, carray, size); This works for me. sv_setpv() uses strlen to compute the length of tmp. The real size given by parameter is ignored. sv_setpvn() has a third parameter for the size. See also "Extending and Embedding Perl", Tim Jennes & Simon Cozens, p. 121. Regards Chris ---------------------------------------------------------------------- >Comment By: Olly Betts (olly) Date: 2007-09-17 21:38 Message: Logged In: YES user_id=14972 Originator: NO #1744603 contains an actual patch, testcases, and reports of test results, so closing this bug in favour of that one. ---------------------------------------------------------------------- Comment By: Olly Betts (olly) Date: 2007-06-21 01:08 Message: Logged In: YES user_id=14972 Originator: NO Please don't just bump up the priority arbitrarily. If you want to increase the chance that somebody with SWIG/Perl knowledge looks at your report sooner, I'd suggest attaching a patch for your proposed change rather than trying to describe it (generate a patch with "diff -ru ORIGINAL_SWIG_TREE PATCHED_SWIG_TREE > patchfile"). Also, run the SWIG testsuite (make check-perl5-test-suite) with and without your patch - if all the tests which passed before still pass, say so in the report. Also say if it fixes any tests which failed before! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=301645&aid=1737640&group_id=1645 |