]> git.street.me.uk Git - andy/viking.git/commitdiff
Never willingly abort, remove exit() statements.
authorRob Norris <rw_norris@hotmail.com>
Sat, 3 Nov 2012 00:26:37 +0000 (00:26 +0000)
committerRob Norris <rw_norris@hotmail.com>
Mon, 12 Nov 2012 22:32:28 +0000 (22:32 +0000)
The program should be able to continue despite issues preventing full operation.

src/geonamessearch.c
src/googlesearch.c
src/viktrwlayer.c
src/vikwindow.c

index b63d3eed993a05010265d12624676967edef6424..f34b2ebbecae240d149ef9ebd578594f2a2813e4 100644 (file)
@@ -240,7 +240,7 @@ GList *a_select_geoname_from_list(GtkWindow *parent, GList *geonames, gboolean m
   return NULL;
 }
 
-GList *get_entries_from_file(gchar *file_name)
+static GList *get_entries_from_file(gchar *file_name)
 {
   gchar *text, *pat;
   GMappedFile *mf;
@@ -261,7 +261,6 @@ GList *get_entries_from_file(gchar *file_name)
 
   if ((mf = g_mapped_file_new(file_name, FALSE, NULL)) == NULL) {
     g_critical(_("couldn't map temp file"));
-    exit(1);
   }
   len = g_mapped_file_get_length(mf);
   text = g_mapped_file_get_contents(mf);
@@ -394,7 +393,7 @@ GList *get_entries_from_file(gchar *file_name)
 }
 
 
-gchar *download_url(gchar *uri)
+static gchar *download_url(gchar *uri)
 {
   FILE *tmp_file;
   int tmp_fd;
@@ -402,12 +401,12 @@ gchar *download_url(gchar *uri)
 
   if ((tmp_fd = g_file_open_tmp ("vikgsearch.XXXXXX", &tmpname, NULL)) == -1) {
     g_critical(_("couldn't open temp file"));
-    exit(1);
+    return NULL;
   }
   tmp_file = fdopen(tmp_fd, "r+");
 
-  // TODO: curl may not be available
-  if (curl_download_uri(uri, tmp_file, NULL, 0, NULL)) {  // error
+  if (curl_download_uri(uri, tmp_file, NULL, 0, NULL)) {
+    // error
     fclose(tmp_file);
     tmp_file = NULL;
     g_remove(tmpname);
index a3a52e0d416ec3291e7ee10154c85a059262e124..9433c1a42f1e2d0067a2f6effeb0ae6f5c44c42f 100644 (file)
@@ -118,7 +118,7 @@ static gboolean google_goto_tool_parse_file_for_latlon(VikGotoTool *self, gchar
 
   if ((mf = g_mapped_file_new(file_name, FALSE, NULL)) == NULL) {
     g_critical(_("couldn't map temp file"));
-    exit(1);
+    return FALSE;
   }
   len = g_mapped_file_get_length(mf);
   text = g_mapped_file_get_contents(mf);
index 309ae58d8059b55738bbc67d5f613000aaa04bdd..c631db8e51fbb998b8a03d6a05b9725eb0e4d0d0 100644 (file)
@@ -6005,10 +6005,10 @@ static gboolean tool_edit_waypoint_click ( VikTrwLayer *vtl, GdkEventButton *eve
   g_hash_table_foreach ( vtl->waypoints, (GHFunc) waypoint_search_closest_tp, &params);
   if ( vtl->current_wp == params.closest_wp && vtl->current_wp != NULL )
   {
-    /* how do we get here? I'm putting in the abort until we can figure it out. -alex */
+    // how do we get here?
     marker_begin_move(t, event->x, event->y);
     g_critical("shouldn't be here");
-    exit(1);
+    return FALSE;
   }
   else if ( params.closest_wp )
   {
index 258ce424f8abbed2cdeaa3e0fc5fae8c116b3781..101b9de5f9707e8be004f4be9cc13c3073c6d0aa 100644 (file)
@@ -1842,10 +1842,6 @@ static toolbox_tools_t* toolbox_create(VikWindow *vw)
   vt->n_tools = 0;
   vt->active_tool = -1;
   vt->vw = vw;
-  if (!vw->viking_vvp) {
-    g_critical("no viewport found.");
-    exit(1);
-  }
   return vt;
 }
 
@@ -1882,7 +1878,7 @@ static void toolbox_activate(toolbox_tools_t *vt, const gchar *tool_name)
 
   if (tool == vt->n_tools) {
     g_critical("trying to activate a non-existent tool...");
-    exit(1);
+    return;
   }
   /* is the tool already active? */
   if (vt->active_tool == tool) {