]> granicus.if.org Git - postgis/commitdiff
MinGW fix for loader (#222), Mark Cave-Ayland
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 13 Jul 2009 17:27:41 +0000 (17:27 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 13 Jul 2009 17:27:41 +0000 (17:27 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@4293 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/liblwgeom.h
loader/Makefile.in
loader/shp2pgsql-cli.c
loader/shp2pgsql-core.c
loader/shp2pgsql-core.h
loader/shp2pgsql-gui.c

index e54d41162408e2fe2281b134baed5544dc4ee7b1..132cc8254c271095ed571900c4214cce997b587e 100644 (file)
@@ -121,8 +121,16 @@ void default_freeor(void *ptr);
 void default_errorreporter(const char *fmt, va_list ap);
 void default_noticereporter(const char *fmt, va_list ap);
 
-
 extern int lw_vasprintf (char **result, const char *format, va_list args);
+extern int lw_asprintf
+#if __STDC__
+(char **result, const char *format, ...);
+#else
+(result, va_alist);
+char **result;
+va_dcl
+#endif
+
 
 /* Debug macros */
 #if POSTGIS_DEBUG_LEVEL > 0
index 6f600a8ce237633e605fc26e65501663585bc2ee..4a149839ef7fa6629ad02a29a016e504045a0764 100644 (file)
@@ -72,7 +72,7 @@ shp2pgsql-gui.o: shp2pgsql-gui.c
 $(SHP2PGSQL-GUI): stringbuffer.o shpopen.o dbfopen.o shp2pgsql-core-gui.o shp2pgsql-gui.o $(LIBLWGEOM) 
        $(CC) $(CFLAGS) $(GTK_LIBS) $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) -lm $^ -o $@
 
-$(SHP2PGSQL-CLI): stringbuffer.o shpopen.o dbfopen.o shp2pgsql-core.o shp2pgsql-cli.o $(LIBLWGEOM) 
+$(SHP2PGSQL-CLI): stringbuffer.o shpopen.o dbfopen.o getopt.o shp2pgsql-core.o shp2pgsql-cli.o $(LIBLWGEOM) 
        $(CC) $(CFLAGS) $(ICONV_LDFLAGS) -lm $^ -o $@
 
 install: all
index 7eefbc922d9de4d75288889461c6ed83772aab2a..7d985777ad56dacb14bceb2802d92cc960b5ccd3 100644 (file)
@@ -61,7 +61,7 @@ pcli_cmdline(int ARGC, char **ARGV)
                pcli_usage(ARGV[0], 0, stdout);
        }
 
-       while ((c = getopt(ARGC, ARGV, "kcdapDs:Sg:iW:wIN:n")) != EOF){
+       while ((c = pgis_getopt(ARGC, ARGV, "kcdapDs:Sg:iW:wIN:n")) != EOF){
                switch (c) {
                        case 'c':
                                if (opt == ' ')
index d79641302fdcbc6fb2286d37a6a0e63f9a3dfecf..1c936a764c18b7e4fef75ed1aae5c58f85a885e6 100644 (file)
@@ -174,7 +174,7 @@ pgis_logf(const char *fmt, ... )
 #ifdef PGUI
        pgui_log_va(fmt, ap);
 #else
-       if (!vasprintf (&msg, fmt, ap))
+       if (!lw_vasprintf (&msg, fmt, ap))
        {
                va_end (ap);
                return;
@@ -755,12 +755,12 @@ LoadData(void)
                char *copysql;
                if ( schema )
                {
-                       asprintf(&copysql, "COPY \"%s\".\"%s\" %s FROM stdin",
+                       lw_asprintf(&copysql, "COPY \"%s\".\"%s\" %s FROM stdin",
                                         schema, table, col_names);
                }
                else
                {
-                       asprintf(&copysql, "COPY \"%s\" %s FROM stdin",
+                       lw_asprintf(&copysql, "COPY \"%s\" %s FROM stdin",
                                         table, col_names);
                }
                pgis_copy_start(copysql);
@@ -1526,7 +1526,7 @@ DropTable(char *schema, char *table, char *geom)
        {
                if (readshape == 1)
                {
-                       asprintf(&sql, "SELECT DropGeometryColumn('%s','%s','%s')",     schema, table, geom);
+                       lw_asprintf(&sql, "SELECT DropGeometryColumn('%s','%s','%s')",  schema, table, geom);
                        if ( ! pgis_exec(sql) )
                        {
                                free(sql);
@@ -1534,7 +1534,7 @@ DropTable(char *schema, char *table, char *geom)
                        }
                        free(sql);
                }
-               asprintf(&sql, "DROP TABLE \"%s\".\"%s\"", schema, table);
+               lw_asprintf(&sql, "DROP TABLE \"%s\".\"%s\"", schema, table);
                if ( ! pgis_exec(sql) )
                {
                        free(sql);
@@ -1546,7 +1546,7 @@ DropTable(char *schema, char *table, char *geom)
        {
                if (readshape == 1)
                {
-                       asprintf(&sql, "SELECT DropGeometryColumn('','%s','%s')", table, geom);
+                       lw_asprintf(&sql, "SELECT DropGeometryColumn('','%s','%s')", table, geom);
                        if  ( ! pgis_exec(sql) )
                        {
                                free(sql);
@@ -1554,7 +1554,7 @@ DropTable(char *schema, char *table, char *geom)
                        }
                        free(sql);
                }
-               asprintf(&sql, "DROP TABLE \"%s\"", table);
+               lw_asprintf(&sql, "DROP TABLE \"%s\"", table);
                if ( ! pgis_exec(sql) )
                {
                        free(sql);
index 120769e68960532dc47cab84ddf74091a19f85c7..b16f2198cb987b065cbe1a44f24c231166ed1e20 100644 (file)
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
 
 #include <stdio.h>
 #include <string.h>
index c058223652a6eb44ec106dbcaa18e21e707e1128..db7bbc56739a75e9b8126e07889af55fdad9dda4 100644 (file)
@@ -12,8 +12,6 @@
  *
  **********************************************************************/
 
-#define _GNU_SOURCE
-
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -79,7 +77,7 @@ pgui_log_va(const char *fmt, va_list ap)
 {
        char *msg;
 
-       if (!vasprintf (&msg, fmt, ap)) return;
+       if (!lw_vasprintf (&msg, fmt, ap)) return;
 
        gtk_text_buffer_insert_at_cursor(textbuffer_log, msg, -1);
        gtk_text_buffer_insert_at_cursor(textbuffer_log, "\n", -1);
@@ -304,7 +302,7 @@ pgui_read_connection(void)
                pgui_seterr("Server port must be a number.");
                return NULL;
        }
-       if ( ! asprintf(&connection_string, "user=%s password=%s port=%s host=%s dbname=%s", pg_user, pg_pass, pg_port, pg_host, pg_db) )
+       if ( ! lw_asprintf(&connection_string, "user=%s password=%s port=%s host=%s dbname=%s", pg_user, pg_pass, pg_port, pg_host, pg_db) )
        {
                return NULL;
        }