[mapguide-commits] r5013 - trunk/MgDev/Common/Stylization
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Jul 8 18:24:16 EDT 2010
Author: waltweltonlair
Date: 2010-07-08 22:24:16 +0000 (Thu, 08 Jul 2010)
New Revision: 5013
Modified:
trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp
Log:
Fix a parsing error in the IsLiteral method in SE_ExpressionBase. The method
is used to determine if a supplied string is surrounded by a matching pair of
single quotes (e.g. 'Value'). It failed, however, to recognize the case of
''' (three single quotes). While this doesn't result in any downstream crashes,
it does mean the ''' string will be misinterpreted as an expression, and then
when the expression engine tries to evaluate it you'll get some annoying (but
gracefully handled) exceptions.
Modified: trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp 2010-07-08 17:22:42 UTC (rev 5012)
+++ trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp 2010-07-08 22:24:16 UTC (rev 5013)
@@ -345,16 +345,19 @@
// string must start with a single quote
if (*str++ == sExprSingleQuote)
{
- while (*str != L'\0' && *str != sExprSingleQuote)
- str++;
+ // make sure we have at least one more character
+ if (*str++ == L'\0')
+ return false;
+ // move to the end of the string
+ while (*str++ != L'\0');
+
+ // back up one character
+ str--;
+
// string must have a matching closing single quote
- if (*str++ == sExprSingleQuote)
- {
- // closing single quote must be the last character of the string
- if (*str == L'\0')
- return true;
- }
+ if (*str == sExprSingleQuote)
+ return true;
}
return false;
More information about the mapguide-commits
mailing list