From 2d90392ba52867334d30853d061514028bf5b633 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 9 Dec 2019 16:59:10 +0000 Subject: COMMON: Fix GCC-9 Warning in MacResManager Class This is another case of a warning from using memset to clear a non-trivial data structure. GCC-9 detects this with the default warning of -Wclass-memaccess. --- common/macresman.cpp | 17 ++++++++++++++++- common/macresman.h | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/macresman.cpp b/common/macresman.cpp index 553b138717..ac78ea0bd0 100644 --- a/common/macresman.cpp +++ b/common/macresman.cpp @@ -47,7 +47,22 @@ namespace Common { #define MAXNAMELEN 63 MacResManager::MacResManager() { - memset(this, 0, sizeof(MacResManager)); + _stream = nullptr; + // _baseFileName cleared by String constructor + + _mode = kResForkNone; + + _resForkOffset = 0; + _resForkSize = 0; + + _dataOffset = 0; + _dataLength = 0; + _mapOffset = 0; + _mapLength = 0; + _resMap.reset(); + _resTypes = nullptr; + _resLists = nullptr; + close(); } diff --git a/common/macresman.h b/common/macresman.h index 1be825b7b4..703f3a1d29 100644 --- a/common/macresman.h +++ b/common/macresman.h @@ -220,6 +220,15 @@ private: uint16 typeOffset; uint16 nameOffset; uint16 numTypes; + + void reset() { + resAttr = 0; + typeOffset = 0; + nameOffset = 0; + numTypes = 0; + } + + ResMap() { reset(); } }; struct ResType { -- cgit v1.2.3