mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-08 23:19:40 +00:00
(svn r15571) -Fix: incorrect use of memset
This commit is contained in:
parent
2860399397
commit
846044ee26
@ -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!)
|
* @param num number of items to be set (!not number of bytes!)
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
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));
|
memset(ptr, value, num * sizeof(T));
|
||||||
}
|
}
|
||||||
|
@ -1323,7 +1323,7 @@ struct NetworkLobbyWindow : public Window {
|
|||||||
NetworkTCPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // company info
|
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
|
NetworkUDPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // general data
|
||||||
/* Clear the information so removed companies don't remain */
|
/* 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ OverrideManagerBase::OverrideManagerBase(uint16 offset, uint16 maximum, uint16 i
|
|||||||
|
|
||||||
mapping_ID = CallocT<EntityIDMapping>(max_new_entities);
|
mapping_ID = CallocT<EntityIDMapping>(max_new_entities);
|
||||||
entity_overrides = MallocT<uint16>(max_offset);
|
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);
|
grfid_overrides = CallocT<uint32>(max_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ static uint32 CalcCRC(byte *data, uint size, uint32 crc)
|
|||||||
static void GetFileInfo(DebugFileInfo *dfi, const TCHAR *filename)
|
static void GetFileInfo(DebugFileInfo *dfi, const TCHAR *filename)
|
||||||
{
|
{
|
||||||
HANDLE file;
|
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);
|
file = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
|
||||||
if (file != INVALID_HANDLE_VALUE) {
|
if (file != INVALID_HANDLE_VALUE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user