diff options
-rw-r--r-- | src/core/mem_func.hpp | 2 | ||||
-rw-r--r-- | src/network/network_gui.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_commons.cpp | 2 | ||||
-rw-r--r-- | src/win32.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/core/mem_func.hpp b/src/core/mem_func.hpp index e56ad365d..04248e947 100644 --- a/src/core/mem_func.hpp +++ b/src/core/mem_func.hpp @@ -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)); } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index dc070fd50..364c6f0e3 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -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; } } diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index 0b1e26a58..b96d6aedf 100644 --- a/src/newgrf_commons.cpp +++ b/src/newgrf_commons.cpp @@ -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); } diff --git a/src/win32.cpp b/src/win32.cpp index 56f2ce1cf..9b58757e9 100644 --- a/src/win32.cpp +++ b/src/win32.cpp @@ -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) { |