[Freeciv-commits] r27906 - /branches/S2_4/po/ /branches/S2_5/translations/freeciv/ /branches/S2_6/translations/freeciv/ /branches/S2_6/transla...

2015-01-29 Thread igx31
Author: igx31
Date: Fri Jan 30 07:50:45 2015
New Revision: 27906

URL: http://svn.gna.org/viewcvs/freeciv?rev=27906&view=rev
Log:
Updated French translations


Modified:
branches/S2_4/po/fr.po
branches/S2_5/translations/freeciv/fr.po
branches/S2_6/translations/freeciv/fr.po
branches/S2_6/translations/ruledit/fr.po
trunk/translations/freeciv/fr.po
trunk/translations/ruledit/fr.po

[This mail would be too long, it was shortened to contain the URLs only.]

Modified: branches/S2_4/po/fr.po
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/po/fr.po?rev=27906&r1=27905&r2=27906&view=diff

Modified: branches/S2_5/translations/freeciv/fr.po
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/translations/freeciv/fr.po?rev=27906&r1=27905&r2=27906&view=diff

Modified: branches/S2_6/translations/freeciv/fr.po
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/translations/freeciv/fr.po?rev=27906&r1=27905&r2=27906&view=diff

Modified: branches/S2_6/translations/ruledit/fr.po
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/translations/ruledit/fr.po?rev=27906&r1=27905&r2=27906&view=diff

Modified: trunk/translations/freeciv/fr.po
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/translations/freeciv/fr.po?rev=27906&r1=27905&r2=27906&view=diff

Modified: trunk/translations/ruledit/fr.po
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/translations/ruledit/fr.po?rev=27906&r1=27905&r2=27906&view=diff


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


[Freeciv-commits] r27905 - /branches/S2_5/utility/netintf.c

2015-01-29 Thread cazfi74
Author: cazfi
Date: Fri Jan 30 05:05:10 2015
New Revision: 27905

URL: http://svn.gna.org/viewcvs/freeciv?rev=27905&view=rev
Log:
Consider any kind of sockaddr size to be size of whole fc_sockaddr union in 
Windows builds.

See bug #22448

Modified:
branches/S2_5/utility/netintf.c

Modified: branches/S2_5/utility/netintf.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/utility/netintf.c?rev=27905&r1=27904&r2=27905&view=diff
==
--- branches/S2_5/utility/netintf.c (original)
+++ branches/S2_5/utility/netintf.c Fri Jan 30 05:05:10 2015
@@ -295,6 +295,9 @@
 ***/
 int sockaddr_size(union fc_sockaddr *addr)
 {
+#ifdef WIN32_NATIVE
+  return sizeof(*addr);
+#else
 #ifdef IPV6_SUPPORT
   if (addr->saddr.sa_family == AF_INET6) {
 return sizeof(addr->saddr_in6);
@@ -305,10 +308,11 @@
   } else {
 fc_assert(FALSE);
 
-log_error("Unsupported address family in socaddr_size()");
+log_error("Unsupported address family in sockaddr_size()");
 
 return 0;
   }
+#endif /* WIN32_NATIVE */
 }
 
 /***


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


[Freeciv-commits] r27903 - /trunk/utility/netintf.c

2015-01-29 Thread cazfi74
Author: cazfi
Date: Fri Jan 30 05:04:57 2015
New Revision: 27903

URL: http://svn.gna.org/viewcvs/freeciv?rev=27903&view=rev
Log:
Consider any kind of sockaddr size to be size of whole fc_sockaddr union in 
Windows builds.

See bug #22448

Modified:
trunk/utility/netintf.c

Modified: trunk/utility/netintf.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/netintf.c?rev=27903&r1=27902&r2=27903&view=diff
==
--- trunk/utility/netintf.c (original)
+++ trunk/utility/netintf.c Fri Jan 30 05:04:57 2015
@@ -295,6 +295,9 @@
 ***/
 int sockaddr_size(union fc_sockaddr *addr)
 {
+#ifdef WIN32_NATIVE
+  return sizeof(*addr);
+#else
 #ifdef IPV6_SUPPORT
   if (addr->saddr.sa_family == AF_INET6) {
 return sizeof(addr->saddr_in6);
@@ -305,10 +308,11 @@
   } else {
 fc_assert(FALSE);
 
-log_error("Unsupported address family in socaddr_size()");
+log_error("Unsupported address family in sockaddr_size()");
 
 return 0;
   }
+#endif /* WIN32_NATIVE */
 }
 
 /***


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


[Freeciv-commits] r27904 - /branches/S2_6/utility/netintf.c

2015-01-29 Thread cazfi74
Author: cazfi
Date: Fri Jan 30 05:05:03 2015
New Revision: 27904

URL: http://svn.gna.org/viewcvs/freeciv?rev=27904&view=rev
Log:
Consider any kind of sockaddr size to be size of whole fc_sockaddr union in 
Windows builds.

See bug #22448

Modified:
branches/S2_6/utility/netintf.c

Modified: branches/S2_6/utility/netintf.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/netintf.c?rev=27904&r1=27903&r2=27904&view=diff
==
--- branches/S2_6/utility/netintf.c (original)
+++ branches/S2_6/utility/netintf.c Fri Jan 30 05:05:03 2015
@@ -295,6 +295,9 @@
 ***/
 int sockaddr_size(union fc_sockaddr *addr)
 {
+#ifdef WIN32_NATIVE
+  return sizeof(*addr);
+#else
 #ifdef IPV6_SUPPORT
   if (addr->saddr.sa_family == AF_INET6) {
 return sizeof(addr->saddr_in6);
@@ -305,10 +308,11 @@
   } else {
 fc_assert(FALSE);
 
-log_error("Unsupported address family in socaddr_size()");
+log_error("Unsupported address family in sockaddr_size()");
 
 return 0;
   }
+#endif /* WIN32_NATIVE */
 }
 
 /***


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


[Freeciv-commits] r27902 - in /branches/S2_6: server/settings.c server/settings.h tools/ruledit/rulesave.c

2015-01-29 Thread cazfi74
Author: cazfi
Date: Thu Jan 29 22:32:05 2015
New Revision: 27902

URL: http://svn.gna.org/viewcvs/freeciv?rev=27902&view=rev
Log:
Save game.ruleset settings -section.

See bug #23124

Modified:
branches/S2_6/server/settings.c
branches/S2_6/server/settings.h
branches/S2_6/tools/ruledit/rulesave.c

Modified: branches/S2_6/server/settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/settings.c?rev=27902&r1=27901&r2=27902&view=diff
==
--- branches/S2_6/server/settings.c (original)
+++ branches/S2_6/server/settings.c Thu Jan 29 22:32:05 2015
@@ -184,7 +184,6 @@
   }
 
 static bool set_enum_value(struct setting *pset, int val);
-static int read_enum_value(const struct setting *pset);
 
 /
   Enumerator name accessors.
@@ -2868,6 +2867,16 @@
 }
 
 /
+  Get value of boolean setting
+/
+bool setting_bool_get(struct setting *pset)
+{
+  fc_assert(setting_type(pset) == SSET_BOOL);
+
+  return *pset->boolean.pvalue;
+}
+
+/
   Returns TRUE if 'val' is a valid value for this setting. If it's not,
   the reason of the failure is available in the optionnal parameter
   'reject_msg'.
@@ -2970,6 +2979,16 @@
 }
 
 /
+  Get value of integer setting
+/
+int setting_int_get(struct setting *pset)
+{
+  fc_assert(setting_type(pset) == SSET_INT);
+
+  return *pset->integer.pvalue;
+}
+
+/
   Compute the string representation of the value for this string setting.
 /
 static const char *setting_str_to_str(const struct setting *pset,
@@ -3031,10 +3050,20 @@
 }
 
 /
+  Get value of string setting
+/
+char *setting_str_get(struct setting *pset)
+{
+  fc_assert(setting_type(pset) == SSET_STRING);
+
+  return pset->string.value;
+} 
+
+/
   Convert the integer to the long support string representation of an
   enumerator. This function must match the secfile_enum_name_data_fn_t type.
 /
-static const char *setting_enum_secfile_str(secfile_data_t data, int val)
+const char *setting_enum_secfile_str(secfile_data_t data, int val)
 {
   const struct sset_val_name *name =
   ((const struct setting *) data)->enumerator.name(val);
@@ -3149,7 +3178,7 @@
 /
   Helper function to read value from enumerator setting 
 /
-static int read_enum_value(const struct setting *pset)
+int read_enum_value(const struct setting *pset)
 {
   int val;
 
@@ -3219,7 +3248,7 @@
   Convert the integer to the long support string representation of an
   enumerator. This function must match the secfile_enum_name_data_fn_t type.
 /
-static const char *setting_bitwise_secfile_str(secfile_data_t data, int bit)
+const char *setting_bitwise_secfile_str(secfile_data_t data, int bit)
 {
   const struct sset_val_name *name =
   ((const struct setting *) data)->bitwise.name(bit);
@@ -3395,6 +3424,16 @@
 
   return setting_bitwise_validate_base(pset, val, &int_val, caller,
reject_msg, reject_msg_len);
+}
+
+/
+  Get value of bitwise setting
+/
+int setting_bitwise_get(struct setting *pset)
+{
+  fc_assert(setting_type(pset) == SSET_BITWISE);
+
+  return *pset->bitwise.pvalue;
 }
 
 /

Modified: branches/S2_6/server/settings.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/settings.h?rev=27902&r1=27901&r2=27902&view=diff
==
--- branches/S2_6/server/settings.h (original)
+++ branches/S2_6/server/settings.h Thu Jan 29 22:32:05 2015
@@ -113,6 +113,10 @@
 
 void setting_set_to_default(struct setting *pset);
 
+int read_enum_value(const struct setting *pset);
+const char *se

[Freeciv-commits] r27901 - in /trunk: server/settings.c server/settings.h tools/ruledit/rulesave.c

2015-01-29 Thread cazfi74
Author: cazfi
Date: Thu Jan 29 22:31:57 2015
New Revision: 27901

URL: http://svn.gna.org/viewcvs/freeciv?rev=27901&view=rev
Log:
Save game.ruleset settings -section.

See bug #23124

Modified:
trunk/server/settings.c
trunk/server/settings.h
trunk/tools/ruledit/rulesave.c

Modified: trunk/server/settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/settings.c?rev=27901&r1=27900&r2=27901&view=diff
==
--- trunk/server/settings.c (original)
+++ trunk/server/settings.c Thu Jan 29 22:31:57 2015
@@ -184,7 +184,6 @@
   }
 
 static bool set_enum_value(struct setting *pset, int val);
-static int read_enum_value(const struct setting *pset);
 
 /
   Enumerator name accessors.
@@ -2868,6 +2867,16 @@
 }
 
 /
+  Get value of boolean setting
+/
+bool setting_bool_get(struct setting *pset)
+{
+  fc_assert(setting_type(pset) == SSET_BOOL);
+
+  return *pset->boolean.pvalue;
+}
+
+/
   Returns TRUE if 'val' is a valid value for this setting. If it's not,
   the reason of the failure is available in the optionnal parameter
   'reject_msg'.
@@ -2970,6 +2979,16 @@
 }
 
 /
+  Get value of integer setting
+/
+int setting_int_get(struct setting *pset)
+{
+  fc_assert(setting_type(pset) == SSET_INT);
+
+  return *pset->integer.pvalue;
+}
+
+/
   Compute the string representation of the value for this string setting.
 /
 static const char *setting_str_to_str(const struct setting *pset,
@@ -3031,10 +3050,20 @@
 }
 
 /
+  Get value of string setting
+/
+char *setting_str_get(struct setting *pset)
+{
+  fc_assert(setting_type(pset) == SSET_STRING);
+
+  return pset->string.value;
+} 
+
+/
   Convert the integer to the long support string representation of an
   enumerator. This function must match the secfile_enum_name_data_fn_t type.
 /
-static const char *setting_enum_secfile_str(secfile_data_t data, int val)
+const char *setting_enum_secfile_str(secfile_data_t data, int val)
 {
   const struct sset_val_name *name =
   ((const struct setting *) data)->enumerator.name(val);
@@ -3149,7 +3178,7 @@
 /
   Helper function to read value from enumerator setting 
 /
-static int read_enum_value(const struct setting *pset)
+int read_enum_value(const struct setting *pset)
 {
   int val;
 
@@ -3219,7 +3248,7 @@
   Convert the integer to the long support string representation of an
   enumerator. This function must match the secfile_enum_name_data_fn_t type.
 /
-static const char *setting_bitwise_secfile_str(secfile_data_t data, int bit)
+const char *setting_bitwise_secfile_str(secfile_data_t data, int bit)
 {
   const struct sset_val_name *name =
   ((const struct setting *) data)->bitwise.name(bit);
@@ -3395,6 +3424,16 @@
 
   return setting_bitwise_validate_base(pset, val, &int_val, caller,
reject_msg, reject_msg_len);
+}
+
+/
+  Get value of bitwise setting
+/
+int setting_bitwise_get(struct setting *pset)
+{
+  fc_assert(setting_type(pset) == SSET_BITWISE);
+
+  return *pset->bitwise.pvalue;
 }
 
 /

Modified: trunk/server/settings.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/settings.h?rev=27901&r1=27900&r2=27901&view=diff
==
--- trunk/server/settings.h (original)
+++ trunk/server/settings.h Thu Jan 29 22:31:57 2015
@@ -113,6 +113,10 @@
 
 void setting_set_to_default(struct setting *pset);
 
+int read_enum_value(const struct setting *pset);
+const char *setting_enum_secfile_str(secfile_data_t data, int val);
+const char *setting_bitwise_secfi

[Freeciv-commits] r27900 - /branches/S2_6/common/research.c

2015-01-29 Thread pepeto69
Author: pepeto
Date: Thu Jan 29 21:32:34 2015
New Revision: 27900

URL: http://svn.gna.org/viewcvs/freeciv?rev=27900&view=rev
Log:
Make translation of "Future Tech %d" possible, as it was in earlier versions.

See gna bug #23222

Modified:
branches/S2_6/common/research.c

Modified: branches/S2_6/common/research.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/research.c?rev=27900&r1=27899&r2=27900&view=diff
==
--- branches/S2_6/common/research.c (original)
+++ branches/S2_6/common/research.c Thu Jan 29 21:32:34 2015
@@ -279,9 +279,7 @@
 }
 
 /* NB: 'presearch->future_tech == 0' means "Future Tech. 1". */
-fc_snprintf(buffer, sizeof(buffer), "%s %d",
-name_translation(&advance_future_name),
-no + 1);
+fc_snprintf(buffer, sizeof(buffer), _("Future Tech. %d"), no + 1);
 name = research_future_set_name(future_name_translation, no, buffer);
 fc_assert(name != NULL);
 fc_assert(name != buffer);


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


[Freeciv-commits] r27899 - /trunk/common/research.c

2015-01-29 Thread pepeto69
Author: pepeto
Date: Thu Jan 29 21:32:28 2015
New Revision: 27899

URL: http://svn.gna.org/viewcvs/freeciv?rev=27899&view=rev
Log:
Make translation of "Future Tech %d" possible, as it was in earlier versions.

See gna bug #23222

Modified:
trunk/common/research.c

Modified: trunk/common/research.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/research.c?rev=27899&r1=27898&r2=27899&view=diff
==
--- trunk/common/research.c (original)
+++ trunk/common/research.c Thu Jan 29 21:32:28 2015
@@ -279,9 +279,7 @@
 }
 
 /* NB: 'presearch->future_tech == 0' means "Future Tech. 1". */
-fc_snprintf(buffer, sizeof(buffer), "%s %d",
-name_translation(&advance_future_name),
-no + 1);
+fc_snprintf(buffer, sizeof(buffer), _("Future Tech. %d"), no + 1);
 name = research_future_set_name(future_name_translation, no, buffer);
 fc_assert(name != NULL);
 fc_assert(name != buffer);


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


[Freeciv-commits] r27895 - /trunk/common/research.c

2015-01-29 Thread pepeto69
Author: pepeto
Date: Thu Jan 29 21:28:50 2015
New Revision: 27895

URL: http://svn.gna.org/viewcvs/freeciv?rev=27895&view=rev
Log:
Use two string vector to store future technology names (one for untranslated
names, one for translated name).

Side effect: make proprer string freeing, reported by mir3x  (see
bug #23220).

See gna bug #23221

Modified:
trunk/common/research.c

Modified: trunk/common/research.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/research.c?rev=27895&r1=27894&r2=27895&view=diff
==
--- trunk/common/research.c (original)
+++ trunk/common/research.c Thu Jan 29 21:28:50 2015
@@ -18,6 +18,7 @@
 #include "iterator.h"
 #include "log.h"
 #include "shared.h"
+#include "string_vector.h"
 #include "support.h"
 
 /* common */
@@ -52,15 +53,8 @@
 static struct name_translation advance_future_name = NAME_INIT;
 static struct name_translation advance_unknown_name = NAME_INIT;
 
-#define SPECVEC_TAG string
-#define SPECVEC_TYPE char *
-#include "specvec.h"
-
-#define string_vector_iterate(str_vec, str) \
-  TYPED_VECTOR_ITERATE(char *, str_vec, str)
-#define string_vector_iterate_end VECTOR_ITERATE_END
-
-static struct string_vector future;
+static struct strvec *future_rule_name;
+static struct strvec *future_name_translation;
 
 /
   Initializes all player research structure.
@@ -91,7 +85,8 @@
   /* TRANS: "Unknown" advance/technology */
   name_set(&advance_unknown_name, NULL, N_("(Unknown)"));
 
-  string_vector_init(&future);
+  future_rule_name = strvec_new();
+  future_name_translation = strvec_new();
 }
 
 /
@@ -99,11 +94,8 @@
 /
 void researches_free(void)
 {
-  string_vector_iterate(&future, str) {
-free(str);
-  } string_vector_iterate_end;
-
-  string_vector_free(&future);
+  strvec_destroy(future_rule_name);
+  strvec_destroy(future_name_translation);
 }
 
 /
@@ -214,6 +206,25 @@
 }
 
 /
+  Set a new future tech name in the string vector, and return the string
+  duplicate stored inside the vector.
+/
+static const char *research_future_set_name(struct strvec *psv, int no,
+const char *new_name)
+{
+  if (strvec_size(psv) <= no) {
+/* Increase the size of the vector if needed. */
+strvec_reserve(psv, no + 1);
+  }
+
+  /* Set in vector. */
+  strvec_set(psv, no, new_name);
+
+  /* Return duplicate of 'new_name'. */
+  return strvec_get(psv, no);
+}
+
+/
   Store the rule name of the given tech (including A_FUTURE) in 'buf'.
   'presearch' may be NULL.
   We don't return a static buffer because that would break anything that
@@ -224,21 +235,23 @@
 {
   if (A_FUTURE == tech && NULL != presearch) {
 const int no = presearch->future_tech;
-int i;
-
-/* research->future_tech == 0 means "Future Tech. 1". */
-for (i = future.size; i <= no; i++) {
-  string_vector_append(&future, NULL);
-}
-if (NULL == future.p[no]) {
-  char buffer[256];
-
-  fc_snprintf(buffer, sizeof(buffer), "%s %d",
-  rule_name(&advance_future_name),
-  no + 1);
-  future.p[no] = fc_strdup(buffer);
-}
-return future.p[no];
+char buffer[256];
+const char *name;
+
+name = strvec_get(future_rule_name, no);
+if (name != NULL) {
+  /* Already stored in string vector. */
+  return name;
+}
+
+/* NB: 'presearch->future_tech == 0' means "Future Tech. 1". */
+fc_snprintf(buffer, sizeof(buffer), "%s %d",
+rule_name(&advance_future_name),
+no + 1);
+name = research_future_set_name(future_rule_name, no, buffer);
+fc_assert(name != NULL);
+fc_assert(name != buffer);
+return name;
   }
 
   return rule_name(research_advance_name(tech));
@@ -256,21 +269,23 @@
 {
   if (A_FUTURE == tech && NULL != presearch) {
 const int no = presearch->future_tech;
-int i;
-
-/* research->future_tech == 0 means "Future Tech. 1". */
-for (i = future.size; i <= no; i++) {
-  string_vector_append(&future, NULL);
-}
-if (NULL == future.p[no]) {
-  char buffer[256];
-
-  fc_snprintf(buffer, sizeof(buffer), "%s %d",
-  name_translation(&advance_future_name),
-  no + 1);
-  future.p[no] = fc_strdup(buffer);
-}
-return future.p[no];
+char buffer[256];
+const char *name;
+
+name = strvec_get(future_name_translation, no);
+if (name != NU

[Freeciv-commits] r27896 - /branches/S2_6/common/research.c

2015-01-29 Thread pepeto69
Author: pepeto
Date: Thu Jan 29 21:28:54 2015
New Revision: 27896

URL: http://svn.gna.org/viewcvs/freeciv?rev=27896&view=rev
Log:
Use two string vector to store future technology names (one for untranslated
names, one for translated name).

Side effect: make proprer string freeing, reported by mir3x  (see
bug #23220).

See gna bug #23221

Modified:
branches/S2_6/common/research.c

Modified: branches/S2_6/common/research.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/research.c?rev=27896&r1=27895&r2=27896&view=diff
==
--- branches/S2_6/common/research.c (original)
+++ branches/S2_6/common/research.c Thu Jan 29 21:28:54 2015
@@ -18,6 +18,7 @@
 #include "iterator.h"
 #include "log.h"
 #include "shared.h"
+#include "string_vector.h"
 #include "support.h"
 
 /* common */
@@ -52,15 +53,8 @@
 static struct name_translation advance_future_name = NAME_INIT;
 static struct name_translation advance_unknown_name = NAME_INIT;
 
-#define SPECVEC_TAG string
-#define SPECVEC_TYPE char *
-#include "specvec.h"
-
-#define string_vector_iterate(str_vec, str) \
-  TYPED_VECTOR_ITERATE(char *, str_vec, str)
-#define string_vector_iterate_end VECTOR_ITERATE_END
-
-static struct string_vector future;
+static struct strvec *future_rule_name;
+static struct strvec *future_name_translation;
 
 /
   Initializes all player research structure.
@@ -91,7 +85,8 @@
   /* TRANS: "Unknown" advance/technology */
   name_set(&advance_unknown_name, NULL, N_("(Unknown)"));
 
-  string_vector_init(&future);
+  future_rule_name = strvec_new();
+  future_name_translation = strvec_new();
 }
 
 /
@@ -99,11 +94,8 @@
 /
 void researches_free(void)
 {
-  string_vector_iterate(&future, str) {
-free(str);
-  } string_vector_iterate_end;
-
-  string_vector_free(&future);
+  strvec_destroy(future_rule_name);
+  strvec_destroy(future_name_translation);
 }
 
 /
@@ -214,6 +206,25 @@
 }
 
 /
+  Set a new future tech name in the string vector, and return the string
+  duplicate stored inside the vector.
+/
+static const char *research_future_set_name(struct strvec *psv, int no,
+const char *new_name)
+{
+  if (strvec_size(psv) <= no) {
+/* Increase the size of the vector if needed. */
+strvec_reserve(psv, no + 1);
+  }
+
+  /* Set in vector. */
+  strvec_set(psv, no, new_name);
+
+  /* Return duplicate of 'new_name'. */
+  return strvec_get(psv, no);
+}
+
+/
   Store the rule name of the given tech (including A_FUTURE) in 'buf'.
   'presearch' may be NULL.
   We don't return a static buffer because that would break anything that
@@ -224,21 +235,23 @@
 {
   if (A_FUTURE == tech && NULL != presearch) {
 const int no = presearch->future_tech;
-int i;
-
-/* research->future_tech == 0 means "Future Tech. 1". */
-for (i = future.size; i <= no; i++) {
-  string_vector_append(&future, NULL);
-}
-if (NULL == future.p[no]) {
-  char buffer[256];
-
-  fc_snprintf(buffer, sizeof(buffer), "%s %d",
-  rule_name(&advance_future_name),
-  no + 1);
-  future.p[no] = fc_strdup(buffer);
-}
-return future.p[no];
+char buffer[256];
+const char *name;
+
+name = strvec_get(future_rule_name, no);
+if (name != NULL) {
+  /* Already stored in string vector. */
+  return name;
+}
+
+/* NB: 'presearch->future_tech == 0' means "Future Tech. 1". */
+fc_snprintf(buffer, sizeof(buffer), "%s %d",
+rule_name(&advance_future_name),
+no + 1);
+name = research_future_set_name(future_rule_name, no, buffer);
+fc_assert(name != NULL);
+fc_assert(name != buffer);
+return name;
   }
 
   return rule_name(research_advance_name(tech));
@@ -256,21 +269,23 @@
 {
   if (A_FUTURE == tech && NULL != presearch) {
 const int no = presearch->future_tech;
-int i;
-
-/* research->future_tech == 0 means "Future Tech. 1". */
-for (i = future.size; i <= no; i++) {
-  string_vector_append(&future, NULL);
-}
-if (NULL == future.p[no]) {
-  char buffer[256];
-
-  fc_snprintf(buffer, sizeof(buffer), "%s %d",
-  name_translation(&advance_future_name),
-  no + 1);
-  future.p[no] = fc_strdup(buffer);
-}
-return future.p[no];
+char buffer[256];
+const char *name;
+
+name = strvec_get(future_na

[Freeciv-commits] r27897 - /branches/S2_5/common/tech.c

2015-01-29 Thread pepeto69
Author: pepeto
Date: Thu Jan 29 21:28:58 2015
New Revision: 27897

URL: http://svn.gna.org/viewcvs/freeciv?rev=27897&view=rev
Log:
Use two string vector to store future technology names (one for untranslated
names, one for translated name).

Side effect: make proprer string freeing, reported by mir3x  (see
bug #23220).

See gna bug #23221

Modified:
branches/S2_5/common/tech.c

Modified: branches/S2_5/common/tech.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/tech.c?rev=27897&r1=27896&r2=27897&view=diff
==
--- branches/S2_5/common/tech.c (original)
+++ branches/S2_5/common/tech.c Thu Jan 29 21:28:58 2015
@@ -50,15 +50,8 @@
 
 static struct user_flag user_tech_flags[MAX_NUM_USER_TECH_FLAGS];
 
-#define SPECVEC_TAG string
-#define SPECVEC_TYPE char *
-#include "specvec.h"
-
-#define string_vector_iterate(str_vec, str) \
-  TYPED_VECTOR_ITERATE(char *, str_vec, str)
-#define string_vector_iterate_end VECTOR_ITERATE_END
-
-static struct string_vector future;
+static struct strvec *future_rule_name;
+static struct strvec *future_name_translation;
 
 /**
   Return the last item of advances/technologies.
@@ -982,6 +975,25 @@
   return tech == A_FUTURE;
 }
 
+/
+  Set a new future tech name in the string vector, and return the string
+  duplicate stored inside the vector.
+/
+static const char *future_set_name(struct strvec *psv, int no,
+   const char *new_name)
+{
+  if (strvec_size(psv) <= no) {
+/* Increase the size of the vector if needed. */
+strvec_reserve(psv, no + 1);
+  }
+
+  /* Set in vector. */
+  strvec_set(psv, no, new_name);
+
+  /* Return duplicate of 'new_name'. */
+  return strvec_get(psv, no);
+}
+
 /**
   Return the rule name of the given tech (including A_FUTURE). 
   You don't have to free the return pointer.
@@ -997,22 +1009,24 @@
   switch (tech) {
   case A_FUTURE:
 if (pplayer) {
-  struct player_research *research = player_research_get(pplayer);
-  int i;
-  
-  /* pplayer->future_tech == 0 means "Future Tech. 1". */
-  for (i = future.size; i <= research->future_tech; i++) {
-string_vector_append(&future, NULL);
+  const int no = player_research_get(pplayer)->future_tech;
+  char buffer[256];
+  const char *name;
+
+  name = strvec_get(future_rule_name, no);
+  if (name != NULL) {
+/* Already stored in string vector. */
+return name;
   }
-  if (!future.p[research->future_tech]) {
-char buffer[1024];
-
-fc_snprintf(buffer, sizeof(buffer), "%s %d",
-advance_rule_name(&advances[tech]),
-research->future_tech + 1);
-future.p[research->future_tech] = fc_strdup(buffer);
-  }
-  return future.p[research->future_tech];
+
+  /* NB: 'presearch->future_tech == 0' means "Future Tech. 1". */
+  fc_snprintf(buffer, sizeof(buffer), "%s %d",
+  advance_rule_name(&advances[tech]),
+  no + 1);
+  name = future_set_name(future_rule_name, no, buffer);
+  fc_assert(name != NULL);
+  fc_assert(name != buffer);
+  return name;
 } else {
   return advance_rule_name(&advances[tech]);
 }
@@ -1040,21 +1054,22 @@
   switch (tech) {
   case A_FUTURE:
 if (pplayer) {
-  struct player_research *research = player_research_get(pplayer);
-  int i;
-  
-  /* pplayer->future_tech == 0 means "Future Tech. 1". */
-  for (i = future.size; i <= research->future_tech; i++) {
-string_vector_append(&future, NULL);
+  const int no = player_research_get(pplayer)->future_tech;
+  char buffer[256];
+  const char *name;
+
+  name = strvec_get(future_name_translation, no);
+  if (name != NULL) {
+/* Already stored in string vector. */
+return name;
   }
-  if (!future.p[research->future_tech]) {
-char buffer[1024];
-
-fc_snprintf(buffer, sizeof(buffer), _("Future Tech. %d"),
-research->future_tech + 1);
-future.p[research->future_tech] = fc_strdup(buffer);
-  }
-  return future.p[research->future_tech];
+
+  /* NB: 'presearch->future_tech == 0' means "Future Tech. 1". */
+  fc_snprintf(buffer, sizeof(buffer), _("Future Tech. %d"), no + 1);
+  name = future_set_name(future_name_translation, no, buffer);
+  fc_assert(name != NULL);
+  fc_assert(name != buffer);
+  return name;
 } else {
   return advance_name_translation(&advances[tech]);
 }
@@ -1210,7 +1225,8 @@
   /* TRANS: "Unknown" advance/technology */
   name_set(&advances[A_UNKNOWN].name,

[Freeciv-commits] r27898 - /branches/S2_4/common/tech.c

2015-01-29 Thread pepeto69
Author: pepeto
Date: Thu Jan 29 21:29:03 2015
New Revision: 27898

URL: http://svn.gna.org/viewcvs/freeciv?rev=27898&view=rev
Log:
Use two string vector to store future technology names (one for untranslated
names, one for translated name).

Side effect: make proprer string freeing, reported by mir3x  (see
bug #23220).

See gna bug #23221

Modified:
branches/S2_4/common/tech.c

Modified: branches/S2_4/common/tech.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/common/tech.c?rev=27898&r1=27897&r2=27898&view=diff
==
--- branches/S2_4/common/tech.c (original)
+++ branches/S2_4/common/tech.c Thu Jan 29 21:29:03 2015
@@ -48,15 +48,8 @@
  * the sciencebox multiplier. */
 static double techcoststyle1[A_LAST];
 
-#define SPECVEC_TAG string
-#define SPECVEC_TYPE char *
-#include "specvec.h"
-
-#define string_vector_iterate(str_vec, str) \
-  TYPED_VECTOR_ITERATE(char *, str_vec, str)
-#define string_vector_iterate_end VECTOR_ITERATE_END
-
-static struct string_vector future;
+static struct strvec *future_rule_name;
+static struct strvec *future_name_translation;
 
 /**
   Return the last item of advances/technologies.
@@ -967,6 +960,25 @@
   return tech == A_FUTURE;
 }
 
+/
+  Set a new future tech name in the string vector, and return the string
+  duplicate stored inside the vector.
+/
+static const char *future_set_name(struct strvec *psv, int no,
+   const char *new_name)
+{
+  if (strvec_size(psv) <= no) {
+/* Increase the size of the vector if needed. */
+strvec_reserve(psv, no + 1);
+  }
+
+  /* Set in vector. */
+  strvec_set(psv, no, new_name);
+
+  /* Return duplicate of 'new_name'. */
+  return strvec_get(psv, no);
+}
+
 /**
   Return the rule name of the given tech (including A_FUTURE). 
   You don't have to free the return pointer.
@@ -982,22 +994,24 @@
   switch (tech) {
   case A_FUTURE:
 if (pplayer) {
-  struct player_research *research = player_research_get(pplayer);
-  int i;
-  
-  /* pplayer->future_tech == 0 means "Future Tech. 1". */
-  for (i = future.size; i <= research->future_tech; i++) {
-string_vector_append(&future, NULL);
+  const int no = player_research_get(pplayer)->future_tech;
+  char buffer[256];
+  const char *name;
+
+  name = strvec_get(future_rule_name, no);
+  if (name != NULL) {
+/* Already stored in string vector. */
+return name;
   }
-  if (!future.p[research->future_tech]) {
-char buffer[1024];
-
-fc_snprintf(buffer, sizeof(buffer), "%s %d",
-advance_rule_name(&advances[tech]),
-research->future_tech + 1);
-future.p[research->future_tech] = fc_strdup(buffer);
-  }
-  return future.p[research->future_tech];
+
+  /* NB: 'presearch->future_tech == 0' means "Future Tech. 1". */
+  fc_snprintf(buffer, sizeof(buffer), "%s %d",
+  advance_rule_name(&advances[tech]),
+  no + 1);
+  name = future_set_name(future_rule_name, no, buffer);
+  fc_assert(name != NULL);
+  fc_assert(name != buffer);
+  return name;
 } else {
   return advance_rule_name(&advances[tech]);
 }
@@ -1025,21 +1039,22 @@
   switch (tech) {
   case A_FUTURE:
 if (pplayer) {
-  struct player_research *research = player_research_get(pplayer);
-  int i;
-  
-  /* pplayer->future_tech == 0 means "Future Tech. 1". */
-  for (i = future.size; i <= research->future_tech; i++) {
-string_vector_append(&future, NULL);
+  const int no = player_research_get(pplayer)->future_tech;
+  char buffer[256];
+  const char *name;
+
+  name = strvec_get(future_name_translation, no);
+  if (name != NULL) {
+/* Already stored in string vector. */
+return name;
   }
-  if (!future.p[research->future_tech]) {
-char buffer[1024];
-
-fc_snprintf(buffer, sizeof(buffer), _("Future Tech. %d"),
-research->future_tech + 1);
-future.p[research->future_tech] = fc_strdup(buffer);
-  }
-  return future.p[research->future_tech];
+
+  /* NB: 'presearch->future_tech == 0' means "Future Tech. 1". */
+  fc_snprintf(buffer, sizeof(buffer), _("Future Tech. %d"), no + 1);
+  name = future_set_name(future_name_translation, no, buffer);
+  fc_assert(name != NULL);
+  fc_assert(name != buffer);
+  return name;
 } else {
   return advance_name_translation(&advances[tech]);
 }
@@ -1120,7 +1135,8 @@
   /* TRANS: "Unknown" advance/technology */
   name_set(&advances[A_UNKNOWN].na

[Freeciv-commits] r27893 - /trunk/server/unithand.c

2015-01-29 Thread sveinung84
Author: sveinung
Date: Thu Jan 29 18:01:41 2015
New Revision: 27893

URL: http://svn.gna.org/viewcvs/freeciv?rev=27893&view=rev
Log:
Server: Don't accept a unit order packet with a compatibility activity.

The activities ACTIVITY_FORTRESS and ACTIVITY_AIRBASE aren't supposed to be
sent from clients.

See patch #5765

Modified:
trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=27893&r1=27892&r2=27893&view=diff
==
--- trunk/server/unithand.c (original)
+++ trunk/server/unithand.c Thu Jan 29 18:01:41 2015
@@ -2912,9 +2912,7 @@
   case ACTIVITY_POLLUTION:
   case ACTIVITY_MINE:
   case ACTIVITY_IRRIGATE:
-  case ACTIVITY_FORTRESS:
   case ACTIVITY_TRANSFORM:
-  case ACTIVITY_AIRBASE:
/* Simple activities. */
break;
   case ACTIVITY_SENTRY:


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


[Freeciv-commits] r27894 - /branches/S2_6/server/unithand.c

2015-01-29 Thread sveinung84
Author: sveinung
Date: Thu Jan 29 18:22:28 2015
New Revision: 27894

URL: http://svn.gna.org/viewcvs/freeciv?rev=27894&view=rev
Log:
Server: Don't accept a unit order packet with a compatibility activity.

The activities ACTIVITY_FORTRESS and ACTIVITY_AIRBASE aren't supposed to be
sent from clients.

See patch #5765

Modified:
branches/S2_6/server/unithand.c

Modified: branches/S2_6/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/unithand.c?rev=27894&r1=27893&r2=27894&view=diff
==
--- branches/S2_6/server/unithand.c (original)
+++ branches/S2_6/server/unithand.c Thu Jan 29 18:22:28 2015
@@ -2863,9 +2863,7 @@
   case ACTIVITY_POLLUTION:
   case ACTIVITY_MINE:
   case ACTIVITY_IRRIGATE:
-  case ACTIVITY_FORTRESS:
   case ACTIVITY_TRANSFORM:
-  case ACTIVITY_AIRBASE:
/* Simple activities. */
break;
   case ACTIVITY_SENTRY:


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