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

Tamas Szekeres szekerest at gmail.com
Wed Feb 22 10:13:58 EST 2012


Checking the first character instead of the length would be a good solution
for MapServer 6.0 and the earlier versions. But I'm not sure how this would
solve the same problem in trunk. Actually when getSymbol is failing we can
obtain only a truncated text from msyytext/msyystring so we cannot use this
to assign the value to the corresponding property. We should probably find
out the reason why  msyytext/msyystring is truncated in this case or use
the "value" argument of loadExpressionString instead. Does this make sense?

Best regards,

Tamas



2012/2/22 Lime, Steve D (DNR) <Steve.Lime at state.mn.us>

>  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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20120222/292c1c4d/attachment.html


More information about the mapserver-dev mailing list