]> granicus.if.org Git - postgis/commitdiff
Binary WKB input function built only when USE_VERSION > 73. Making some modifications...
authorSandro Santilli <strk@keybit.net>
Mon, 8 Dec 2003 17:57:36 +0000 (17:57 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 8 Dec 2003 17:57:36 +0000 (17:57 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@402 b70326c6-7e19-0410-871a-916f4a2858ee

postgis_inout.c

index 4d37d4b8869d8a3e376cf160a65a8dd8f08d0fe9..4ec651de6a1690fd25fcca233ab5a86e5a3d5950 100644 (file)
@@ -11,6 +11,9 @@
  *
  **********************************************************************
  * $Log$
+ * Revision 1.30  2003/12/08 17:57:36  strk
+ * Binary WKB input function built only when USE_VERSION > 73. Making some modifications based on reported failures
+ *
  * Revision 1.29  2003/11/28 11:06:49  strk
  * Added WKB_recv function for binary WKB input
  *
@@ -76,6 +79,9 @@
 
 
 #include "postgis.h"
+#if USE_VERSION > 73
+# include "lib/stringinfo.h" // for WKB binary input
+#endif
 #include "utils/elog.h"
 
 
@@ -3539,16 +3545,22 @@ Datum WKB_out(PG_FUNCTION_ARGS)
 }
 
 
+#if USE_VERSION > 73
 PG_FUNCTION_INFO_V1(WKB_recv);
 Datum WKB_recv(PG_FUNCTION_ARGS)
 {
-       bytea *in = (bytea *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
+       StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
         WellKnownBinary *result;
 
-       result = (WellKnownBinary *) palloc(in->vl_len);
-       memcpy(result, in, in->vl_len);
+       elog(NOTICE, "WKB_recv start");
+
+       result = (WellKnownBinary *)palloc(buf->len);
+       memcpy(result, buf->data, buf->len);
+
+       elog(NOTICE, "WKB_recv end (returning result)");
         PG_RETURN_POINTER(result);
 }
+#endif
 
 PG_FUNCTION_INFO_V1(WKBtoBYTEA);
 Datum WKBtoBYTEA(PG_FUNCTION_ARGS)