From: Andy D. <kha...@us...> - 2005-01-10 13:09:07
|
Update of /cvsroot/planeshift/planeshift/src/server/bulkobjects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16066 Modified Files: pscharacterlist.cpp pscharacterlist.h Log Message: Reverted pscharacterlist.cpp to revision 1.5 and pscharacterlist.h to revision 1.3, so that Keith's commit is reverted. The removal of the bunch of static char[] arrays caused even more memory corruption as later on that section of memory was being cleared to 0. This is the first time I've seen a case where using csStrings rather than char[] makes the server even more buggy. :) Index: pscharacterlist.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/pscharacterlist.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pscharacterlist.cpp 10 Jan 2005 12:13:44 -0000 1.8 --- pscharacterlist.cpp 10 Jan 2005 13:08:51 -0000 1.9 *************** *** 64,68 **** if (!characterentry[index].valid) return; ! characterentry[index].character_name = v; } --- 64,69 ---- if (!characterentry[index].valid) return; ! strncpy(characterentry[index].character_name,v,28); ! characterentry[index].character_name[27]=0x00; } *************** *** 77,83 **** SetCharacterName(index, v); // Set full name ! characterentry[index].character_fullname = v; ! characterentry[index].character_fullname.Append(' '); ! characterentry[index].character_fullname.Append(w); } --- 78,85 ---- SetCharacterName(index, v); // Set full name ! strncpy(characterentry[index].character_fullname,v,27); ! strncat(characterentry[index].character_fullname," ",1); ! strncat(characterentry[index].character_fullname,w,27); ! characterentry[index].character_fullname[55]=0x00; } Index: pscharacterlist.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/bulkobjects/pscharacterlist.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pscharacterlist.h 10 Jan 2005 05:47:48 -0000 1.4 --- pscharacterlist.h 10 Jan 2005 13:08:51 -0000 1.5 *************** *** 23,33 **** #define MAX_CHARACTERS_IN_LIST 10 ! struct psCharacterListEntry { bool valid; unsigned int character_id; ! csString character_name; ! csString character_fullname; ! }; --- 23,33 ---- #define MAX_CHARACTERS_IN_LIST 10 ! typedef struct st_psCharacterListEntry { bool valid; unsigned int character_id; ! char character_name[28]; ! char character_fullname[56]; ! } psCharacterListEntry; |