[postgis-tickets] r15927 - Mark twkb input buffers as const

Paul Ramsey pramsey at cleverelephant.ca
Fri Oct 6 15:00:40 PDT 2017


Author: pramsey
Date: 2017-10-06 15:00:40 -0700 (Fri, 06 Oct 2017)
New Revision: 15927

Modified:
   trunk/liblwgeom/liblwgeom.h.in
   trunk/liblwgeom/lwin_twkb.c
Log:
Mark twkb input buffers as const


Modified: trunk/liblwgeom/liblwgeom.h.in
===================================================================
--- trunk/liblwgeom/liblwgeom.h.in	2017-10-06 21:49:20 UTC (rev 15926)
+++ trunk/liblwgeom/liblwgeom.h.in	2017-10-06 22:00:40 UTC (rev 15927)
@@ -2151,7 +2151,7 @@
  * @param check parser check flags, see LW_PARSER_CHECK_* macros
  * @param size parser check flags, see LW_PARSER_CHECK_* macros
  */
-extern LWGEOM* lwgeom_from_twkb(uint8_t *twkb, size_t twkb_size, char check);
+extern LWGEOM* lwgeom_from_twkb(const uint8_t *twkb, size_t twkb_size, char check);
 
 /**
  * @param geom input geometry

Modified: trunk/liblwgeom/lwin_twkb.c
===================================================================
--- trunk/liblwgeom/lwin_twkb.c	2017-10-06 21:49:20 UTC (rev 15926)
+++ trunk/liblwgeom/lwin_twkb.c	2017-10-06 22:00:40 UTC (rev 15927)
@@ -36,9 +36,9 @@
 typedef struct
 {
 	/* Pointers to the bytes */
-	uint8_t *twkb; /* Points to start of TWKB */
-	uint8_t *twkb_end; /* Points to end of TWKB */
-	uint8_t *pos; /* Current read position */
+	const uint8_t *twkb; /* Points to start of TWKB */
+	const uint8_t *twkb_end; /* Points to end of TWKB */
+	const uint8_t *pos; /* Current read position */
 
 	uint32_t check; /* Simple validity checks on geometries */
 	uint32_t lwtype; /* Current type we are handling */
@@ -653,7 +653,7 @@
 * Check is a bitmask of: LW_PARSER_CHECK_MINPOINTS, LW_PARSER_CHECK_ODD,
 * LW_PARSER_CHECK_CLOSURE, LW_PARSER_CHECK_NONE, LW_PARSER_CHECK_ALL
 */
-LWGEOM* lwgeom_from_twkb(uint8_t *twkb, size_t twkb_size, char check)
+LWGEOM* lwgeom_from_twkb(const uint8_t *twkb, size_t twkb_size, char check)
 {
 	int64_t coords[TWKB_IN_MAXCOORDS] = {0, 0, 0, 0};
 	twkb_parse_state s;



More information about the postgis-tickets mailing list