]> granicus.if.org Git - postgis/commitdiff
#2931, BOX representation is case sensitive
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 17 Sep 2014 17:13:23 +0000 (17:13 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 17 Sep 2014 17:13:23 +0000 (17:13 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12982 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_box.c

index e81cb72a7e7a0551df9c900ede45026ff8d06e40..8f0bab74aa6d623078de4998c678686a4105ce37 100644 (file)
@@ -48,15 +48,21 @@ Datum BOX2D_in(PG_FUNCTION_ARGS)
        int nitems;
        double tmp;
        GBOX box;
+       int i;
        
        gbox_init(&box);
 
-       if (strstr(str,"BOX(") !=  str )
+       if (strcasestr(str,"BOX(") !=  str )
        {
                elog(ERROR,"box2d parser - doesnt start with BOX(");
                PG_RETURN_NULL();
        }
-       nitems = sscanf(str,"BOX(%lf %lf,%lf %lf)", &box.xmin, &box.ymin, &box.xmax, &box.ymax);
+       
+       for(i = 0; str[i]; i++) {
+         str[i] = tolower(str[i]);
+       }
+       
+       nitems = sscanf(str,"box(%lf %lf,%lf %lf)", &box.xmin, &box.ymin, &box.xmax, &box.ymax);
        if (nitems != 4)
        {
                elog(ERROR,"box2d parser - couldnt parse.  It should look like: BOX(xmin ymin,xmax ymax)");