<URL: http://bugs.freeciv.org/Ticket/Display.html?id=10775 >

On Sat, 8 Sep 2007 Marko Lindqvist wrote:

> On 08/09/07, Egor Vyscrebentsov  wrote:
> >
> > PS. Surprisingly, I don't see requirements for governments to be shown
> > (at least in gtk client...) Investigating.
>
>  insert_allows() a couple of lines later starts (over)writing from the
> beginning of the buffer.

Yes, wrong params of insert_allows(). Overwrites basic helptext also.
The quickest fix is:

-  insert_allows(&source, buf, bufsz);
+  insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf));

However, I don't understand why there should be zeroing of buffer
inside insert_allows(). If we allow callers to care about buffer*,
function (and its calls) become more clear.

*) All helptext_* functions (which are only callers of insert_allows)
care about buf.

PS. I thought that there was documented rule that we use my_snpritf()
rather than s[n]printf, but I can't find anything now...

PPS. I don't open new ticket, because this is 'incomplete helptext' bug :)

-- 
Thanks, evyscr

Index: client/helpdata.c
===================================================================
--- client/helpdata.c	(revision 13508)
+++ client/helpdata.c	(working copy)
@@ -1296,7 +1296,7 @@
 
   /* Effects */
   sprintf(buf + strlen(buf), _("Features:\n"));
-  insert_allows(&source, buf, bufsz);
+  insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf));
   effect_list_iterate(get_req_source_effects(&source), peffect) {
     Output_type_id output_type = O_LAST;
     struct unit_class *unitclass = NULL;
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to