[mapserver-dev] classObj.setText, text must be quoted

Umberto Nicoletti umberto.nicoletti at gmail.com
Wed Feb 22 03:09:20 EST 2012


Then that is probably also the cause for issue

http://trac.osgeo.org/mapserver/ticket/3983

where unfortunately there seem to be also a segfault.

Umberto

On Wed, Feb 22, 2012 at 2:01 AM, Lime, Steve D (DNR) <Steve.Lime at state.mn.us
> wrote:

>  In 6.0 class->text is a true expressionObj, not a string as in previous
> versions so at least via SWIG setText() calls msLoadExpressionString(). I
> think there could be a bug in that function at line 2169 (in trunk). Older
> versions of that function treat the input string as a the expression if
> parsing doesn't detect a delimited type. So does this version but in a
> different way:
>
> // trunk
>     exp->type = MS_STRING;
>     exp->string = msStrdup(msyystring_buffer);
>
> // 5.6 branch
>     exp->type = MS_STRING;
>     if((strlen(value) - strlen(msyytext)) == 2)
>       exp->string = strdup(msyytext); /* value was quoted */
>     else
>       exp->string = strdup(value); /* use the whole value */
>
> I've got a feeling this has to do with escaping quotes where
> msyystring_buffer contains the escaped text. Perhaps we could do something
> like:
>
>     exp->type = MS_STRING;
>     if(... if first char in value is not a single or double quote ...)
>         exp->string = strdup(value);  /* use the whole value */
>     else
>         exp->string = msStrdup(msyystring_buffer);
>
> Alan, does this make sense or is there another way to know that escaping
> was processed?
>
> Steve
>
>  ------------------------------
> *From:* mapserver-dev-bounces at lists.osgeo.org [
> mapserver-dev-bounces at lists.osgeo.org] on behalf of Tamas Szekeres [
> szekerest at gmail.com]
> *Sent:* Tuesday, February 21, 2012 4:09 PM
> *To:* mapserver-dev at lists.osgeo.org
> *Subject:* [mapserver-dev] classObj.setText, text must be quoted
>
>  Hi Devs,
>
>  By using the following mapscript example:
>
>       *// creating a new map from scratch*
> *      mapObj map = new mapObj(null);*
> *      // adding a layer*
> *      layerObj layer = new layerObj(map);*
> *      // define the class*
> *      classObj classobj = new classObj(layer);*
> * classobj.setText("Sample Text");*
> *      Console.WriteLine("Sample Text -> " + classobj.getTextString());*
> * classobj.setText("Sample T");*
> *      Console.WriteLine("Sample T -> " + classobj.getTextString());*
> * classobj.setText("\"Sample T\"");*
> *      Console.WriteLine("\"Sample T\" -> " + classobj.getTextString());*
>
>  I got the following output (from trunk):
>
>  Sample Text -> "Sample Text"
> Sample T -> "Sample"
> "Sample T" -> "Sample T"
>
>
>  6.0 branch produces this:
>
>  Sample Text -> "Sample"
> Sample T -> "Sample"
> "Sample T" -> "Sample T"
>
>  Do we have a requirement that the texts must be quoted which is passed
> to *classobj.setText?*
>
>  Best regards,
>
>  Tamas
>
>
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20120222/ae147351/attachment.html


More information about the mapserver-dev mailing list