(svn r15571) -Fix: incorrect use of memset

This commit is contained in:
smatz 2009-02-24 22:25:23 +00:00
parent 2860399397
commit 846044ee26
4 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ static FORCEINLINE void MemMoveT(T *destination, const T *source, uint num = 1)
* @param num number of items to be set (!not number of bytes!)
*/
template <typename T>
static FORCEINLINE void MemSetT(T *ptr, int value, uint num = 1)
static FORCEINLINE void MemSetT(T *ptr, byte value, uint num = 1)
{
memset(ptr, value, num * sizeof(T));
}

View File

@ -1323,7 +1323,7 @@ struct NetworkLobbyWindow : public Window {
NetworkTCPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // company info
NetworkUDPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // general data
/* Clear the information so removed companies don't remain */
memset(this->company_info, 0, sizeof(company_info));
memset(this->company_info, 0, sizeof(this->company_info));
break;
}
}

View File

@ -26,7 +26,7 @@ OverrideManagerBase::OverrideManagerBase(uint16 offset, uint16 maximum, uint16 i
mapping_ID = CallocT<EntityIDMapping>(max_new_entities);
entity_overrides = MallocT<uint16>(max_offset);
memset(entity_overrides, invalid, sizeof(entity_overrides));
for (size_t i = 0; i < max_offset; i++) entity_overrides[i] = invalid;
grfid_overrides = CallocT<uint32>(max_offset);
}

View File

@ -150,7 +150,7 @@ static uint32 CalcCRC(byte *data, uint size, uint32 crc)
static void GetFileInfo(DebugFileInfo *dfi, const TCHAR *filename)
{
HANDLE file;
memset(dfi, 0, sizeof(dfi));
memset(dfi, 0, sizeof(*dfi));
file = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if (file != INVALID_HANDLE_VALUE) {