]> git.street.me.uk Git - andy/viking.git/commitdiff
[QA] Rename variables to avoid shadowing global variables.
authorRob Norris <rw_norris@hotmail.com>
Thu, 2 Jan 2014 23:37:14 +0000 (23:37 +0000)
committerRob Norris <rw_norris@hotmail.com>
Thu, 2 Jan 2014 23:40:33 +0000 (23:40 +0000)
src/clipboard.c
src/dialog.c
src/osm-traces.c
src/osm-traces.h
src/preferences.c
src/preferences.h
src/vikmapslayer.c
src/viktrwlayer.c
src/viktrwlayer_propwin.c
src/vikwindow.c

index fbd38c85dfca2f2cbe88ad1dbf5afc637a106054..ee0828bb686874fd431695b231b25e8012130568 100644 (file)
@@ -288,14 +288,14 @@ static void clip_receive_html ( GtkClipboard *c, GtkSelectionData *sd, gpointer
     span = s;
   }
   for (i=0; i<strlen(span); i++) {
     span = s;
   }
   for (i=0; i<strlen(span); i++) {
-    gchar c = span[i];
-    if (c == '<') {
+    gchar ch = span[i];
+    if (ch == '<') {
       tag++;
     }
     if (tag>0) {
       span[i] = ' ';
     }
       tag++;
     }
     if (tag>0) {
       span[i] = ' ';
     }
-    if (c == '>') {
+    if (ch == '>') {
       if (tag>0) tag--;
     }
   }
       if (tag>0) tag--;
     }
   }
index 4590db614d637a3f350b473212bec6bb229c0c96..79d0f38b9157987bc904aa1aefd962dbe2760f58 100644 (file)
@@ -522,13 +522,13 @@ GList *a_dialog_select_from_list ( GtkWindow *parent, GList *names, gboolean mul
 
   while ( gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT )
   {
 
   while ( gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT )
   {
-    GList *names = NULL;
+    GList *names_selected = NULL;
     GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
     GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
-    gtk_tree_selection_selected_foreach(selection, get_selected_foreach_func, &names);
-    if (names)
+    gtk_tree_selection_selected_foreach(selection, get_selected_foreach_func, &names_selected);
+    if (names_selected)
     {
       gtk_widget_destroy ( dialog );
     {
       gtk_widget_destroy ( dialog );
-      return (names);
+      return names_selected;
     }
     a_dialog_error_msg(parent, _("Nothing was selected"));
   }
     }
     a_dialog_error_msg(parent, _("Nothing was selected"));
   }
index d0225356ed90a39425b4704a7a6ae1a83161cb60..0cc1e40ca642c229573d41ec3df02436b03e62fb 100644 (file)
@@ -52,12 +52,12 @@ static gint last_active = -1;
 /**
  * Login to use for OSM uploading.
  */
 /**
  * Login to use for OSM uploading.
  */
-static gchar *user = NULL;
+static gchar *osm_user = NULL;
 
 /**
  * Password to use for OSM uploading.
  */
 
 /**
  * Password to use for OSM uploading.
  */
-static gchar *password = NULL;
+static gchar *osm_password = NULL;
 
 /**
  * Mutex to protect auth. token
 
 /**
  * Mutex to protect auth. token
@@ -125,7 +125,7 @@ static const gchar *get_default_user()
   return default_user;
 }
 
   return default_user;
 }
 
-void osm_set_login(const gchar *user_, const gchar *password_)
+void osm_set_login(const gchar *user, const gchar *password)
 {
   /* Allocate mutex */
   if (login_mutex == NULL)
 {
   /* Allocate mutex */
   if (login_mutex == NULL)
@@ -133,10 +133,10 @@ void osm_set_login(const gchar *user_, const gchar *password_)
     login_mutex = g_mutex_new();
   }
   g_mutex_lock(login_mutex);
     login_mutex = g_mutex_new();
   }
   g_mutex_lock(login_mutex);
-  g_free(user); user = NULL;
-  g_free(password); password = NULL;
-  user        = g_strdup(user_);
-  password    = g_strdup(password_);
+  g_free(osm_user); osm_user = NULL;
+  g_free(osm_password); osm_password = NULL;
+  osm_user        = g_strdup(user);
+  osm_password    = g_strdup(password);
   g_mutex_unlock(login_mutex);
 }
 
   g_mutex_unlock(login_mutex);
 }
 
@@ -144,7 +144,7 @@ gchar *osm_get_login()
 {
   gchar *user_pass = NULL;
   g_mutex_lock(login_mutex);
 {
   gchar *user_pass = NULL;
   g_mutex_lock(login_mutex);
-  user_pass = g_strdup_printf("%s:%s", user, password);
+  user_pass = g_strdup_printf("%s:%s", osm_user, osm_password);
   g_mutex_unlock(login_mutex);
   return user_pass;
 }
   g_mutex_unlock(login_mutex);
   return user_pass;
 }
@@ -311,7 +311,7 @@ static void osm_traces_upload_thread ( OsmTracesInfo *oti, gpointer threaddata )
   file = NULL;
 
   /* finally, upload it */
   file = NULL;
 
   /* finally, upload it */
-  gint ans = osm_traces_upload_file(user, password, filename,
+  gint ans = osm_traces_upload_file(osm_user, osm_password, filename,
                    oti->name, oti->description, oti->tags, oti->vistype);
 
   //
                    oti->name, oti->description, oti->tags, oti->vistype);
 
   //
@@ -368,15 +368,15 @@ void osm_login_widgets (GtkWidget *user_entry, GtkWidget *password_entry)
   const gchar *pref_user = a_preferences_get(VIKING_OSM_TRACES_PARAMS_NAMESPACE "username")->s;
   const gchar *pref_password = a_preferences_get(VIKING_OSM_TRACES_PARAMS_NAMESPACE "password")->s;
 
   const gchar *pref_user = a_preferences_get(VIKING_OSM_TRACES_PARAMS_NAMESPACE "username")->s;
   const gchar *pref_password = a_preferences_get(VIKING_OSM_TRACES_PARAMS_NAMESPACE "password")->s;
 
-  if (user != NULL && user[0] != '\0')
-    gtk_entry_set_text(GTK_ENTRY(user_entry), user);
+  if (osm_user != NULL && osm_user[0] != '\0')
+    gtk_entry_set_text(GTK_ENTRY(user_entry), osm_user);
   else if (pref_user != NULL && pref_user[0] != '\0')
     gtk_entry_set_text(GTK_ENTRY(user_entry), pref_user);
   else if (default_user != NULL)
     gtk_entry_set_text(GTK_ENTRY(user_entry), default_user);
 
   else if (pref_user != NULL && pref_user[0] != '\0')
     gtk_entry_set_text(GTK_ENTRY(user_entry), pref_user);
   else if (default_user != NULL)
     gtk_entry_set_text(GTK_ENTRY(user_entry), default_user);
 
-  if (password != NULL && password[0] != '\0')
-    gtk_entry_set_text(GTK_ENTRY(password_entry), password);
+  if (osm_password != NULL && osm_password[0] != '\0')
+    gtk_entry_set_text(GTK_ENTRY(password_entry), osm_password);
   else if (pref_password != NULL)
     gtk_entry_set_text(GTK_ENTRY(password_entry), pref_password);
   /* This is a password -> invisible */
   else if (pref_password != NULL)
     gtk_entry_set_text(GTK_ENTRY(password_entry), pref_password);
   /* This is a password -> invisible */
index b5341b00afb1827d4d38f7f9e2ecc9999eccb49a..a97d9cec1e4d070fb0ad1c011ab08aa6b3340070 100644 (file)
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
 void osm_traces_init();
 void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, VikTrack *trk );
 
 void osm_traces_init();
 void osm_traces_upload_viktrwlayer ( VikTrwLayer *vtl, VikTrack *trk );
 
-void osm_set_login (const gchar *user_, const gchar *password_);
+void osm_set_login (const gchar *user, const gchar *password);
 gchar *osm_get_login();
 void osm_login_widgets (GtkWidget *user_entry, GtkWidget *password_entry);
 
 gchar *osm_get_login();
 void osm_login_widgets (GtkWidget *user_entry, GtkWidget *password_entry);
 
index 7174cc9965075b56b3018621476ca50d6d898db7..003c861d3bfe29643b527080fab08739c7514900 100644 (file)
@@ -119,17 +119,17 @@ static gboolean preferences_load_from_file()
   return FALSE;
 }
 
   return FALSE;
 }
 
-static void preferences_run_setparam ( gpointer notused, guint16 i, VikLayerParamData data, VikLayerParam *params )
+static void preferences_run_setparam ( gpointer notused, guint16 i, VikLayerParamData data, VikLayerParam *vlparams )
 {
 {
-  if ( params[i].type == VIK_LAYER_PARAM_STRING_LIST )
+  if ( vlparams[i].type == VIK_LAYER_PARAM_STRING_LIST )
     g_critical ( "Param strings not implemented in preferences"); //fake it
     g_critical ( "Param strings not implemented in preferences"); //fake it
-  g_hash_table_insert ( values, (gchar *)(params[i].name), vik_layer_typed_param_data_copy_from_data(params[i].type, data) );
+  g_hash_table_insert ( values, (gchar *)(vlparams[i].name), vik_layer_typed_param_data_copy_from_data(vlparams[i].type, data) );
 }
 
 /* Allow preferences to be manipulated externally */
 }
 
 /* Allow preferences to be manipulated externally */
-void a_preferences_run_setparam ( VikLayerParamData data, VikLayerParam *params )
+void a_preferences_run_setparam ( VikLayerParamData data, VikLayerParam *vlparams )
 {
 {
-  preferences_run_setparam (NULL, 0, data, params);
+  preferences_run_setparam (NULL, 0, data, vlparams);
 }
 
 static VikLayerParamData preferences_run_getparam ( gpointer notused, guint16 i, gboolean notused2 )
 }
 
 static VikLayerParamData preferences_run_getparam ( gpointer notused, guint16 i, gboolean notused2 )
index 09b045c80ce92f44c9bd31640b29470da6f59cea..464b38c2b1d907c8af275319488257532ba2ee1c 100644 (file)
@@ -47,7 +47,7 @@ void a_preferences_show_window(GtkWindow *parent);
 VikLayerParamData *a_preferences_get(const gchar *key);
 
 /* Allow preferences to be manipulated externally */
 VikLayerParamData *a_preferences_get(const gchar *key);
 
 /* Allow preferences to be manipulated externally */
-void a_preferences_run_setparam ( VikLayerParamData data, VikLayerParam *params );
+void a_preferences_run_setparam ( VikLayerParamData data, VikLayerParam *vlparams );
 
 gboolean a_preferences_save_to_file();
 
 
 gboolean a_preferences_save_to_file();
 
index 6f11f7d97d41071e16b5a7796587eecf8346f7bc..b8e38f01ce3cc07c228a0c1fb6c4421f2fea3e55 100644 (file)
@@ -1133,7 +1133,7 @@ static void maps_layer_draw_section ( VikMapsLayer *vml, VikViewport *vvp, VikCo
       gint tilesize_y_ceil = ceil ( tilesize_y );
       gint8 xinc = (ulm.x == xmin) ? 1 : -1;
       gint8 yinc = (ulm.y == ymin) ? 1 : -1;
       gint tilesize_y_ceil = ceil ( tilesize_y );
       gint8 xinc = (ulm.x == xmin) ? 1 : -1;
       gint8 yinc = (ulm.y == ymin) ? 1 : -1;
-      gdouble xx, yy; gint xx_tmp, yy_tmp;
+      gint xx_tmp, yy_tmp;
       gint base_yy, xend, yend;
 
       xend = (xinc == 1) ? (xmax+1) : (xmin-1);
       gint base_yy, xend, yend;
 
       xend = (xinc == 1) ? (xmax+1) : (xmin-1);
index a629f4c43757c41c6ec9e509ffe8282e22392a44..6af595efd62b4198cc47e1424cea2e3fb677997f 100644 (file)
@@ -10492,16 +10492,16 @@ void vik_track_download_map(VikTrack *tr, VikMapsLayer *vml, VikViewport *vvp, g
     g_message("%s: this feature works only in Mercator mode", __FUNCTION__);
 
   if (fillins) {
     g_message("%s: this feature works only in Mercator mode", __FUNCTION__);
 
   if (fillins) {
-    GList *iter = fillins;
-    while (iter) {
-      cur_coord = (VikCoord *)(iter->data);
+    GList *fiter = fillins;
+    while (fiter) {
+      cur_coord = (VikCoord *)(fiter->data);
       vik_coord_set_area(cur_coord, &wh, &tl, &br);
       rect = g_malloc(sizeof(Rect));
       rect->tl = tl;
       rect->br = br;
       rect->center = *cur_coord;
       rects_to_download = g_list_prepend(rects_to_download, rect);
       vik_coord_set_area(cur_coord, &wh, &tl, &br);
       rect = g_malloc(sizeof(Rect));
       rect->tl = tl;
       rect->br = br;
       rect->center = *cur_coord;
       rects_to_download = g_list_prepend(rects_to_download, rect);
-      iter = iter->next;
+      fiter = fiter->next;
     }
   }
 
     }
   }
 
index 2cf48d377f97f6133c412da1851e0be6cc2ce7da..c54b263c66fcd34e6821ac17088489ecad80cbb5 100644 (file)
@@ -1704,7 +1704,6 @@ static void draw_dt ( GtkWidget *image, VikTrack *tr, PropWidgets *widgets )
     max_speed = widgets->max_speed * 110 / 100;
 
     // This is just an indicator - no actual values can be inferred by user
     max_speed = widgets->max_speed * 110 / 100;
 
     // This is just an indicator - no actual values can be inferred by user
-    gint i;
     for ( i = 0; i < widgets->profile_width; i++ ) {
       int y_speed = widgets->profile_height - (widgets->profile_height * widgets->speeds[i])/max_speed;
       gdk_draw_rectangle(GDK_DRAWABLE(pix), dist_speed_gc, TRUE, i+MARGIN-2, y_speed-2, 4, 4);
     for ( i = 0; i < widgets->profile_width; i++ ) {
       int y_speed = widgets->profile_height - (widgets->profile_height * widgets->speeds[i])/max_speed;
       gdk_draw_rectangle(GDK_DRAWABLE(pix), dist_speed_gc, TRUE, i+MARGIN-2, y_speed-2, 4, 4);
@@ -1803,7 +1802,6 @@ static void draw_et ( GtkWidget *image, VikTrack *tr, PropWidgets *widgets )
     max_speed = widgets->max_speed * 110 / 100;
 
     // This is just an indicator - no actual values can be inferred by user
     max_speed = widgets->max_speed * 110 / 100;
 
     // This is just an indicator - no actual values can be inferred by user
-    gint i;
     for ( i = 0; i < widgets->profile_width; i++ ) {
       int y_speed = widgets->profile_height - (widgets->profile_height * widgets->speeds[i])/max_speed;
       gdk_draw_rectangle(GDK_DRAWABLE(pix), elev_speed_gc, TRUE, i+MARGIN-2, y_speed-2, 4, 4);
     for ( i = 0; i < widgets->profile_width; i++ ) {
       int y_speed = widgets->profile_height - (widgets->profile_height * widgets->speeds[i])/max_speed;
       gdk_draw_rectangle(GDK_DRAWABLE(pix), elev_speed_gc, TRUE, i+MARGIN-2, y_speed-2, 4, 4);
index 67584618c0a6e33a815dd6a54ef8f7bdf9f232e3..9ad4d7d823613f2259bddd68dbae3e53478995a1 100644 (file)
@@ -3751,8 +3751,8 @@ static void draw_to_image_file ( VikWindow *vw, gboolean one_image_only )
     if ( !fn )
       return;
 
     if ( !fn )
       return;
 
-    gint active = gtk_combo_box_get_active ( GTK_COMBO_BOX(zoom_combo) );
-    gdouble zoom = pow (2, active-2 );
+    gint active_z = gtk_combo_box_get_active ( GTK_COMBO_BOX(zoom_combo) );
+    gdouble zoom = pow (2, active_z-2 );
 
     if ( one_image_only )
       save_image_file ( vw, fn, 
 
     if ( one_image_only )
       save_image_file ( vw, fn,