]> granicus.if.org Git - postgis/commitdiff
Fix a couple of compiler warnings in shp2pgsql-gui caused by uninitialised variables.
authorMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Tue, 7 Feb 2012 13:12:31 +0000 (13:12 +0000)
committerMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Tue, 7 Feb 2012 13:12:31 +0000 (13:12 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9064 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-gui.c

index 92482dfd76a05aa6ca5ec6b5da15800971d5d7ea..9a2cda55308075ae961d81949b99df74c35cba61 100644 (file)
@@ -1763,7 +1763,7 @@ pgui_action_export(GtkWidget *widget, gpointer data)
        char *output_shapefile, *orig_shapefile, *progress_text = NULL;
        gchar *folder_path;
        
-       int ret, success, i = 0;
+       int ret, success = FALSE, i = 0;
        
        /* Get the first row of the import list */
        is_valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(export_table_list_store), &iter);
@@ -1827,15 +1827,6 @@ pgui_action_export(GtkWidget *widget, gpointer data)
                state = ShpDumperCreate(dumper_table_config);
                state->config->conn = conn;
                
-               ret = ShpDumperConnectDatabase(state);
-               if (ret != SHPDUMPEROK)
-               {
-                       pgui_seterr("%s", state->message);
-                       pgui_raise_error_dialogue();
-                       
-                       goto export_cleanup;
-               }
-
                /* Save the original shapefile name, then create a temporary version containing the full path */
                orig_shapefile = dumper_table_config->shp_file;
                output_shapefile = malloc(strlen(folder_path) + strlen(dumper_table_config->shp_file) + 2);
@@ -1844,7 +1835,17 @@ pgui_action_export(GtkWidget *widget, gpointer data)
                strcat(output_shapefile, dumper_table_config->shp_file);
 
                dumper_table_config->shp_file = output_shapefile;
-               
+
+               /* Connect to the database */
+               ret = ShpDumperConnectDatabase(state);
+               if (ret != SHPDUMPEROK)
+               {
+                       pgui_seterr("%s", state->message);
+                       pgui_raise_error_dialogue();
+                       
+                       goto export_cleanup;
+               }
+       
                /* Display the progress dialog */
                gtk_label_set_text(GTK_LABEL(label_progress), _("Initialising..."));
                gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), 0.0);