[postgis-tickets] [SCM] PostGIS branch out-of-build-docs updated. 3.2.0-379-g99809f9f1

git at osgeo.org git at osgeo.org
Thu Jan 27 08:32:25 PST 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, out-of-build-docs has been updated
       via  99809f9f1a0391b2dc44b4eaff94a2bbf3cf2852 (commit)
      from  146820e013003c0c2a19a322ae0a1cdf4fcc22ce (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 99809f9f1a0391b2dc44b4eaff94a2bbf3cf2852
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Jan 27 17:31:36 2022 +0100

    [generator] Add support for taking output in commandline

diff --git a/doc/html/image_src/generator.c b/doc/html/image_src/generator.c
index b9eb57487..0732acb99 100644
--- a/doc/html/image_src/generator.c
+++ b/doc/html/image_src/generator.c
@@ -2,6 +2,8 @@
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
+ *
+ * Copyright (C) 2022 Sandro Santilli <strk at kbt.io>
  * Copyright 2008 Kevin Neufeld
  *
  * This is free software; you can redistribute and/or modify it under
@@ -334,26 +336,33 @@ int main( int argc, const char* argv[] )
 	char *filename;
 	int layerCount;
 	LAYERSTYLE *styles;
-	char *image_path = "../images/";
-
-	getStyles(&styles);
+	const char *image_src;
 
-	if ( argc != 2 || strlen(argv[1]) < 3)
+	if ( argc < 2 || strlen(argv[1]) < 3)
 	{
-		lwerror("You must specify a wkt filename to convert, and it must be 3 or more characters long.\n");
+		lwerror("Usage: %s <source_wktfile> [<output_pngfile>]", argv[0]);
 		return -1;
 	}
 
-	if ( (pfile = fopen(argv[1], "r")) == NULL)
+	image_src = argv[1];
+
+	if ( (pfile = fopen(image_src, "r")) == NULL)
 	{
-		perror ( argv[1] );
+		perror ( image_src );
 		return -1;
 	}
 
-	filename = malloc( strlen(argv[1]) + strlen(image_path) + 1 );
-	strcpy( filename, image_path );
-	strncat( filename, argv[1], strlen(argv[1])-3 );
-	strncat( filename, "png", 3 );
+	getStyles(&styles);
+
+	if ( argc > 2 )
+	{
+		filename = strdup(argv[2]);
+	}
+	else
+	{
+		filename = strdup(image_src);
+		sprintf(filename + strlen(image_src) - 3, "png" );
+	}
 
 	printf( "generating %s\n", filename );
 
@@ -390,7 +399,7 @@ int main( int argc, const char* argv[] )
 
 		ptr += sprintf( ptr, "-flip tmp%d.png", layerCount );
 
-		lwfree( lwgeom );
+		lwgeom_free( lwgeom );
 
 		LWDEBUGF( 4, "%s", output );
 		checked_system(output);

-----------------------------------------------------------------------

Summary of changes:
 doc/html/image_src/generator.c | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list