Re #720 Fixed possibly uninitialised vars
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5053 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 56222ad41d016a57c529efed1d125a8ddfa63491 Former-commit-id: 899388f1d3f0d6da7905fe2b8cee372bd15d2ff4
This commit is contained in:
parent
f5e28a19c9
commit
998a1fb8bd
2 changed files with 12 additions and 8 deletions
|
@ -716,7 +716,7 @@ void NetClient::ReadTimePacket(ENetPacket *pPacket)
|
|||
m_lag = (curTime-m_packetsendtime)/2.0;
|
||||
GfLogTrace ("Connection lag is %lf seconds\n",m_lag);
|
||||
|
||||
double time;
|
||||
double time = 0;
|
||||
|
||||
PackedBuffer msg(pPacket->data, pPacket->dataLength);
|
||||
GfLogTrace("ReadTimePacket: packed data length=%d\n",
|
||||
|
@ -740,8 +740,8 @@ void NetClient::ReadFilePacket(ENetPacket *pPacket)
|
|||
short len;
|
||||
size_t writeSize;
|
||||
char file[255];
|
||||
unsigned int filesize;
|
||||
char *filedata;
|
||||
unsigned int filesize = 0;
|
||||
char *filedata = 0;
|
||||
|
||||
memset(file, 0, sizeof file);
|
||||
|
||||
|
@ -772,9 +772,12 @@ void NetClient::ReadFilePacket(ENetPacket *pPacket)
|
|||
FILE *pFile = fopen(filepath,"w+b");
|
||||
GfLogTrace("Reading file packet: File- %s\n",filepath);
|
||||
|
||||
writeSize = fwrite(filedata, filesize, 1, pFile);
|
||||
if( writeSize <= 0 )
|
||||
GfLogTrace("Not all bytes are send to file");
|
||||
if (filedata && filesize > 0)
|
||||
{
|
||||
writeSize = fwrite(filedata, filesize, 1, pFile);
|
||||
if( writeSize <= 0 )
|
||||
GfLogTrace("Not all bytes are send to file");
|
||||
}
|
||||
fclose(pFile);
|
||||
|
||||
delete [] filedata;
|
||||
|
|
|
@ -604,7 +604,7 @@ void NetServer::ReadDriverReadyPacket(ENetPacket *pPacket)
|
|||
{
|
||||
GfLogTrace ("Read Driver Ready Packet\n");
|
||||
|
||||
int idx;
|
||||
int idx = 0;
|
||||
bool bReady;
|
||||
|
||||
PackedBuffer msg(pPacket->data, pPacket->dataLength);
|
||||
|
@ -623,7 +623,8 @@ void NetServer::ReadDriverReadyPacket(ENetPacket *pPacket)
|
|||
}
|
||||
|
||||
NetMutexData *pNData = LockNetworkData();
|
||||
pNData->m_vecReadyStatus[idx-1] = bReady;
|
||||
if (idx > 0)
|
||||
pNData->m_vecReadyStatus[idx-1] = bReady;
|
||||
UnlockNetworkData();
|
||||
|
||||
SendDriversReadyPacket();
|
||||
|
|
Loading…
Reference in a new issue