Re: Ascii Pfile write problem

From: Welcor (welcor@dune.net)
Date: 11/01/01


From: "Brian Jenkins" <brianjenkins@ATT.NET>
>
> mail.c: In function 'mail_recip_ok':
> mail.c:64: warning: passing arg 2 of 'load_char' from incompatible
> pointer type
> mail.c:65: warning: passing arg 1 of 'store_to_char' from incompatible
> pointer type
>
>  Both of the arg's in the mail.c warnings refer to &tmp_store
>
> Here is the rest of the code context:
> <---Snippet--->
> void store_to_char(char *name, struct char_data * ch)
>   {
> ...
>        /* set real_abils = aff_abils */
>        ch->real_abils = ch->aff_abils;
>
> 2406:   for (i = 0; i < MAX_AFFECT, tmp_aff[i].type!=0; i++) {

Change this to:
          for (i = 0; i < MAX_AFFECT && tmp_aff[i].type!=0; i++) {

>          if (tmp_aff[i].type)
>            affect_to_char(ch, &tmp_aff[i]);
> ...
> void char_to_store(struct char_data * ch)
>   {
> ...
> 2522: fprintf(fl, "Brth: %d\n", ch->player.time.birth);
>       fprintf(fl, "Plyd: %d\n", ch->player.time.played);
> 2524: fprintf(fl, "Last: %d\n", ch->player.time.logon);
>     if(ch->desc->host)
>       fprintf(fl, "Host: %s\n", ch->desc->host);
>       fprintf(fl, "Hite: %d\n", GET_HEIGHT(ch));
>       fprintf(fl, "Wate: %d\n", GET_WEIGHT(ch));
>       fprintf(fl, "Alin: %d\n", GET_ALIGNMENT(ch));
> 2530: fprintf(fl, "Id  : %d\n", GET_IDNUM(ch));
> 2531: fprintf(fl, "Act : %d\n", PLR_FLAGS(ch));
> <---Snippet--->

To fix all of these, change them like this:
before: fprintf(fl, "Act : %d\n", PLR_FLAGS(ch));
after:  fprintf(fl, "Act : %ld\n", (long)PLR_FLAGS(ch));

This will 'cast' the PLR_FLAGS() bitvector as a long int, and change
the expected type to long int (%ld). For more info on [fs ]printf
check out the GNU C library at
http://www.fsf.org/manual/glibc-2.0.6/html_node/libc_toc.html

This is a good reference site, as it contains all of the 'standard'
library functions.

>
> I think the mail.c problems will fix themselves if i fix this problem
> becouse I
> didn't edit mail.c at all with this patch.
>

Perhaps you should. Make sure you are calling char_to_store and load_char
with the right args. (hint: have a look at the old function prototypes, and
the new ones, and see if any changes occur.)

Welcor

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST