[CF-Devel] Common/loader.[lc] bug, player file corruption ahead

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Wed Oct 15 04:04:37 CDT 2003


Le Mardi 14 Octobre 2003 08:33, Mark Wedel a écrit :
>
     
      Nicolas Weeger wrote:
     
     >
     
      > Morning.
     
     >
     
      >
     
     >
     
      > Katia helped me trace the cause of the weird bug on
     
     >
     
      > crossfire.metalforge.net
     
     >
     
      >
     
     >
     
      > Here are some weird things, in loader.c (so in .l):
     
     >
     
      > * line 5594:
     
     >
     
      >     FAST_SAVE_LONG(fastbuf,"subtype ",op->subtype,2);
     
     >
     
      >                                                  ^^^
     
     >
     
      > should be 8, obviously. And that, i think, may break things later on.
     
     >
     
     
     >
     
        Yeah, that is wrong.  Really, all the fast_save routines should be coded
     
     >
     
      to do a strlen of the passed string.
     
     >
     
     
     

Ok, sorry if this email is short but cause of kmail behaviour it's the 4th 
time i write it (this message is doomed).

1st the object_diff routine with the FAST_... macros in it was a solution to a 
speed problem. The server was spending to much time swapping map (even on my 
XP 2400+ I could see the little lag of server when running at full throttle 
through the bigworld as dm).


2nd the things that were taking precious cpu and could be removed where
- - a seek for '\0' on buffer string when doing strcat
- - sprintf in a side buffer
- - strlen calls on lots constant strings

Concerning the third, that is why i tried to prevent use of strlen as much as 
possible. Sorry to miss the subtype error, i checked code several time and 
was looking at mailing list for strange 'saving behaviour bug' which could 
arise before removing old codes from comments. I thought there was no more 
problem (hey, the first error i found during beta test is experience badly 
saved, could you imagine the mob rushing on me if i had commited it? :) )
I understand use of strlen would be easier. If you want to change code and use 
back strlen (simply the code FAST macros to change a bit), i won't blame you 
neither will i try to change again the code to remove the strlen. But since 
the objects structure is something that do not change a lot as time goes on, 
i thought having a code a bit more difficult there but faster was a good 
tradeoff. the Object_diff is not a function that changes every week, am i 
wrong?


_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list