Author: cazfi
Date: Thu Apr 14 18:26:45 2016
New Revision: 32396

URL: http://svn.gna.org/viewcvs/freeciv?rev=32396&view=rev
Log:
Fixed some shadowing warnings. Most of these were about shadowing some
system header constructs, such as using C library function names as variables.

See patch #7100

Modified:
    trunk/common/aicore/cm.c
    trunk/common/city.c
    trunk/common/featured_text.c
    trunk/common/map.c
    trunk/common/scriptcore/api_game_methods.c
    trunk/common/scriptcore/luascript_signal.c
    trunk/common/scriptcore/luascript_signal.h
    trunk/common/scriptcore/tolua_signal.pkg
    trunk/utility/log.c

Modified: trunk/common/aicore/cm.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/aicore/cm.c?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/common/aicore/cm.c    (original)
+++ trunk/common/aicore/cm.c    Thu Apr 14 18:26:45 2016
@@ -1200,12 +1200,12 @@
   tile_type_init(&type); /* init just once */
 
   city_tile_iterate_index(city_map_radius_sq_get(pcity), pcenter, ptile,
-                          index) {
+                          ctindex) {
     if (is_free_worked(pcity, ptile)) {
       continue;
     } else if (city_can_work_tile(pcity, ptile)) {
       compute_tile_production(pcity, ptile, &type); /* clobbers type */
-      tile_type_lattice_add(lattice, &type, index); /* copy type if needed */
+      tile_type_lattice_add(lattice, &type, ctindex); /* copy type if needed */
     }
   } city_tile_iterate_index_end;
 

Modified: trunk/common/city.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/city.c?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/common/city.c (original)
+++ trunk/common/city.c Thu Apr 14 18:26:45 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -2316,7 +2316,7 @@
   citizens *unhappy = &pcity->feel[CITIZEN_UNHAPPY][FEELING_BASE];
   citizens *angry = &pcity->feel[CITIZEN_ANGRY][FEELING_BASE];
   citizens size = city_size_get(pcity);
-  citizens specialist_count = city_specialists(pcity);
+  citizens spes = city_specialists(pcity);
 
   /* This is the number of citizens that may start out content, depending
    * on empire size and game's city unhappysize. This may be bigger than
@@ -2326,16 +2326,16 @@
   citizens base_angry = player_angry_citizens(pplayer);
 
   /* Create content citizens. Take specialists from their ranks. */
-  *content = MAX(0, MIN(size, base_content) - specialist_count);
+  *content = MAX(0, MIN(size, base_content) - spes);
 
   /* Create angry citizens. Specialists never become angry. */
   fc_assert_action(base_content == 0 || base_angry == 0, *content = 0);
-  *angry = MIN(base_angry, size - specialist_count);
+  *angry = MIN(base_angry, size - spes);
 
   /* Create unhappy citizens. In the beginning, all who are not content,
    * specialists or angry are unhappy. This is changed by luxuries and 
    * buildings later. */
-  *unhappy = (size - specialist_count - *content - *angry);
+  *unhappy = (size - spes - *content - *angry);
   fc_assert_action(*unhappy >= 0, *unhappy = 0);
 
   /* No one is born happy. */

Modified: trunk/common/featured_text.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/featured_text.c?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/common/featured_text.c        (original)
+++ trunk/common/featured_text.c        Thu Apr 14 18:26:45 2016
@@ -864,26 +864,26 @@
                                    struct text_tag_list **tags,
                                    bool replace_link_text)
 {
-  const char *read = featured_text;
-  char *write = plain_text;
-  size_t write_len = plain_text_len;
+  const char *text_in = featured_text;
+  char *text_out = plain_text;
+  size_t text_out_len = plain_text_len;
 
   if (tags) {
     *tags = text_tag_list_new();
   }
 
-  while (*read != '\0' && write_len > 1) {
-    if (SEQ_START == *read) {
+  while (*text_in != '\0' && text_out_len > 1) {
+    if (SEQ_START == *text_in) {
       /* Escape sequence... */
-      char buf[write_len];
+      char buf[text_out_len];
       enum sequence_type seq_type;
       enum text_tag_type type;
-      size_t len = extract_sequence_text(read, buf, write_len,
+      size_t len = extract_sequence_text(text_in, buf, text_out_len,
                                          &seq_type, &type);
 
       if (len > 0) {
         /* Looks a valid sequence. */
-        read += len;
+        text_in += len;
         switch (seq_type) {
         case ST_START:
           if (tags) {
@@ -891,7 +891,7 @@
             struct text_tag *ptag = fc_malloc(sizeof(struct text_tag));
 
             if (text_tag_init_from_sequence(ptag, type,
-                                            write - plain_text, buf)) {
+                                            text_out - plain_text, buf)) {
               text_tag_list_append(*tags, ptag);
             } else {
               text_tag_destroy(ptag);
@@ -915,7 +915,7 @@
             } text_tag_list_rev_iterate_end;
 
             if (ptag) {
-              ptag->stop_offset = write - plain_text;
+              ptag->stop_offset = text_out - plain_text;
             } else {
               log_featured_text("Extra text tag end for \"%s\".",
                                 text_tag_type_name(type));
@@ -928,20 +928,20 @@
             struct text_tag tag;
 
             if (!text_tag_init_from_sequence(&tag, type,
-                                             write - plain_text, buf)) {
+                                             text_out - plain_text, buf)) {
               log_featured_text("Couldn't create a text tag with \"%s\".",
                                 buf);
             } else {
-              len = text_tag_replace_text(&tag, write, write_len,
+              len = text_tag_replace_text(&tag, text_out, text_out_len,
                                           replace_link_text);
-              write += len;
-              write_len -= len;
+              text_out += len;
+              text_out_len -= len;
               if (tags) {
                 /* Set it in the list. */
                 struct text_tag *ptag = fc_malloc(sizeof(struct text_tag));
 
                 *ptag = tag;
-                ptag->stop_offset = write - plain_text;
+                ptag->stop_offset = text_out - plain_text;
                 text_tag_list_append(*tags, ptag);
               }
             }
@@ -949,16 +949,17 @@
           break;
         };
       } else {
-        *write++ = *read++;
-        write_len--;
+        *text_out++ = *text_in++;
+        text_out_len--;
       }
     } else {
-      *write++ = *read++;
-      write_len--;
-    }
-  }
-  *write = '\0';
-  return plain_text_len - write_len;
+      *text_out++ = *text_in++;
+      text_out_len--;
+    }
+  }
+  *text_out = '\0';
+
+  return plain_text_len - text_out_len;
 }
 
 /**************************************************************************

Modified: trunk/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.c?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/common/map.c  (original)
+++ trunk/common/map.c  Thu Apr 14 18:26:45 2016
@@ -992,17 +992,17 @@
   instead.
 ****************************************************************************/
 void base_map_distance_vector(int *dx, int *dy,
-                             int x0, int y0, int x1, int y1)
+                             int x0dv, int y0dv, int x1dv, int y1dv)
 {
   if (current_topo_has_flag(TF_WRAPX) || current_topo_has_flag(TF_WRAPY)) {
     /* Wrapping is done in native coordinates. */
-    MAP_TO_NATIVE_POS(&x0, &y0, x0, y0);
-    MAP_TO_NATIVE_POS(&x1, &y1, x1, y1);
+    MAP_TO_NATIVE_POS(&x0dv, &y0dv, x0dv, y0dv);
+    MAP_TO_NATIVE_POS(&x1dv, &y1dv, x1dv, y1dv);
 
     /* Find the "native" distance vector. This corresponds closely to the
      * map distance vector but is easier to wrap. */
-    *dx = x1 - x0;
-    *dy = y1 - y0;
+    *dx = x1dv - x0dv;
+    *dy = y1dv - y0dv;
     if (current_topo_has_flag(TF_WRAPX)) {
       /* Wrap dx to be in [-map.xsize/2, map.xsize/2). */
       *dx = FC_WRAP(*dx + game.map.xsize / 2, game.map.xsize) - game.map.xsize 
/ 2;
@@ -1013,15 +1013,15 @@
     }
 
     /* Convert the native delta vector back to a pair of map positions. */
-    x1 = x0 + *dx;
-    y1 = y0 + *dy;
-    NATIVE_TO_MAP_POS(&x0, &y0, x0, y0);
-    NATIVE_TO_MAP_POS(&x1, &y1, x1, y1);
+    x1dv = x0dv + *dx;
+    y1dv = y0dv + *dy;
+    NATIVE_TO_MAP_POS(&x0dv, &y0dv, x0dv, y0dv);
+    NATIVE_TO_MAP_POS(&x1dv, &y1dv, x1dv, y1dv);
   }
 
   /* Find the final (map) vector. */
-  *dx = x1 - x0;
-  *dy = y1 - y0;
+  *dx = x1dv - x0dv;
+  *dy = y1dv - y0dv;
 }
 
 /****************************************************************************

Modified: trunk/common/scriptcore/api_game_methods.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/api_game_methods.c?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/common/scriptcore/api_game_methods.c  (original)
+++ trunk/common/scriptcore/api_game_methods.c  Thu Apr 14 18:26:45 2016
@@ -1026,42 +1026,42 @@
   Return Unit for list link
 *****************************************************************************/
 Unit *api_methods_unit_list_link_data(lua_State *L,
-                                      Unit_List_Link *link)
-{
-  LUASCRIPT_CHECK_STATE(L, NULL);
-
-  return unit_list_link_data(link);
+                                      Unit_List_Link *ul_link)
+{
+  LUASCRIPT_CHECK_STATE(L, NULL);
+
+  return unit_list_link_data(ul_link);
 }
 
 /*****************************************************************************
   Return next list link or NULL when link is the last link
 *****************************************************************************/
 Unit_List_Link *api_methods_unit_list_next_link(lua_State *L,
-                                                Unit_List_Link *link)
-{
-  LUASCRIPT_CHECK_STATE(L, NULL);
-
-  return unit_list_link_next(link);
+                                                Unit_List_Link *ul_link)
+{
+  LUASCRIPT_CHECK_STATE(L, NULL);
+
+  return unit_list_link_next(ul_link);
 }
 
 /*****************************************************************************
   Return City for list link
 *****************************************************************************/
 City *api_methods_city_list_link_data(lua_State *L,
-                                      City_List_Link *link)
-{
-  LUASCRIPT_CHECK_STATE(L, NULL);
-
-  return city_list_link_data(link);
+                                      City_List_Link *cl_link)
+{
+  LUASCRIPT_CHECK_STATE(L, NULL);
+
+  return city_list_link_data(cl_link);
 }
 
 /*****************************************************************************
   Return next list link or NULL when link is the last link
 *****************************************************************************/
 City_List_Link *api_methods_city_list_next_link(lua_State *L,
-                                                City_List_Link *link)
-{
-  LUASCRIPT_CHECK_STATE(L, NULL);
-
-  return city_list_link_next(link);
-}
+                                                City_List_Link *cl_link)
+{
+  LUASCRIPT_CHECK_STATE(L, NULL);
+
+  return city_list_link_next(cl_link);
+}

Modified: trunk/common/scriptcore/luascript_signal.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/luascript_signal.c?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/common/scriptcore/luascript_signal.c  (original)
+++ trunk/common/scriptcore/luascript_signal.c  Thu Apr 14 18:26:45 2016
@@ -265,7 +265,7 @@
 /*****************************************************************************
   Mark signal deprecated.
 *****************************************************************************/
-void deprecate_signal(signal_deprecator *deprecator, char *signal,
+void deprecate_signal(signal_deprecator *deprecator, char *signal_name,
                       char *replacement, char *deprecated_since)
 {
   if (deprecator != NULL) {
@@ -274,14 +274,14 @@
     if (deprecated_since != NULL && replacement != NULL) {
       fc_snprintf(buffer, sizeof(buffer),
                   "Deprecated: lua signal \"%s\", deprecated since \"%s\", 
used. "
-                  "Use \"%s\" instead", signal, deprecated_since, replacement);
+                  "Use \"%s\" instead", signal_name, deprecated_since, 
replacement);
     } else if (replacement != NULL) {
       fc_snprintf(buffer, sizeof(buffer),
                   "Deprecated: lua signal \"%s\" used. Use \"%s\" instad",
-                  signal, replacement);
+                  signal_name, replacement);
     } else {
       fc_snprintf(buffer, sizeof(buffer),
-                  "Deprecated: lua signal \"%s\" used.", signal);
+                  "Deprecated: lua signal \"%s\" used.", signal_name);
     }
 
     *deprecator = fc_strdup(buffer);

Modified: trunk/common/scriptcore/luascript_signal.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/luascript_signal.h?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/common/scriptcore/luascript_signal.h  (original)
+++ trunk/common/scriptcore/luascript_signal.h  Thu Apr 14 18:26:45 2016
@@ -33,7 +33,7 @@
                            int nargs, ...);
 signal_deprecator *luascript_signal_create(struct fc_lua *fcl, const char 
*signal_name,
                                            int nargs, ...);
-void deprecate_signal(signal_deprecator *deprecator, char *signal,
+void deprecate_signal(signal_deprecator *deprecator, char *signal_name,
                       char *replacement, char *deprecated_since);
 void luascript_signal_callback(struct fc_lua *fcl, const char *signal_name,
                                const char *callback_name, bool create);

Modified: trunk/common/scriptcore/tolua_signal.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/tolua_signal.pkg?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/common/scriptcore/tolua_signal.pkg    (original)
+++ trunk/common/scriptcore/tolua_signal.pkg    Thu Apr 14 18:26:45 2016
@@ -79,7 +79,7 @@
 /* Module find. */
 module find {
   const char *api_signal_by_index
-    @ signal (lua_State *L, int index);
+    @ signal (lua_State *L, int sindex);
   const char *api_signal_callback_by_index
-    @ signal_callback(lua_State *L, const char *signal_name, int index);
+    @ signal_callback(lua_State *L, const char *signal_name, int sindex);
 }

Modified: trunk/utility/log.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/log.c?rev=32396&r1=32395&r2=32396&view=diff
==============================================================================
--- trunk/utility/log.c (original)
+++ trunk/utility/log.c Thu Apr 14 18:26:45 2016
@@ -94,7 +94,7 @@
 #ifdef DEBUG
   const char *tok;
   int i;
-  char *dup;
+  char *dupled;
   bool ret = TRUE;
 #endif /* DEBUG */
 
@@ -168,8 +168,8 @@
   log_files = fc_realloc(log_files,
                          log_num_files * sizeof(struct log_fileinfo));
 
-  dup = fc_strdup(c + 2);
-  tok = strtok(dup, ":");
+  dupled = fc_strdup(c + 2);
+  tok = strtok(dupled, ":");
 
   if (!tok) {
     fc_fprintf(stderr, _("Badly formed log level argument \"%s\".\n"),
@@ -222,7 +222,7 @@
   }
 
 out:
-  free(dup);
+  free(dupled);
   return ret;
 #else  /* DEBUG */
   fc_fprintf(stderr, _("Freeciv must be compiled with the DEBUG flag "


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to