[mapserver-users] Re: perl errorObj

Andy Colson andy at squeakycode.net
Tue May 1 10:56:27 PDT 2012


Done.

https://github.com/mapserver/mapserver/issues/4305

I couldn't figure out how to add labels, and I can't seem to edit it. 
Hope that's ok.

Thanks!

-Andy


On 5/1/2012 12:44 PM, Lime, Steve D (DNR) wrote:
> Hi Andy: We need you to create an issue here https://github.com/mapserver/mapserver/issues and we can go from there...
>
> Steve
>
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Andy Colson
> Sent: Tuesday, May 01, 2012 10:47 AM
> To: mapserver-users
> Subject: [mapserver-users] Re: perl errorObj
>
> On 5/1/2012 8:50 AM, Andy Colson wrote:
>> I have noticed a problem with the errorObj
>> mapserver/mapscript/swig/perl object.
>>
>> Its treated as an array, the generated code to get the message looks
>> like this:
>>
>> arg1 = (errorObj *)(argp1);
>> result = (char *)(char *) ((arg1)->message); { size_t size = 2048;
>>
>> while (size&&  (result[size - 1] == '\0')) --size;
>>
>> ST(argvi) = SWIG_FromCharPtrAndSize(result, size); argvi++ ; }
>>
>> When I log errors:
>> my $errObj = new mapscript::errorObj(); while ($errObj) { $s .=
>> "ERROR: $errObj->{code}:$errObj->{message}:$errObj->{routine}<br>";
>> $errObj = $errObj->next();
>> }
>>
>> I get the message, but then huge amounts of garbage data as well.
>>
>>
>> In plmodule.i I tried to add a typemap:
>>
>> %typemap(memberout) char[ANY] {
>> $result = newSVpvn($1, strlen($1));
>> argvi++;
>> }
>>
>>
>> But it doesn't seem to work, the generated code is exactly the same as
>> it was before. (I'm new to mapscript and swig, so I'm just guessing)
>>
>> Any help or hints on how I might fix this?
>>
>> Thanks,
>>
>> -Andy
>
>
> Ok, this works:
>
> %typemap(out) char[ANY] {
> 	$result = newSVpvn($1, strlen($1));
> 	argvi++;
> }
>
> I was worried about it changing too much code, but after looking at the generated mapscript_wrap.c, it looks fine by me.  I also tested it on my test box and it reports errors much much better.
>
> I'm going to put this on my live site and run it for a while.
>
> Are there any -dev's on this list?  I'm not subscribed to mapserver-dev, I'm hoping I can post this here and a dev can verify its ok and add it to plmodule.i.
>
> Pretty please?
>
> -Andy
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>




More information about the MapServer-users mailing list