]> granicus.if.org Git - postgis/commitdiff
Add clamp_srid internal function returning UNKNOWN for <= 0 values.
authorSandro Santilli <strk@keybit.net>
Thu, 6 Oct 2011 13:35:46 +0000 (13:35 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 6 Oct 2011 13:35:46 +0000 (13:35 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7954 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/liblwgeom_internal.h
liblwgeom/lwutil.c

index 8ac7ce024bcb9f7a9ea0e466b9f8bcb4b323800b..1ee1f7916f7e9ae4977e8ea4b5644f3fff5b2c00 100644 (file)
@@ -1,11 +1,12 @@
 /**********************************************************************
- * $Id: liblwgeom_internal.h 4497 2009-09-14 18:33:54Z pramsey $
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
- * Copyright 2007-2008 Mark Cave-Ayland
- * Copyright 2008 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
+ * Copyright (C) 2007-2008 Mark Cave-Ayland
+ * Copyright (C) 2008 Paul Ramsey <pramsey@cleverelephant.ca>
+ * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
 #define SIZE_SET(varsize, size) (((varsize) & 0x00000003)|(((size) & 0x3FFFFFFF) << 2 ))
 
 
+/*
+ * Return a valid srid from an arbitrary integer,
+ * raising a notice if what comes out is different from
+ * what went in.
+ */
+int clamp_srid(int srid);
+
 /*
 * Internal prototypes
 */
index d47e8bfceba2597d39bfb8a36485ec56c6c3d190..3cf389aa6e6727613edce5662c8fd4ee0c84a872 100644 (file)
@@ -369,3 +369,10 @@ error_if_srid_mismatch(int srid1, int srid2)
                lwerror("Operation on mixed SRID geometries");
        }
 }
+
+int
+clamp_srid(int srid)
+{
+       if ( srid <= 0 ) return SRID_UNKNOWN;
+       return srid;
+}