Re: [Freeciv-Dev] (PR#40007) Crash when upgrading unit using Japanese language

2008-01-13 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=40007 >

Was finally able to get some labels showing in Japanese (mostly _Quit,
_Cancel, but hardly any other buttons) -- the upgrade dialog showed English,
and it didn't crash

I started it with LANG=JA ./civ

What am I doing wrong?

Could it be that I'm using MacOS?  Is this a Windows-only problem?



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


[Freeciv-Dev] (PR#40015) Tracking 2.1.3 release

2008-01-13 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=40015 >

Time to give a heads up to translators, and do general testing.

Should be ready in a week?



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


Re: [Freeciv-Dev] (PR#40014) helpdata.c implicit declaration of strlcpy()

2008-01-13 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=40014 >

Committed trunk revision 14234.
Committed S2_2 revision 14235.
Committed S2_1 revision 14236.

Index: client/helpdata.c
===
--- client/helpdata.c   (revision 14233)
+++ client/helpdata.c   (working copy)
@@ -1124,7 +1124,7 @@
   };
 
   assert(NULL != buf && 0 < bufsz && NULL != user_text);
-  strlcpy(buf, user_text, bufsz);
+  mystrlcpy(buf, user_text, bufsz);
 
   if (NULL == vap) {
 freelog(LOG_ERROR, "Unknown tech %d.", i);
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40013) helpdata.c more checking buffer sizes

2008-01-13 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=40013 >

Committed trunk revision 14231.
Committed S2_2 revision 14232.
Committed S2_1 as part of revision 14233, with update-po to fix TRANS
comments.

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


Re: [Freeciv-Dev] (PR#40013) helpdata.c more checking buffer sizes

2008-01-13 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=40013 >

Madeline Book wrote:
> ... would it
> not seem terribly inefficient to have to find the end of the string
> on every single call to a cat/CAT* function? 

Briefly, no.

1) I'm not the original designer of this code, I'm just fixing crashing bugs
at the moment  Spending most of 1 day just fixing this in place line
by line was much more efficient than spending 3+ days redesigning it.
There are plans to move more of the data into rulesets someday, at which
time redesign might be fruitful.

2) Finding the end of a string is pretty fast, vastly faster than the
*printf() formatting.  If it weren't for the odd translation problems,
I'd probably have used cat_snprintf() for everything!  But strlcat() is
better where there's no c-format, as it avoids/fixes escaping issues.

3) These functions are called by the client in response to a user bringing
up the help dialog, something that is done rarely -- and the client has
time to dance a tarantella between every user click.  Speed is not an
issue here!


> Why not just make a dynamic buffer type, and do any with all this
> gigantic static buffer nonsense? E.g.
> 
4) memory allocation, reallocation, and deallocation are fairly slow,
especially compared to strlen(), strlcat(), etc.  Also leads to memory
fragmentation, and heap recovery is exceptionally slow!  On long games,
we've seen huge swap space and perceptible delays.  Some of that is due
to memory leaks, many fixed in 2.2 -- but stack buffers don't suffer
from memory fragmentation or leaks!

5) The functions you desire are already defined in utility/astring.[ch]

6) Generally, I've been ripping out astr_* rather than adding more



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


[Freeciv-Dev] (PR#40013) helpdata.c more checking buffer sizes

2008-01-13 Thread Madeline Book

http://bugs.freeciv.org/Ticket/Display.html?id=40013 >

> [wsimpson - Mon Jan 14 02:21:34 2008]:
> 
> Discovered more egregious lack of checking buffer sizes, this time
> loading
> help text data from the file.  Instead, there's a long_buffer[64000],
> ...

Given that so much text is written (needing a 64K buffer), and that
there are so many occurences of cat_snprintf (that rather than re-
writing each call to strlcat, a macro CATLSTR is need just to avoid
changing the order of arguments in all places it is used), would it
not seem terribly inefficient to have to find the end of the string
on every single call to a cat/CAT* function? Would it not be just
as simple to code (a macro is even used already) to keep a pointer
to the end of the buffer, which would be incremented by the number
of bytes written, just as the remaining space in the buffer would
be decremented?

Why not just make a dynamic buffer type, and do any with all this
gigantic static buffer nonsense? E.g.

dynamic_buffer *buf = dynamic_buffer_new(1024);  /* initial size 1024 */
...
dynamic_buffer_cat_snprintf(buf, ...);
dynamic_buffer_strcat(buf, ...);/* size doubles if needed */
...
dynamic_buffer_free(buf);
etc.

I say this because I have come in contact with many places that
would benefit from such buffers (but certainly you would know
better than I)...


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


[Freeciv-Dev] (PR#40014) helpdata.c implicit declaration of strlcpy()

2008-01-13 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=40014 >

Sorry, force of habit, I momentarily forgot that not all systems have
strlcpy(), despite its presence on *BSD (and MacOS) machines for 10+ years.
This was the only one extant.  Correcting to our local mystrlcpy().

===
Date: Sun, 13 Jan 2008 18:40:58 -0800
From: Madeline Book <[EMAIL PROTECTED]>

Make fails (when configured with --enable-debug) due to

helpdata.c: In function `helptext_tech':
helpdata.c:1128: warning: implicit declaration of function `strlcpy'

Possibly there are more such warnings.



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


[Freeciv-Dev] (PR#40012) Make fails with --enable-debug

2008-01-13 Thread Madeline Book

http://bugs.freeciv.org/Ticket/Display.html?id=40012 >

Make fails (when configured with --enable-debug) due to

helpdata.c: In function `helptext_tech':
helpdata.c:1128: warning: implicit declaration of function `strlcpy'


Possibly there are more such warnings.

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


[Freeciv-Dev] Editor design draft up on wikia

2008-01-13 Thread Madeline Book
I have created an (incomplete) rough inital draft of a design document
for the S2_2 integrated map editor:

http://freeciv.wikia.com/wiki/Editor

This was done so that
1. The tasks needed to get the editor ready for use could more easily
be ascertained.
2. Contributors working on the editor and future users will have a common,
easily accessible place to view and post their design ideas.
3. Documentation could more easily be written in the future.
4. I do not have to post a radical, gigantic, all-modifying patch that you
would find difficult to evaluate and test.
5. Small, incremental patchs can be submitted and understood based on the
goals in the document.

I have written only the draft of the first of six major sections,
though it is likely
the most feature-descriptive section (others tend to be more implementation
related), and will write more as I think upon the issues, have time, and grow
more familiar with the existing work on the editor code.

Any comments and suggestions, be they about the content or the form, are of
course duly welcome.

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


[Freeciv-Dev] freeciv losing server

2008-01-13 Thread Tess Lomax
I just installed freeciv from source using make && make install on a
twin dual core opteron. (Tyan K8SE mobo (s2892 mobo), dual 285 cpus, 2Gb
Reg.ECC RAM, NVidia 6800GT], running x86-64 SL5 (RHEL5).

The program runs as far as the end of the first turn. When the button to
complete the turn is pushed, or one attempts to build a city - the
program crashes, and goes back to the start page. 

The error message is that the session has lost contact with the server.

The program runs fine on a Tyan K8E (s2865 mobo) running an opteron 180
cpu, and using the i386 version of SL5.

regards


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


[Freeciv-Dev] (PR#40012) 2.2-test assert in helpdata.c

2008-01-13 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=40012 >

Errors from PR#39831, due to my incomplete implementation of buffer
concatenation length checking.

===

Date:   Sat, 12 Jan 2008 17:52:27 +0100
From:   Joan Creus <[EMAIL PROTECTED]>

...

The message is "Assertion `len_destIndex: client/gui-gtk-2.0/helpdlg.c
===
--- client/gui-gtk-2.0/helpdlg.c(revision 14228)
+++ client/gui-gtk-2.0/helpdlg.c(working copy)
@@ -818,7 +818,7 @@
 utype_name_translation(utype->obsoleted_by));
 }
 
-helptext_unit(buf, utype, pitem->text);
+helptext_unit(buf, sizeof(buf), utype, pitem->text);
 
 gtk_text_buffer_set_text(help_text, buf, -1);
 gtk_widget_show(help_text_sw);
Index: client/gui-xaw/helpdlg.c
===
--- client/gui-xaw/helpdlg.c(revision 14228)
+++ client/gui-xaw/helpdlg.c(working copy)
@@ -863,7 +863,7 @@
utype_name_translation(punittype->obsoleted_by));
 }
 /* add text for transport_capacity, fuel, and flags: */
-helptext_unit(buf, punittype, pitem->text);
+helptext_unit(buf, sizeof(buf), punittype, pitem->text);
 XtVaSetValues(help_text, XtNstring, buf, NULL);
   }
   else {
Index: client/gui-win32/helpdlg.c
===
--- client/gui-win32/helpdlg.c  (revision 14228)
+++ client/gui-win32/helpdlg.c  (working copy)
@@ -734,7 +734,7 @@
 utype_name_translation(utype->obsoleted_by));
 }
 
-helptext_unit(buf, utype, pitem->text);
+helptext_unit(buf, sizeof(buf), utype, pitem->text);
 set_help_text(buf);
   }
   else {
Index: client/gui-sdl/helpdlg.c
===
--- client/gui-sdl/helpdlg.c(revision 14228)
+++ client/gui-sdl/helpdlg.c(working copy)
@@ -837,7 +837,7 @@
   start_x = (area.x + 1 + scrollbar_width + 
pHelpDlg->pActiveWidgetList->size.w + adj_size(20));
 
   buffer[0] = '\0';
-  helptext_unit(buffer, utype_by_number(type_id), "");
+  helptext_unit(buffer, sizeof(buffer), utype_by_number(type_id), "");
   if (buffer[0] != '\0') {
 SDL_String16 *pStr = create_str16_from_char(buffer, adj_font(12));
 convert_string_to_const_surface_width(pStr, adj_size(640) - start_x - 
adj_size(20));
Index: client/helpdata.c
===
--- client/helpdata.c   (revision 14228)
+++ client/helpdata.c   (working copy)
@@ -44,6 +44,9 @@
 
 #include "helpdata.h"
 
+/* helper macro for easy conversion from snprintf and cat_snprintf */
+#define CATLSTR(_b, _s, _t) mystrlcat(_b, _t, _s)
+
 static const char * const help_type_names[] = {
   "(Any)", "(Text)", "Units", "Improvements", "Wonders",
   "Techs", "Terrain", "Governments", NULL
@@ -249,10 +252,9 @@
   /* FIXME: show other data like range and survives. */
 #define COREQ_APPEND(s)
\
   (coreq_buf[0] != '\0'
\
-   ? cat_snprintf(coreq_buf, sizeof(coreq_buf),", %s", (s))\
+   ? cat_snprintf(coreq_buf, sizeof(coreq_buf), Q_("?clistmore:, %s"), (s))  \
: sz_strlcpy(coreq_buf, (s)))
 
-
   improvement_iterate(pimprove) {
 requirement_vector_iterate(&pimprove->reqs, req) {
   if (are_universals_equal(psource, &req->source)) {
@@ -628,15 +630,6 @@
 
 /
   FIXME:
-  All these helptext_* functions have a pretty crappy interface:
-  we just write to buf and hope that its long enough.
-  But I'm not going to fix it right now --dwp.
-  
-  Could also reduce amount/length of strlen's by inserting
-  a few 'buf += strlen(buf)'.
-
-  These functions should always ensure final buf is null-terminated.
-  
   Also, in principle these could be auto-generated once, inserted
   into pitem->text, and then don't need to keep re-generating them.
   Only thing to be careful of would be changeable data, but don't
@@ -661,7 +654,7 @@
 .value = {.building = pimprove}
   };
 
-  assert(buf);
+  assert(NULL != buf && 0 < bufsz);
   buf[0] = '\0';
 
   if (NULL == pimprove) {
@@ -740,15 +733,17 @@
 {
   int count = 0;
 
-  assert(bufsz > 0);
+  assert(NULL != buf && 0 < bufsz);
   buf[0] = '\0';
+
   techs_with_flag_iterate(flag, tech_id) {
 const char *name = advance_name_for_player(game.player_ptr, tech_id);
 
 if (buf[0] == '\0') {
-  cat_snprintf(buf, bufsz, "%s", name);
+  CATLSTR(buf, bufsz, name);
 } else {
-  cat_snprintf(buf, bufsz, ", %s", name);
+  /* TRANS: continue list, in case comma is not the separator of choice. */
+  cat_snprintf(buf, bufsz, Q_("?clistmore:, %s"), name);
 }
 count++;
   } techs_with_flag_iterate_end;
@@ -760,300 +755,300 @@
   Append misc dynamic text for units.
   Transport

[Freeciv-Dev] Fwd: (PR#39687) Typos in nation rulesets

2008-01-13 Thread Joan Creus

http://bugs.freeciv.org/Ticket/Display.html?id=39687 >

This transaction appears to have no content
This fix got forgotten in my mailbox. I have the fix with the same changes,
except I now keep the "devolved" in the purhepecha.ruleset.

Joan

-- Forwarded message --
From: Joan Creus <[EMAIL PROTECTED]>
Date: 09/09/2007 14:22
Subject: Re: [Freeciv-Dev] (PR#39687) Typos in nation rulesets
To: [EMAIL PROTECTED]

You are right. It sounded strange to me, and I looked it up, but I didn't
find the third meaning that says: grow worse; "Her condition
deteriorated".Yep, devolve is fine.

Joan


2007/9/8, Daniel Markstedt < [EMAIL PROTECTED]>:
>
>
> http://bugs.freeciv.org/Ticket/Display.html?id=39687 >
>
> On 9/8/07, Joan Creus <[EMAIL PROTECTED]> wrote:
> >
> > http://bugs.freeciv.org/Ticket/Display.html?id=39687
> > >
> >
> > This transaction appears to have no content
> >
> > I think I have found a few typos in several nations; check them out,
> > particularly two that are in proper nouns, one in khwarezmian and the
> other
> > in breton.ruleset
> >
> > Joan
> >
>
> They look like good fixes. Except one in purhepecha.ruleset - I do
> think "devolved into violence" is proper English.
>
> ~Daniel
>
>
>
This fix got forgotten in my mailbox. I have the fix with the same changes, except I now keep the "devolved" in the purhepecha.ruleset.Joan-- Forwarded message --
From: Joan Creus <[EMAIL PROTECTED]>Date: 09/09/2007 14:22Subject: Re: [Freeciv-Dev] (PR#39687) Typos in nation rulesetsTo: 
[EMAIL PROTECTED]You are right. It sounded strange to me, and I looked it up, but I didn't find the third meaning that says: grow worse; "Her condition deteriorated".

 Yep, devolve is fine.Joan2007/9/8, Daniel Markstedt <

[EMAIL PROTECTED]>:
http://bugs.freeciv.org/Ticket/Display.html?id=39687 >On 9/8/07, Joan Creus <[EMAIL PROTECTED]
> wrote:>> 
http://bugs.freeciv.org/Ticket/Display.html?id=39687> >>> This transaction appears to have no content>> I think I have found a few typos in several nations; check them out,> particularly two that are in proper nouns, one in khwarezmian and the other
> in breton.ruleset>> Joan>They look like good fixes. Except one in purhepecha.ruleset - I dothink "devolved into violence" is proper English. ~Daniel


Index: phoenician.ruleset
===
--- phoenician.ruleset	(revision 14228)
+++ phoenician.ruleset	(working copy)
@@ -7,9 +7,9 @@
  coastal regions of Lebanon and Syria.  They spoke a Canaanite language\
  related to Hebrew and were famed mariners.  Their alphabet served as the\
  source of the Greek alphabet, and from there evolved into the Etruscan\
- and Latin alphabets as well.  The Greeks and Romans new them for their\
+ and Latin alphabets as well.  The Greeks and Romans knew them for their\
  manufacture of purple dye from the myrex shell, which gave them their\
- Greek and Latin names.  They refered to themselves a Kan'ani and thier\
+ Greek and Latin names.  They refered to themselves a Kan'ani and their\
  Punic (Carthaginian) descendents in St. Augustine's day called themselves\
  Chanani.")
 leader=
Index: chola.ruleset
===
--- chola.ruleset	(revision 14228)
+++ chola.ruleset	(working copy)
@@ -4,7 +4,7 @@
 plural=_("?plural:Cholas")
 groups="Asian", "Ancient"
 
-legend=_("The Cholas were a Tamil dynasty in centered in southern India and\
+legend=_("The Cholas were a Tamil dynasty centered in southern India and\
  were rare in their level of influence in northern India. They began as a\
  tributary state to the Pallavas, but in the 9th century their power began\
  to grow. During the 11th century, they lead expeditions against other\
Index: laotian.ruleset
===
--- laotian.ruleset	(revision 14228)
+++ laotian.ruleset	(working copy)
@@ -9,7 +9,7 @@
  century, Laos became part of French Indochina.\
  French rule ended with independence in 1946 followed\
  by 30 years of civil war. In 1975 the communist Pathet\
- Lao established strict solicalist regime. However,\
+ Lao established a strict socialist regime. However,\
  in 1986 the liberalization and a gradual return to\
  private enterpise started.")
 
Index: khwarezmian.ruleset
===
--- khwarezmian.ruleset	(revision 14228)
+++ khwarezmian.ruleset	(working copy)
@@ -9,8 +9,8 @@
  controlling portions of the Silk Road. It was loosely controlled as a\
  satrapy under the Achaemenid and Sassanid Persian dynasties and was mythic\
  homeland of Zarathustra, the founder of Zoroastrianism. Following the\
- introduction of Islam, Khwarezm tended to be devided into two seperate\
- kingdoms, but was united under the Turkic Anushtegihidy dynasty, which\
+ introduction of Islam, Khwarezm tended to be divided into two separate\
+ kingdoms, but was united under the Turkic A