[mapserver-commits] r9139 - branches/branch-5-4/mapserver

svn at osgeo.org svn at osgeo.org
Mon Jul 6 12:23:43 EDT 2009


Author: assefa
Date: 2009-07-06 12:23:43 -0400 (Mon, 06 Jul 2009)
New Revision: 9139

Modified:
   branches/branch-5-4/mapserver/mapogcfilter.c
Log:
Use local function to test value types #3052

Modified: branches/branch-5-4/mapserver/mapogcfilter.c
===================================================================
--- branches/branch-5-4/mapserver/mapogcfilter.c	2009-07-03 22:34:22 UTC (rev 9138)
+++ branches/branch-5-4/mapserver/mapogcfilter.c	2009-07-06 16:23:43 UTC (rev 9139)
@@ -44,16 +44,45 @@
     return (*(int*)a) - (*(int*)b);
 }
 
-static FLTIsNumeric(char *pszValue)
+static int FLTIsNumeric(char *pszValue)
 {
+
     if (pszValue)
     {
+        /*the regex seems to have a problem on windows when mapserver is built using
+          PHP regex. Use custom testing*/
+        int i = 0, nLength=0, bString=0;
+
+        /*
         if (msEvalRegex("[-+]?\\b([0-9]*\\.[0-9]+|[0-9]+)\\b", pszValue) == MS_TRUE)
           return MS_TRUE;
+        */
+        nLength = strlen(pszValue);
+        for (i=0; i<nLength; i++)
+        {
+            if (i == 0)
+            {
+                if (!isdigit(pszValue[i]) &&  pszValue[i] != '-')
+                {
+                     bString = 1;
+                     break;
+                }
+            }
+            else if (!isdigit(pszValue[i]) &&  pszValue[i] != '.')
+            {
+                bString = 1;
+                break;
+            }
+        }
+        if (!bString)
+          return MS_TRUE;
+
+        
     }
 
     return MS_FALSE;
 }
+
 int FLTogrConvertGeometry(OGRGeometryH hGeometry, shapeObj *psShape,
                           OGRwkbGeometryType nType) 
 {



More information about the mapserver-commits mailing list