Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: [PATCH] Buglet in server/savegame.c
Home

[Freeciv-Dev] Re: [PATCH] Buglet in server/savegame.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gaute B Strokkenes <gs234@xxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] Buglet in server/savegame.c
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 14 Oct 2001 21:53:51 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sun, Oct 14, 2001 at 08:40:50PM +0100, Gaute B Strokkenes wrote:
> 
> I just spotted the following while going through some of Jason's
> recent changes (though the bug is not Jason's).
> 
> strchr() has a misfeature in that if the character you are looking for
> is 0, then it will return a pointer to the string's terminating NUL.
> This causes us to do wrong things in the savegame loading code.

> As an aside, I believe that PR 974 may be related to this bug, but I
> do not have time to investigate.

Yes this would catch the error a bit earlier in teh loading. Still
unknown is what caused it in the first place. I have thought about
doing:

  for (y = 0; y < map.ysize; y++) {                     \
    for (x = 0; x < map.xsize; x++) {                   \
      if (is_normal_map_pos(x, y)) {                    \
        line[x] = get_xy_char;                          \
+       assert(line[x]!='\0');
      } else {                                          \
        /* skipped over in loading */                   \
        line[x] = '#';                                  \
      }                                                 \
    }                                                   \

So far I haven't implemented it. Comments?

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 Q:  Do you know what the death rate around here is?
 A:  One per person.


[Prev in Thread] Current Thread [Next in Thread]