Do not use std::string in a memory structure that is memset().

Patch by tnmurphy, closes ticket:3620
master
Per Inge Mathisen 2012-07-30 22:16:16 +02:00
parent df32833ab8
commit fdb1c0b521
2 changed files with 4 additions and 4 deletions

View File

@ -1989,7 +1989,7 @@ UBYTE NETrecvFile(NETQUEUE queue)
}
NetPlay.pMapFileHandle = PHYSFS_openWrite(fileName); // create a new file.
NetPlay.mapFileName = fileName;
sstrcpy(NetPlay.mapFileName, fileName);
}
debug(LOG_NET, "New file position is %d", currPos);
@ -2022,10 +2022,10 @@ UBYTE NETrecvFile(NETQUEUE queue)
debug(LOG_ERROR, "Could not close file handle after trying to save map: %s", PHYSFS_getLastError());
}
NetPlay.pMapFileHandle = NULL;
PHYSFS_File *file = PHYSFS_openRead(NetPlay.mapFileName.c_str());
PHYSFS_File *file = PHYSFS_openRead(NetPlay.mapFileName);
int actualFileSize = PHYSFS_fileLength(file);
PHYSFS_close(file);
NetPlay.mapFileName.clear();
NetPlay.mapFileName[0] = '\0';
ASSERT(actualFileSize == fileSize, "Downloaded map too small! Got %d, expected %d!", actualFileSize, fileSize);
}

View File

@ -273,7 +273,7 @@ struct NETPLAY
bool isUPNP; // if we want the UPnP detection routines to run
bool isHostAlive; /// if the host is still alive
PHYSFS_file * pMapFileHandle; ///< Only non-NULL during map download.
std::string mapFileName; ///< Only valid during map download.
char mapFileName[255]; ///< Only valid during map download.
char gamePassword[password_string_size]; //
bool GamePassworded; // if we have a password or not.
bool ShowedMOTD; // only want to show this once