From 3a839517ce22f85eea167dadc41031afeffaa459 Mon Sep 17 00:00:00 2001 From: elexis Date: Fri, 19 Jul 2019 12:52:10 +0000 Subject: [PATCH] Fix the -Wclass-memaccess compiler warning in the pathfinders Grid.h, refs #5294. Differential Revision: https://code.wildfiregames.com/D2099 Reviewed By: historic_bruno, wraitii This was SVN commit r22511. --- source/simulation2/helpers/Grid.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/simulation2/helpers/Grid.h b/source/simulation2/helpers/Grid.h index e36ccbd38a..0df353ba6e 100644 --- a/source/simulation2/helpers/Grid.h +++ b/source/simulation2/helpers/Grid.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -190,8 +190,7 @@ class SparseGrid size_t b = (j >> BucketBits) * m_BW + (i >> BucketBits); if (!m_Data[b]) { - m_Data[b] = new T[BucketSize*BucketSize]; - memset(m_Data[b], 0, BucketSize*BucketSize*sizeof(T)); + m_Data[b] = new T[BucketSize*BucketSize](); } return m_Data[b]; } @@ -204,8 +203,7 @@ public: m_BW = (u16)((m_W + BucketSize-1) >> BucketBits); m_BH = (u16)((m_H + BucketSize-1) >> BucketBits); - m_Data = new T*[m_BW*m_BH]; - memset(m_Data, 0, m_BW*m_BH*sizeof(T*)); + m_Data = new T*[m_BW*m_BH](); } ~SparseGrid() @@ -219,7 +217,7 @@ public: for (size_t i = 0; i < (size_t)(m_BW*m_BH); ++i) delete[] m_Data[i]; - memset(m_Data, 0, m_BW*m_BH*sizeof(T*)); + m_Data = new T*[m_BW*m_BH](); } void set(int i, int j, const T& value)