#include "shp2pgsql-core.h"
#include "pgsql2shp-core.h"
-#include "../liblwgeom/liblwgeom.h" /* for lw_vasprintf */
-
#define GUI_RCSID "shp2pgsql-gui $Revision$"
#define SHAPEFIELDMAXWIDTH 60
};
/* Other */
-static char *pgui_errmsg = NULL;
+#define GUIMSG_LINE_MAXLEN 256
+static char *pgui_errmsg[GUIMSG_LINE_MAXLEN+1];
static PGconn *pg_connection = NULL;
static SHPCONNECTIONCONFIG *conn = NULL;
static SHPLOADERCONFIG *global_loader_config = NULL;
void
pgui_log_va(const char *fmt, va_list ap)
{
- char *msg;
+ char *msg[GUIMSG_LINE_MAXLEN+1];
GtkTextIter iter;
- if (!lw_vasprintf (&msg, fmt, ap)) return;
+ if ( -1 == vsnprintf (msg, GUIMSG_LINE_MAXLEN, fmt, ap) ) return;
+ msg[GUIMSG_LINE_MAXLEN] = '\0';
/* Append text to the end of the text area, scrolling if required to make it visible */
gtk_text_buffer_get_end_iter(textbuffer_log, &iter);
/* Allow GTK to process events */
while (gtk_events_pending())
gtk_main_iteration();
-
- free(msg);
- return;
}
/*
void
pgui_seterr_va(const char *fmt, va_list ap)
{
- /* Free any existing message */
- if (pgui_errmsg)
- free(pgui_errmsg);
-
- if (!lw_vasprintf (&pgui_errmsg, fmt, ap)) return;
+ if ( -1 == vsnprintf (pgui_errmsg, GUIMSG_LINE_MAXLEN, fmt, ap) ) return;
+ pgui_errmsg[GUIMSG_LINE_MAXLEN] = '\0';
}
static void