[postgis-commits] svn - r3615 - spike/wktraster/rt_core

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Mon Feb 2 09:58:38 PST 2009


Author: strk
Date: 2009-02-02 09:58:38 -0800 (Mon, 02 Feb 2009)
New Revision: 3615

Modified:
   spike/wktraster/rt_core/rt_api.c
   spike/wktraster/rt_core/testwkb.c
Log:
don't use strdup, or the contextual allocators would not be used for that

Modified: spike/wktraster/rt_core/rt_api.c
===================================================================
--- spike/wktraster/rt_core/rt_api.c	2009-02-02 17:33:48 UTC (rev 3614)
+++ spike/wktraster/rt_core/rt_api.c	2009-02-02 17:58:38 UTC (rev 3615)
@@ -257,7 +257,7 @@
 
 struct rt_extband_t {
     uint8_t bandNum;
-    const char* path; /* externally owned ? */
+    char* path; /* externally owned ? */
 };
 
 struct rt_band_t {
@@ -1655,7 +1655,12 @@
         }
 
         band->ownsData = 1;
-        band->data.offline.path = strdup((char*)*ptr);
+	{
+		size_t pathlen = strlen((char*)*ptr);
+        	band->data.offline.path = ctx->alloc(pathlen+1);
+		memcpy(band->data.offline.path, *ptr, pathlen);
+		band->data.offline.path[pathlen] = '\0';
+	}
         *ptr += sz;
         return band;
     }

Modified: spike/wktraster/rt_core/testwkb.c
===================================================================
--- spike/wktraster/rt_core/testwkb.c	2009-02-02 17:33:48 UTC (rev 3614)
+++ spike/wktraster/rt_core/testwkb.c	2009-02-02 17:58:38 UTC (rev 3615)
@@ -19,6 +19,8 @@
     ctx = rt_context_new(0, 0, 0);
 
     /* ------------------------------------------------------ */
+    /* No bands, 7x8 - little endian                          */
+    /* ------------------------------------------------------ */
 
     hexwkb =
 "01"               /* little endian (uint8 ndr) */
@@ -61,6 +63,8 @@
 */
 
     /* ------------------------------------------------------ */
+    /* No bands, 7x8 - big endian                             */
+    /* ------------------------------------------------------ */
 
     hexwkb =
 "00"               /* big endian (uint8 xdr) */
@@ -101,6 +105,8 @@
 */
 
     /* ------------------------------------------------------ */
+    /* 1x1, little endian, band0(1bb)                         */
+    /* ------------------------------------------------------ */
 
     hexwkb =
 "01"               /* little endian (uint8 ndr) */
@@ -150,6 +156,8 @@
 */
 
     /* ------------------------------------------------------ */
+    /* 3x2, big endian, band0(8BSI)                           */
+    /* ------------------------------------------------------ */
 
     hexwkb =
 "01"               /* little endian (uint8 ndr) */
@@ -209,6 +217,8 @@
 */
 
     /* ------------------------------------------------------ */
+    /* 3x2, little endian, band0(16BSI)                       */
+    /* ------------------------------------------------------ */
 
     hexwkb =
 "01"               /* little endian (uint8 ndr) */
@@ -269,6 +279,8 @@
 
 
     /* ------------------------------------------------------ */
+    /* 3x2, big endian, band0(16BSI)                          */
+    /* ------------------------------------------------------ */
 
     hexwkb =
 "00"               /* big endian (uint8 xdr) */



More information about the postgis-commits mailing list