From: Jorrit T. <jo...@us...> - 2005-03-02 19:04:44
|
Update of /cvsroot/planeshift/planeshift/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1293/src/client Modified Files: authentclient.cpp cmdusers.cpp psengine.h Log Message: - Fixed a few cases where a function that returns a csString was used and immediatelly a GetData() on that like this: printf ("%s\n", SomeFunc().GetData ()); This is illegal because the compiler may throw away the temporary string before printf gets a chance to use it. If the string is returned as a reference then it is ok. I didn't yet manage to go over all code yet. Index: authentclient.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/authentclient.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** authentclient.cpp 22 Feb 2005 21:16:39 -0000 1.81 --- authentclient.cpp 2 Mar 2005 19:04:33 -0000 1.82 *************** *** 104,109 **** passwordhashandclientnum.Append(msg.ClientNum); // md5("password:clientnum") psAuthenticationMessage request(0,username, ! csMD5::Encode(passwordhashandclientnum).HexString().GetData() ); msghandler->SendMessage(request.msg); --- 104,110 ---- passwordhashandclientnum.Append(msg.ClientNum); // md5("password:clientnum") + csString hexstring = csMD5::Encode(passwordhashandclientnum).HexString(); psAuthenticationMessage request(0,username, ! hexstring.GetData() ); msghandler->SendMessage(request.msg); Index: cmdusers.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/cmdusers.cpp,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** cmdusers.cpp 7 Feb 2005 17:39:59 -0000 1.91 --- cmdusers.cpp 2 Mar 2005 19:04:34 -0000 1.92 *************** *** 200,204 **** { if (words.GetCount() > 1){ ! sprintf(buff,"<R TYPE=\"SELL\" TARGET=\"%s\"/>",words.GetTail(1).GetData()); } else --- 200,205 ---- { if (words.GetCount() > 1){ ! csString tail = words.GetTail(1); ! sprintf(buff,"<R TYPE=\"SELL\" TARGET=\"%s\"/>",tail.GetData()); } else *************** *** 220,224 **** { if (words.GetCount() > 1){ ! sprintf(buff,"<R TYPE=\"BUY\" TARGET=\"%s\"/>",words.GetTail(1).GetData()); } else --- 221,226 ---- { if (words.GetCount() > 1){ ! csString tail = words.GetTail(1); ! sprintf(buff,"<R TYPE=\"BUY\" TARGET=\"%s\"/>",tail.GetData()); } else Index: psengine.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/psengine.h,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** psengine.h 27 Feb 2005 23:54:51 -0000 1.151 --- psengine.h 2 Mar 2005 19:04:34 -0000 1.152 *************** *** 25,28 **** --- 25,29 ---- #include <csutil/ref.h> #include <csutil/leakguard.h> + #include <csutil/profile.h> #include "iclient/psengine.h" |